Panda3D
Loading...
Searching...
No Matches
deferredNodeProperty.cxx
Go to the documentation of this file.
1/**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file deferredNodeProperty.cxx
10 * @author drose
11 * @date 2002-03-20
12 */
13
15
16#include "collisionNode.h"
17#include "pandaNode.h"
18#include "dcast.h"
19
20/**
21 *
22 */
23DeferredNodeProperty::
24DeferredNodeProperty() {
25 _flags = 0;
26}
27
28/**
29 *
30 */
31DeferredNodeProperty::
32DeferredNodeProperty(const DeferredNodeProperty &copy) :
33 _flags(copy._flags),
34 _from_collide_mask(copy._from_collide_mask),
35 _into_collide_mask(copy._into_collide_mask)
36{
37}
38
39/**
40 *
41 */
42void DeferredNodeProperty::
43operator = (const DeferredNodeProperty &copy) {
44 _flags = copy._flags;
45 _from_collide_mask = copy._from_collide_mask;
46 _into_collide_mask = copy._into_collide_mask;
47}
48
49/**
50 * Composes this state with the next one encountered on a lower node during
51 * the apply traversal.
52 */
54compose(const DeferredNodeProperty &other) {
55 _flags |= other._flags;
56
57 if ((other._flags & F_has_from_collide_mask) != 0) {
58 _from_collide_mask = other._from_collide_mask;
59 }
60
61 if ((other._flags & F_has_into_collide_mask) != 0) {
62 _into_collide_mask = other._into_collide_mask;
63 }
64}
65
66/**
67 * Applies whatever state is appropriate to the node.
68 */
71 if (node->is_of_type(CollisionNode::get_class_type())) {
72 CollisionNode *cnode = DCAST(CollisionNode, node);
73 if ((_flags & F_has_from_collide_mask) != 0) {
74 cnode->set_from_collide_mask(_from_collide_mask);
75 }
76 if ((_flags & F_has_into_collide_mask) != 0) {
77 cnode->set_into_collide_mask(_into_collide_mask);
78 }
79 }
80}
A node in the scene graph that can hold any number of CollisionSolids.
set_into_collide_mask
Sets the "into" CollideMask.
set_from_collide_mask
Sets the "from" CollideMask.
This class keeps track of all the state we must make note of during the graph traversal,...
void compose(const DeferredNodeProperty &other)
Composes this state with the next one encountered on a lower node during the apply traversal.
void apply_to_node(PandaNode *node)
Applies whatever state is appropriate to the node.
A basic node of the scene graph or data graph.
Definition pandaNode.h:65
bool is_of_type(TypeHandle handle) const
Returns true if the current object is or derives from the indicated type.
Definition typedObject.I:28
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.