Panda3D
modelNode.I
1 // Filename: modelNode.I
2 // Created by: drose (16Mar02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: ModelNode::Constructor
18 // Access: Public
19 // Description:
20 ////////////////////////////////////////////////////////////////////
21 INLINE ModelNode::
22 ModelNode(const string &name) :
23  PandaNode(name)
24 {
25  _preserve_transform = PT_none;
26  _preserve_attributes = 0;
27  _transform_limit = 0;
28 }
29 
30 ////////////////////////////////////////////////////////////////////
31 // Function: ModelNode::set_preserve_transform
32 // Access: Public
33 // Description: Sets the preserve_transform flag. This restricts the
34 // ability of a flatten operation to affect the
35 // transform stored on this node, and/or the node
36 // itself. In the order from weakest to strongest
37 // restrictions, the possible flags are:
38 //
39 // PT_drop_node - This node should be removed at the
40 // next flatten call.
41 //
42 // PT_none - The transform may be adjusted at will. The
43 // node itself will not be removed. This is the
44 // default.
45 //
46 // PT_net - Preserve the net transform from the root,
47 // but it's acceptable to modify the local transform
48 // stored on this particular node if necessary, so long
49 // as the net transform is not changed. This eliminates
50 // the need to drop an extra transform on the node
51 // above.
52 //
53 // PT_local - The local (and net) transform should not
54 // be changed in any way. If necessary, an extra
55 // transform will be left on the node above to guarantee
56 // this. This is a stronger restriction than PT_net.
57 //
58 // PT_no_touch - The local transform will not be
59 // changed, the node will not be removed, and
60 // furthermore any flatten operation will not continue
61 // below this node--this node and all descendents are
62 // protected from the effects of flatten.
63 ////////////////////////////////////////////////////////////////////
64 INLINE void ModelNode::
65 set_preserve_transform(ModelNode::PreserveTransform preserve_transform) {
66  _preserve_transform = preserve_transform;
67 }
68 
69 ////////////////////////////////////////////////////////////////////
70 // Function: ModelNode::get_preserve_transform
71 // Access: Public
72 // Description: Returns the current setting of the preserve_transform
73 // flag. See set_preserve_transform().
74 ////////////////////////////////////////////////////////////////////
75 INLINE ModelNode::PreserveTransform ModelNode::
77  return _preserve_transform;
78 }
79 
80 ////////////////////////////////////////////////////////////////////
81 // Function: ModelNode::set_preserve_attributes
82 // Access: Public
83 // Description: Sets the preserve_attributes flag. This restricts the
84 // ability of a flatten operation to affect the
85 // render attributes stored on this node.
86 //
87 // The value should be the union of bits from
88 // SceneGraphReducer::AttribTypes that represent the
89 // attributes that should *not* be changed.
90 ////////////////////////////////////////////////////////////////////
91 INLINE void ModelNode::
92 set_preserve_attributes(int preserve_attributes) {
93  _preserve_attributes = preserve_attributes;
94 }
95 
96 ////////////////////////////////////////////////////////////////////
97 // Function: ModelNode::get_preserve_attributes
98 // Access: Public
99 // Description: Returns the current setting of the preserve_attributes
100 // flag. See set_preserve_attributes().
101 ////////////////////////////////////////////////////////////////////
102 INLINE int ModelNode::
104  return _preserve_attributes;
105 }
106 
107 ////////////////////////////////////////////////////////////////////
108 // Function: ModelNode::Copy Constructor
109 // Access: Protected
110 // Description:
111 ////////////////////////////////////////////////////////////////////
112 INLINE ModelNode::
113 ModelNode(const ModelNode &copy) :
114  PandaNode(copy),
115  _preserve_transform(copy._preserve_transform),
116  _preserve_attributes(copy._preserve_attributes),
117  _transform_limit(copy._transform_limit)
118 {
119 }
A basic node of the scene graph or data graph.
Definition: pandaNode.h:72
PreserveTransform get_preserve_transform() const
Returns the current setting of the preserve_transform flag.
Definition: modelNode.I:76
This node is placed at key points within the scene graph to indicate the roots of "models": subtrees ...
Definition: modelNode.h:34
void set_preserve_attributes(int attrib_mask)
Sets the preserve_attributes flag.
Definition: modelNode.I:92
int get_preserve_attributes() const
Returns the current setting of the preserve_attributes flag.
Definition: modelNode.I:103
void set_preserve_transform(PreserveTransform preserve_transform)
Sets the preserve_transform flag.
Definition: modelNode.I:65