29 INLINE
int SpeedTreeNode::
30 get_num_trees()
const {
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;
65 return (
STTree *)instance_list->get_tree();
82 return _terrain !=
nullptr;
109 INLINE
double SpeedTreeNode::
110 get_time_delta()
const {
121 _global_time_delta = delta;
129 INLINE
double SpeedTreeNode::
130 get_global_time_delta() {
131 return _global_time_delta;
137 INLINE SpeedTreeNode::InstanceList::
138 InstanceList(
const STTree *tree) : _tree((
STTree *)tree) {
146 return _tree < other._tree;
160 INLINE
int SpeedTreeNode::InstanceList::
161 get_num_instances()
const {
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);
205 INLINE SpeedTreeNode::DrawCallback::
STTerrain * get_terrain() const
Returns the terrain associated with the node, or NULL if there is no terrain.
bool has_terrain() const
Returns true if a valid terrain has been associated with the node, false otherwise.
size_type_0 size() const
Returns the number of elements in the ordered vector.
void clear_terrain()
Removes the terrain associated with the node.
bool is_valid() const
Returns true if the node is valid and ready to render, false otherwise.
This is the abstract base class that defines the interface needed to describe a terrain for rendering...
bool operator<(const InstanceList &other) const
Used for comparison for ov_set.
STTree * modify_tree(int n)
Returns a modifiable STTree pointer for the nth tree instance.
void set_terrain(STTerrain *terrain)
Associated a terrain with the node.
const STTree * get_tree() const
Returns the particular tree this list refers to.
get_instance_list
Returns a list of transforms that corresponds to the instances at which the indicated tree appears.
void set_instance(int n, const STTransform &transform)
Replaces the transform of the nth instance of this tree.
void remove_instance(int n)
Removes the nth instance of this tree.
Interfaces with the SpeedTree library to render SpeedTree objects, especially trees,...
get_instance
Returns the transform of the nth instance of this tree.
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.
int add_instance(const STTransform &transform)
Adds a new instance of this tree at the indicated transform.
Encapsulates a single tree model in the SpeedTree library, as loaded from an SRT file.
set_time_delta
Specifies an offset that is to be added each frame to the global clock's frame_time for the purpose o...