14#ifndef SHADER_TERRAIN_MESH_H
15#define SHADER_TERRAIN_MESH_H
37NotifyCategoryDecl(shader_terrain, EXPCL_PANDA_GRUTIL, EXPTP_PANDA_GRUTIL);
81 INLINE LPoint3
uv_to_world(PN_stdfloat u, PN_stdfloat v)
const;
110 PN_stdfloat avg_height, min_height, max_height;
116 PN_stdfloat last_clod;
118 INLINE
void clear_children();
125 struct ChunkDataEntry {
130 PN_float32 size, y, x, clod;
134 struct TraversalData {
142 BoundingVolume* cam_bounds;
148 LVector2i screen_size;
151 ChunkDataEntry* storage_ptr;
154 bool do_check_heightfield();
155 void do_extract_heightfield();
156 void do_init_data_texture();
157 void do_create_chunks();
158 void do_init_chunk(Chunk* chunk);
159 void do_compute_bounds(Chunk* chunk);
160 void do_create_chunk_geom();
161 void do_traverse(Chunk* chunk, TraversalData* data,
bool fully_visible =
false);
162 void do_emit_chunk(Chunk* chunk, TraversalData* data);
163 bool do_check_lod_matches(Chunk* chunk, TraversalData* data);
169 bool _generate_patches;
170 PNMImage _heightfield;
171 PT(Texture) _heightfield_tex;
172 PT(Geom) _chunk_geom;
173 PT(Texture) _data_texture;
174 size_t _current_view_index;
175 int _last_frame_count;
176 PN_stdfloat _target_triangle_width;
177 bool _update_enabled;
180 static PStatCollector _lod_collector;
181 static PStatCollector _basic_collector;
186 static TypeHandle get_class_type() {
189 static void init_type() {
190 PandaNode::init_type();
191 register_type(_type_handle,
"ShaderTerrainMesh", PandaNode::get_class_type());
193 virtual TypeHandle get_type()
const {
194 return get_class_type();
196 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
199 static TypeHandle _type_handle;
This is a convenience class to specialize ConfigVariable as a boolean type.
This is a convenience class to specialize ConfigVariable as an integer type.
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
virtual bool safe_to_combine() const
Returns true if it is generally safe to combine this particular kind of PandaNode with other kinds of...
virtual bool is_renderable() const
Returns true if there is some value to visiting this particular node during the cull traversal for an...
virtual void add_for_draw(CullTraverser *trav, CullTraverserData &data)
Adds the node's contents to the CullResult we are building up during the cull traversal,...
virtual bool safe_to_flatten() const
Returns true if it is generally safe to flatten out this particular kind of PandaNode by duplicating ...
get_heightfield
Returns the heightfield.
set_chunk_size
Sets the chunk size.
set_heightfield
Sets the heightfield texture.
LPoint3 uv_to_world(const LTexCoord &coord) const
Transforms a texture coordinate to world space.
get_chunk_size
Returns the chunk size.
get_target_triangle_width
Returns the target triangle width.
set_target_triangle_width
Sets the desired triangle width.
get_update_enabled
Returns whether the terrain is getting updated.
set_update_enabled
Sets whether to enable terrain updates.
set_generate_patches
Sets whether to generate patches.
get_generate_patches
Returns whether to generate patches.
ShaderTerrainMesh()
Constructs a new Terrain Mesh.
bool generate()
Generates the terrain mesh.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.