14#ifndef SHADER_TERRAIN_MESH_H
15#define SHADER_TERRAIN_MESH_H
37NotifyCategoryDecl(shader_terrain, EXPCL_PANDA_GRUTIL, EXPTP_PANDA_GRUTIL);
60 INLINE
void set_heightfield(
Texture* heightfield);
61 INLINE
Texture* get_heightfield()
const;
62 MAKE_PROPERTY(heightfield, get_heightfield, set_heightfield);
64 INLINE
void set_chunk_size(
size_t chunk_size);
65 INLINE
size_t get_chunk_size()
const;
66 MAKE_PROPERTY(chunk_size, get_chunk_size, set_chunk_size);
68 INLINE
void set_generate_patches(
bool generate_patches);
69 INLINE
bool get_generate_patches()
const;
70 MAKE_PROPERTY(generate_patches, get_generate_patches, set_generate_patches);
72 INLINE
void set_update_enabled(
bool update_enabled);
73 INLINE
bool get_update_enabled()
const;
74 MAKE_PROPERTY(update_enabled, get_update_enabled, set_update_enabled);
76 INLINE
void set_target_triangle_width(PN_stdfloat target_triangle_width);
77 INLINE PN_stdfloat get_target_triangle_width()
const;
78 MAKE_PROPERTY(target_triangle_width, get_target_triangle_width, set_target_triangle_width);
80 LPoint3 uv_to_world(
const LTexCoord& coord)
const;
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 {
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;
172 PT(
Geom) _chunk_geom;
174 size_t _current_view_index;
175 int _last_frame_count;
176 PN_stdfloat _target_triangle_width;
177 bool _update_enabled;
189 static void init_type() {
190 PandaNode::init_type();
191 register_type(_type_handle,
"ShaderTerrainMesh", PandaNode::get_class_type());
194 return get_class_type();
196 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
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 collects together the pieces of data that are accumulated for each node while walking the scene ...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
A container for geometry primitives.
A standard mutex, or mutual exclusion lock.
The name of this class derives from the fact that we originally implemented it as a layer on top of t...
A lightweight class that represents a single element that may be timed and/or counted via stats.
A basic node of the scene graph or data graph.
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 ...
Terrain Renderer class utilizing the GPU.
Represents a texture object, which is typically a single 2-d image but may also represent a 1-d or 3-...
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.
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.