14#ifndef SPEEDTREENODE_H
15#define SPEEDTREENODE_H
36#if SPEEDTREE_VERSION_MAJOR > 5 || (SPEEDTREE_VERSION_MAJOR == 5 && SPEEDTREE_VERSION_MINOR >= 3)
37#undef ST_DELETE_FOREST_HACK
39#define ST_DELETE_FOREST_HACK
61 INLINE
bool operator < (
const InstanceList &other)
const;
64 INLINE
const STTree *get_tree()
const;
66 INLINE
int get_num_instances()
const;
68 MAKE_SEQ(get_instances, get_num_instances, get_instance);
69 INLINE
void set_instance(
int n,
const STTransform &transform);
71 INLINE
int add_instance(
const STTransform &transform);
72 INLINE
void remove_instance(
int n);
74 void output(std::ostream &out)
const;
75 void write(std::ostream &out,
int indent_level = 0)
const;
91 INLINE
bool is_valid()
const;
93 INLINE
int get_num_trees()
const;
94 INLINE
const STTree *get_tree(
int n)
const;
95 MAKE_SEQ(get_trees, get_num_trees, get_tree);
97 MAKE_SEQ(get_instance_lists, get_num_trees, get_instance_list);
98 INLINE
STTree *modify_tree(
int n);
100 int count_total_instances()
const;
103 int remove_tree(
const STTree *tree);
104 void remove_all_trees();
106 bool has_instance_list(
const STTree *tree)
const;
111 void add_instances(
const NodePath &root,
const TransformState *transform = TransformState::make_identity());
114 void add_random_instances(
const STTree *tree,
int quantity,
115 PN_stdfloat x_min, PN_stdfloat x_max,
116 PN_stdfloat y_min, PN_stdfloat y_max,
117 PN_stdfloat scale_min, PN_stdfloat scale_max,
118 PN_stdfloat height_min, PN_stdfloat height_max,
119 PN_stdfloat slope_min, PN_stdfloat slope_max,
122 bool add_from_stf(
const Filename &stf_filename,
124 bool add_from_stf(std::istream &in,
const Filename &pathname,
126 Loader *loader =
nullptr);
128 bool setup_terrain(
const Filename &terrain_file);
130 INLINE
void clear_terrain();
131 INLINE
bool has_terrain()
const;
134 void snap_to_terrain();
136 void reload_config();
138 void set_wind(
double strength,
const LVector3 &direction);
140 INLINE
void set_time_delta(
double delta);
141 INLINE
double get_time_delta()
const;
142 INLINE
static void set_global_time_delta(
double delta);
143 INLINE
static double get_global_time_delta();
144 MAKE_PROPERTY(time_delta, get_time_delta, set_time_delta);
145 MAKE_PROPERTY(global_time_delta, get_global_time_delta,
146 set_global_time_delta);
148 static bool authorize(
const std::string &license =
"");
165 virtual void compute_internal_bounds(CPT(
BoundingVolume) &internal_bounds,
166 int &internal_vertices,
168 Thread *current_thread)
const;
170 virtual void output(std::ostream &out)
const;
171 virtual void write(std::ostream &out,
int indent_level)
const;
173 static void write_error(std::ostream &out);
176 void set_transparent_texture_mode(SpeedTree::ETextureAlphaRenderMode eMode)
const;
184 void update_terrain_cells();
187 void render_forest_into_shadow_maps();
191 void print_forest_stats(
const SpeedTree::CForest::SPopulationStats &forest_stats)
const;
196 ALLOC_DELETED_CHAIN(DrawCallback);
207 static void init_type() {
208 CallbackObject::init_type();
210 CallbackObject::get_class_type());
213 return get_class_type();
215 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
222 std::string _os_shaders_dir;
228#ifdef ST_DELETE_FOREST_HACK
229 SpeedTree::CForestRender &_forest_render;
231 SpeedTree::CForestRender _forest_render;
233 SpeedTree::CView _view;
234 SpeedTree::SForestCullResultsRender _visible_trees;
235 SpeedTree::CForest::SPopulationStats _population_stats;
236 bool _needs_repopulate;
240 SpeedTree::CTerrainRender _terrain_render;
241 SpeedTree::STerrainCullResults _visible_terrain;
243 SpeedTree::Vec3 _light_dir;
249 SpeedTree::CView _light_view;
250 SpeedTree::SForestCullResultsRender _light_cull;
251 PN_stdfloat _shadow_split;
254 ShadowInfos _shadow_infos;
257 static double _global_time_delta;
259 static bool _authorized;
260 static bool _done_first_init;
284 static void init_type() {
285 PandaNode::init_type();
287 PandaNode::get_class_type());
288 DrawCallback::init_type();
291 return get_class_type();
293 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
298 friend class SpeedTreeNode::DrawCallback;
302 instances.output(out);
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This class is used by the SceneGraphReducer to maintain and accumulate the set of attributes we have ...
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
This is a generic data block that is passed along to a CallbackObject when a callback is made.
This is a generic object that can be assigned to a callback at various points in the rendering proces...
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 class to retrieve the individual data elements previously stored in a Datagram.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
An instance of this class is passed to the Factory when requesting it to do its business and construc...
The name of a file, such as a texture file or an Egg file.
This is a base class for the GraphicsStateGuardian class, which is itself a base class for the variou...
Encapsulates all the communication with a particular instance of a given rendering backend.
Specifies parameters that may be passed to the loader.
A convenient class for loading models from disk, in bam or egg format (or any of a number of other fo...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
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 PandaNode * combine_with(PandaNode *other)
Collapses this PandaNode with the other PandaNode, if possible, and returns a pointer to the combined...
virtual bool is_renderable() const
Returns true if there is some value to visiting this particular node during the cull traversal for an...
static void register_with_read_factory()
Tells the BamReader how to create objects of type PandaNode.
virtual void apply_attribs_to_vertices(const AccumulatedAttribs &attribs, int attrib_types, GeomTransformer &transformer)
Applies whatever attributes are specified in the AccumulatedAttribs object (and by the attrib_types b...
virtual PandaNode * make_copy() const
Returns a newly-allocated PandaNode that is a shallow copy of this one.
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 void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
A handy class to return random numbers.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
This is the abstract base class that defines the interface needed to describe a terrain for rendering...
Encapsulates a single tree model in the SpeedTree library, as loaded from an SRT file.
Interfaces with the SpeedTree library to render SpeedTree objects, especially trees,...
A thread; that is, a lightweight process.
TypeHandle is the identifier used to differentiate C++ class types.
Base class for objects that can be written to and read from Bam files.
A specialization of ordered_vector that emulates a standard STL set: one copy of each element is allo...
This is our own Panda specialization on the default STL vector.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.