Go to the documentation of this file.
33 RigidBodyCombiner(
const std::string &name) :
PandaNode(name) {
43 _internal_root->set_final(
true);
53 _internal_root = copy._internal_root;
54 _internal_transforms = copy._internal_transforms;
86 _internal_root =
new GeomNode(get_name());
87 _internal_transforms.clear();
92 for (
int i = 0; i < num_children; i++) {
93 r_collect(cr.
get_child(i), RenderState::make_empty(),
nullptr);
100 gr.
collect_vertex_data(_internal_root, ~(SceneGraphReducer::CVD_format | SceneGraphReducer::CVD_name | SceneGraphReducer::CVD_animation_type));
101 gr.
unify(_internal_root,
false);
140 Transforms::iterator ti;
141 for (ti = _internal_transforms.begin();
142 ti != _internal_transforms.end();
144 (*ti)->mark_modified(current_thread);
160 void RigidBodyCombiner::
163 CPT(
RenderState) next_state = state->compose(node->get_state());
165 if (!node->get_transform()->is_identity() ||
166 (node->
is_of_type(ModelNode::get_class_type()) &&
167 DCAST(
ModelNode, node)->get_preserve_transform() != ModelNode::PT_none)) {
170 _internal_transforms.push_back(new_transform);
171 next_transform = new_transform.p();
180 for (
int i = 0; i < num_geoms; ++i) {
181 PT(
Geom) geom = gnode->get_geom(i)->make_copy();
182 if (next_transform !=
nullptr) {
183 geom->set_vertex_data(convert_vd(next_transform, geom->get_vertex_data()));
191 int num_children = cr.get_num_children();
192 for (
int i = 0; i < num_children; i++) {
193 r_collect(cr.get_child(i), next_state, next_transform);
206 VDTable::iterator vdti = _vd_table.find(VDUnifier(transform, orig));
207 if (vdti != _vd_table.end()) {
208 return (*vdti).second;
212 if (!orig->
get_format()->has_column(InternalName::get_transform_blend())) {
214 af->add_column(InternalName::get_transform_blend(), 1,
215 Geom::NT_uint16, Geom::C_index, 0, 2);
216 format->add_array(af);
221 format->set_animation(spec);
222 format->maybe_align_columns_for_animation();
224 CPT(
GeomVertexFormat) new_format = GeomVertexFormat::register_format(format);
228 if (new_data->get_transform_blend_table() ==
nullptr) {
234 new_data->set_transform_blend_table(new_table);
241 _vd_table[VDUnifier(transform, orig)] = new_data;
A container for geometry primitives.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_internal_scene
Returns a special NodePath that represents the internal node of this object.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual bool is_geom_node() const
A simple downcast check.
An interface for simplifying ("flattening") scene graphs by eliminating unneeded nodes and collapsing...
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
PT(GeomVertexData) RigidBodyCombiner
Converts a GeomVertexData to a new form in which all of the vertices are transformed by the node's tr...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void collect()
Walks through the entire subgraph of nodes rooted at this node, accumulates all of the RenderAttribs ...
get_format
Returns a pointer to the GeomVertexFormat structure that defines this data.
int collect_vertex_data(PandaNode *root, int collect_bits=~0)
Collects all different GeomVertexData blocks that have compatible formats at this node and below into...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
PandaNode * get_child(size_t n) const
Returns the nth child of the node.
This is a special node that combines multiple independently-moving rigid nodes into one Geom internal...
void set_panda()
Specifies that vertex animation is to be performed by Panda.
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
get_children
Returns an object that can be used to walk through the list of children of the node.
get_num_geoms
Returns the number of geoms in the node.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
void unify(PandaNode *root, bool preserve_order)
Calls unify() on every GeomNode at this level and below.
get_current_thread
Returns a pointer to the currently-executing Thread object.
TypeHandle is the identifier used to differentiate C++ class types.
A node that holds Geom objects, renderable pieces of geometry.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This object describes how the vertex animation, if any, represented in a GeomVertexData is encoded.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
size_t get_num_children() const
Returns the number of children of the node.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
This is a special kind of GeometricBoundingVolume that fills all of space.
This node is placed at key points within the scene graph to indicate the roots of "models": subtrees ...
void apply_attribs(PandaNode *node, int attrib_types=~(TT_clip_plane|TT_cull_face|TT_apply_texture_color))
Walks the scene graph, accumulating attribs of the indicated types, applying them to the vertices,...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
static SparseArray range(int low_bit, int size)
Returns a SparseArray whose size bits, beginning at low_bit, are on.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
get_geom_state
Returns the RenderState associated with the nth geom of the node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void traverse(const NodePath &root)
Begins the traversal from the indicated node.
A basic node of the scene graph or data graph.
void add_geom(Geom *geom, const RenderState *state=RenderState::make_empty())
Adds a new Geom to the node.
A thread; that is, a lightweight process.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.