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;
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,...
void traverse(const NodePath &root)
Begins the traversal from the indicated node.
A node that holds Geom objects, renderable pieces of geometry.
void add_geom(Geom *geom, const RenderState *state=RenderState::make_empty())
Adds a new Geom to the node.
get_num_geoms
Returns the number of geoms in the node.
get_geom_state
Returns the RenderState associated with the nth geom of the node.
This object describes how the vertex animation, if any, represented in a GeomVertexData is encoded.
void set_panda()
Specifies that vertex animation is to be performed by Panda.
This defines the actual numeric vertex data stored in a Geom, in the structure defined by a particula...
get_format
Returns a pointer to the GeomVertexFormat structure that defines this data.
A container for geometry primitives.
This node is placed at key points within the scene graph to indicate the roots of "models": subtrees ...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
This is a special kind of GeometricBoundingVolume that fills all of space.
PandaNode * get_child(size_t n) const
Returns the nth child of the node.
size_t get_num_children() const
Returns the number of children of the node.
A basic node of the scene graph or data graph.
virtual bool is_geom_node() const
A simple downcast check.
get_children
Returns an object that can be used to walk through the list of children of the node.
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
This is a special node that combines multiple independently-moving rigid nodes into one Geom internal...
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
void collect()
Walks through the entire subgraph of nodes rooted at this node, accumulates all of the RenderAttribs ...
get_internal_scene
Returns a special NodePath that represents the internal node of this object.
An interface for simplifying ("flattening") scene graphs by eliminating unneeded nodes and collapsing...
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...
void unify(PandaNode *root, bool preserve_order)
Calls unify() on every GeomNode at this level and below.
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,...
static SparseArray range(int low_bit, int size)
Returns a SparseArray whose size bits, beginning at low_bit, are on.
A thread; that is, a lightweight process.
get_current_thread
Returns a pointer to the currently-executing Thread object.
TypeHandle is the identifier used to differentiate C++ class types.
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated 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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.