Go to the documentation of this file.
40 CollisionNode(
const std::string &name) :
42 _from_collide_mask(get_default_collide_mask()),
48 set_overall_hidden(
true);
51 set_into_collide_mask(get_default_collide_mask());
60 _from_collide_mask(copy._from_collide_mask),
61 _collider_sort(copy._collider_sort),
97 xform(
const LMatrix4 &mat) {
98 nassertv(!mat.is_nan());
100 if (mat.almost_equal(LMatrix4::ident_mat())) {
105 for (si = _solids.begin(); si != _solids.end(); ++si) {
109 mark_internal_bounds_stale();
124 if (flatten_collision_nodes) {
131 if (get_name() == cother->get_name() &&
135 const COWPT(
CollisionSolid) *solids_end = solids_begin + cother->_solids.size();
136 _solids.insert(_solids.end(), solids_begin, solids_end);
137 mark_internal_bounds_stale();
184 Solids::const_iterator si;
185 for (si = _solids.begin(); si != _solids.end(); ++si) {
187 PT(
PandaNode) node = solid->get_viz(trav, data,
false);
188 if (node !=
nullptr) {
192 next_data._state = RenderState::make_empty();
197 if (respect_prev_transform) {
200 NodePath node_path = data.get_node_path();
201 CPT(
TransformState) transform = node_path.get_net_transform()->invert_compose(node_path.get_net_prev_transform());
207 for (si = _solids.begin(); si != _solids.end(); ++si) {
209 PT(
PandaNode) node = solid->get_viz(trav, data,
false);
210 if (node !=
nullptr) {
213 next_data._net_transform =
214 next_data._net_transform->compose(transform);
215 next_data._state = get_last_pos_state();
256 output(std::ostream &out)
const {
257 PandaNode::output(out);
258 out <<
" (" << _solids.size() <<
" solids)";
268 _from_collide_mask = mask;
278 int &internal_vertices,
280 Thread *current_thread)
const {
285 Solids::const_iterator gi;
286 for (gi = _solids.begin(); gi != _solids.end(); ++gi) {
290 if (!volume->is_empty()) {
291 child_volumes_ref.push_back(volume);
292 child_volumes.push_back(volume);
293 if (!volume->is_exact_type(BoundingBox::get_class_type())) {
302 if (btype == BoundingVolume::BT_default) {
306 if (btype == BoundingVolume::BT_box ||
307 (btype != BoundingVolume::BT_sphere && all_box)) {
316 if (child_volumes.size() > 0) {
318 const BoundingVolume **child_end = child_begin + child_volumes.size();
322 internal_bounds = gbv;
323 internal_vertices = 0;
332 get_last_pos_state() {
336 if (state ==
nullptr) {
337 state = RenderState::make
338 (ColorScaleAttrib::make(LVecBase4(1.0f, 1.0f, 1.0f, 0.5f)),
339 TransparencyAttrib::make(TransparencyAttrib::M_alpha));
362 int num_solids = _solids.size();
363 if (num_solids >= 0xffff) {
369 for(
int i = 0; i < num_solids; i++) {
384 int num_solids = _solids.size();
385 for (
int i = 0; i < num_solids; i++) {
404 node->fillin(scan, manager);
415 PandaNode::fillin(scan, manager);
418 if (num_solids == 0xffff) {
422 _solids.reserve(num_solids);
423 for(
int i = 0; i < num_solids; i++) {
426 _solids.push_back(
nullptr);
static void register_with_read_factory()
Tells the BamReader how to create objects of type CollisionNode.
virtual void xform(const LMatrix4 &mat)
Transforms the contents of this node by the indicated matrix, if it means anything to do so.
virtual bool cull_callback(CullTraverser *trav, CullTraverserData &data)
This function will be called during the cull traversal to perform any additional operations that shou...
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
uint16_t get_uint16()
Extracts an unsigned 16-bit integer.
This is our own Panda specialization on the default STL vector.
virtual int complete_pointers(TypedWritable **plist, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
This defines a bounding sphere, consisting of a center and a radius.
virtual PandaNode * combine_with(PandaNode *other)
Collapses this node with the other node, if possible, and returns a pointer to the combined node,...
virtual bool preserve_name() const
Returns true if the node's name has extrinsic meaning and must be preserved across a flatten operatio...
CPT(RenderState) CollisionNode
Returns a RenderState for rendering the ghosted collision solid that represents the previous frame's ...
A class to retrieve the individual data elements previously stored in a Datagram.
virtual int complete_pointers(TypedWritable **p_list, BamReader *manager)
Receives an array of pointers, one for each time manager->read_pointer() was called in fillin().
This is the fundamental interface for extracting binary objects from a Bam file, as generated by a Ba...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is the fundamental interface for writing binary objects to a Bam file, to be extracted later by ...
This object performs a depth-first traversal of the scene graph, with optional view-frustum culling,...
void write_pointer(Datagram &packet, const TypedWritable *dest)
The interface for writing a pointer to another object to a Bam file.
virtual bool is_renderable() const
Returns true if there is some value to visiting this particular node during the cull traversal for an...
get_bounds_type
Returns the bounding volume type set with set_bounds_type().
static WritableFactory * get_factory()
Returns the global WritableFactory for generating TypedWritable objects.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Base class for objects that can be written to and read from Bam files.
An ordered list of data elements, formatted in memory for transmission over a socket or writing to a ...
This represents a unique collection of RenderAttrib objects that correspond to a particular renderabl...
An axis-aligned bounding box; that is, a minimum and maximum coordinate triple.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
void add_uint16(uint16_t value)
Adds an unsigned 16-bit integer to the datagram.
virtual bool is_collision_node() const
A simple downcast check.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
virtual void write_datagram(BamWriter *manager, Datagram &dg)
Writes the contents of this object to the datagram for shipping out to a Bam file.
An instance of this class is passed to the Factory when requesting it to do its business and construc...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is another abstract class, for a general class of bounding volumes that actually enclose points ...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This collects together the pieces of data that are accumulated for each node while walking the scene ...
void set_word(WordType value)
Sets the entire BitMask to the value indicated by the given word.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
set_from_collide_mask
Sets the "from" CollideMask.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_factory(TypeHandle handle, CreateFunc *func, void *user_data=nullptr)
Registers a new kind of thing the Factory will be able to create.
The abstract base class for all things that can collide with other things in the world,...
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
virtual PandaNode * make_copy() const
Returns a newly-allocated Node that is a shallow copy of this one.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void add_uint32(uint32_t value)
Adds an unsigned 32-bit integer to the datagram.
bool read_pointer(DatagramIterator &scan)
The interface for reading a pointer to another object from a Bam file.
get_from_collide_mask
Returns the current "from" CollideMask.
WordType get_word() const
Returns the entire BitMask as a single word.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
uint32_t get_uint32()
Extracts an unsigned 32-bit integer.
void traverse(const NodePath &root)
Begins the traversal from the indicated node.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
This is an abstract class for any volume in any sense which can be said to define the locality of ref...
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
A basic node of the scene graph or data graph.
virtual void output(std::ostream &out) const
Writes a brief description of the node to the indicated output stream.
virtual CollideMask get_legal_collide_mask() const
Returns the subset of CollideMask bits that may be set for this particular type of PandaNode.
static BitMask< WType, nbits > all_on()
Returns a BitMask whose bits are all on.
bool is_exact_type(TypeHandle handle) const
Returns true if the current object is the indicated type exactly.
A thread; that is, a lightweight process.
void parse_params(const FactoryParams ¶ms, DatagramIterator &scan, BamReader *&manager)
Takes in a FactoryParams, passed from a WritableFactory into any TypedWritable's make function,...
get_into_collide_mask
Returns the current "into" CollideMask.
A node in the scene graph that can hold any number of CollisionSolids.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.