34class EXPCL_PANDASPEEDTREE STTerrain :
public TypedReferenceCount,
public Namable {
37 STTerrain(
const STTerrain ©);
59 virtual PN_stdfloat
get_height(PN_stdfloat x, PN_stdfloat y)
const=0;
60 virtual PN_stdfloat
get_smooth_height(PN_stdfloat x, PN_stdfloat y, PN_stdfloat radius)
const;
61 virtual PN_stdfloat
get_slope(PN_stdfloat x, PN_stdfloat y)
const;
64 PN_stdfloat height_min, PN_stdfloat height_max,
65 PN_stdfloat slope_min, PN_stdfloat slope_max);
68 PN_stdfloat start_x, PN_stdfloat start_y,
69 PN_stdfloat size_xy,
int num_xy)
const;
71 virtual void output(std::ostream &out)
const;
72 virtual void write(std::ostream &out,
int indent_level = 0)
const;
80 typedef pvector<SpeedTree::SVertexAttribDesc> VertexAttribs;
81 static bool convert_vertex_format(VertexAttribs &st_vertex_attribs,
83 static bool convert_vertex_column(SpeedTree::SVertexAttribDesc &st_attrib,
91 UnalignedLVecBase4 _color;
93 typedef pvector<SplatLayer> SplatLayers;
100 SplatLayers _splat_layers;
103 VertexAttribs _st_vertex_attribs;
105 PN_stdfloat _min_height;
106 PN_stdfloat _max_height;
112 static void init_type() {
113 TypedReferenceCount::init_type();
115 TypedReferenceCount::get_class_type());
118 return get_class_type();
120 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
126INLINE std::ostream &operator << (std::ostream &out,
const STTerrain &terrain) {
The name of a file, such as a texture file or an Egg file.
This defines how a single column is interleaved within a vertex array stored within a Geom.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
void output(std::ostream &out) const
Outputs the Namable.
This is the abstract base class that defines the interface needed to describe a terrain for rendering...
const Filename & get_splat_layer(int n) const
Returns the nth splat layer that is to be applied to the terrain.
PN_stdfloat get_max_height() const
Returns the largest height value that might be returned by get_height().
virtual void fill_vertices(GeomVertexData *data, PN_stdfloat start_x, PN_stdfloat start_y, PN_stdfloat size_xy, int num_xy) const
After load_data() has been called, this will be called occasionally to populate the vertices for a te...
virtual PN_stdfloat get_smooth_height(PN_stdfloat x, PN_stdfloat y, PN_stdfloat radius) const
After load_data() has been called, this should return the approximate average height value over a cir...
const SpeedTree::SVertexAttribDesc * get_st_vertex_format() const
Returns a pointer to the SpeedTree array of vertex attribs that defines the vertex format for SpeedTr...
PN_stdfloat get_min_height() const
Returns the smallest height value that might be returned by get_height().
virtual void clear()
Resets the terrain to its initial, unloaded state.
const GeomVertexFormat * get_vertex_format()
Returns the vertex format of the vertex array that is supported by this terrain data.
int get_num_splat_layers() const
Returns the number of splat layers that are to be applied to the terrain.
LColor get_splat_layer_color(int n) const
Returns the overall color of the nth splat layer.
virtual PN_stdfloat get_height(PN_stdfloat x, PN_stdfloat y) const =0
After load_data() has been called, this should return the computed height value at point (x,...
bool placement_is_acceptable(PN_stdfloat x, PN_stdfloat y, PN_stdfloat height_min, PN_stdfloat height_max, PN_stdfloat slope_min, PN_stdfloat slope_max)
Returns true if the elevation and slope of point (x, y) fall within the requested limits,...
const Filename & get_normal_map() const
Returns the normal map that should be applied to the terrain.
virtual PN_stdfloat get_slope(PN_stdfloat x, PN_stdfloat y) const
After load_data() has been called, this should return the directionless slope at point (x,...
bool is_valid() const
Returns true if the terrain data is well-defined and ready to use.
const Filename & get_splat_map() const
Returns the splat map that should be applied to the terrain.
PN_stdfloat get_splat_layer_tiling(int n) const
Returns the tiling value of the nth splat layer.
virtual void load_data()=0
This will be called at some point after initialization.
TypeHandle is the identifier used to differentiate C++ class types.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(),...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.