31 return (
int)_trees.
size();
39 nassertr(n >= 0 && n < (
int)_trees.
size(),
nullptr);
40 InstanceList *instance_list = _trees[n];
41 return instance_list->get_tree();
52 assert(n >= 0 && n < (
int)_trees.
size());
53 InstanceList *instance_list = _trees[n];
54 return *instance_list;
62 nassertr(n >= 0 && n < (
int)_trees.
size(),
nullptr);
64 _needs_repopulate =
true;
82 return _terrain !=
nullptr;
121 _global_time_delta = delta;
131 return _global_time_delta;
137INLINE SpeedTreeNode::InstanceList::
138InstanceList(
const STTree *tree) : _tree((
STTree *)tree) {
146 return _tree < other._tree;
162 return (
int)_instances.size();
171 return _instances[n];
179 nassertv(n >= 0 && n < (
int)_instances.size());
180 _instances[n] = transform;
189 _instances.push_back(transform);
190 return ((
int)_instances.size() - 1);
198 nassertv(n >= 0 && n < (
int)_instances.size());
199 _instances.erase(_instances.begin() + n);
205INLINE SpeedTreeNode::DrawCallback::
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.
int add_instance(const STTransform &transform)
Adds a new instance of this tree at the indicated transform.
void remove_instance(int n)
Removes the nth instance of this tree.
void set_instance(int n, const STTransform &transform)
Replaces the transform of the nth instance of this tree.
const STTree * get_tree() const
Returns the particular tree this list refers to.
get_num_instances
Returns the number of instances of this tree.
get_instance
Returns the transform of the nth instance of this tree.
bool operator<(const InstanceList &other) const
Used for comparison for ov_set.
Interfaces with the SpeedTree library to render SpeedTree objects, especially trees,...
bool has_terrain() const
Returns true if a valid terrain has been associated with the node, false otherwise.
STTree * modify_tree(int n)
Returns a modifiable STTree pointer for the nth tree instance.
get_num_trees
Returns the number of unique tree objects that have been added to the node.
bool is_valid() const
Returns true if the node is valid and ready to render, false otherwise.
void set_terrain(STTerrain *terrain)
Associated a terrain with the node.
get_instance_list
Returns a list of transforms that corresponds to the instances at which the indicated tree appears.
set_time_delta
Specifies an offset that is to be added each frame to the global clock's frame_time for the purpose o...
set_global_time_delta
Specifies an offset that is to be added each frame to the global clock's frame_time for the purpose o...
get_tree
Returns the STTree pointer for the nth tree.
get_global_time_delta
Returns an offset that is to be added each frame to the global clock's frame_time for the purpose of ...
void clear_terrain()
Removes the terrain associated with the node.
get_time_delta
Returns an offset that is to be added each frame to the global clock's frame_time for the purpose of ...
STTerrain * get_terrain() const
Returns the terrain associated with the node, or NULL if there is no terrain.
size_type_0 size() const
Returns the number of elements in the ordered vector.