Panda3D
modelNode.I
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 modelNode.I
10  * @author drose
11  * @date 2002-03-16
12  */
13 
14 /**
15  *
16  */
17 INLINE ModelNode::
18 ModelNode(const std::string &name) :
19  PandaNode(name)
20 {
21  _preserve_transform = PT_none;
22  _preserve_attributes = 0;
23  _transform_limit = 0;
24 }
25 
26 /**
27  * Sets the preserve_transform flag. This restricts the ability of a flatten
28  * operation to affect the transform stored on this node, and/or the node
29  * itself. In the order from weakest to strongest restrictions, the possible
30  * flags are:
31  *
32  * PT_drop_node - This node should be removed at the next flatten call.
33  *
34  * PT_none - The transform may be adjusted at will. The node itself will not
35  * be removed. This is the default.
36  *
37  * PT_net - Preserve the net transform from the root, but it's acceptable to
38  * modify the local transform stored on this particular node if necessary, so
39  * long as the net transform is not changed. This eliminates the need to drop
40  * an extra transform on the node above.
41  *
42  * PT_local - The local (and net) transform should not be changed in any way.
43  * If necessary, an extra transform will be left on the node above to
44  * guarantee this. This is a stronger restriction than PT_net.
45  *
46  * PT_no_touch - The local transform will not be changed, the node will not be
47  * removed, and furthermore any flatten operation will not continue below this
48  * node--this node and all descendents are protected from the effects of
49  * flatten.
50  */
51 INLINE void ModelNode::
52 set_preserve_transform(ModelNode::PreserveTransform preserve_transform) {
53  _preserve_transform = preserve_transform;
54 }
55 
56 /**
57  * Returns the current setting of the preserve_transform flag. See
58  * set_preserve_transform().
59  */
60 INLINE ModelNode::PreserveTransform ModelNode::
62  return _preserve_transform;
63 }
64 
65 /**
66  * Sets the preserve_attributes flag. This restricts the ability of a flatten
67  * operation to affect the render attributes stored on this node.
68  *
69  * The value should be the union of bits from SceneGraphReducer::AttribTypes
70  * that represent the attributes that should *not* be changed.
71  */
72 INLINE void ModelNode::
73 set_preserve_attributes(int preserve_attributes) {
74  _preserve_attributes = preserve_attributes;
75 }
76 
77 /**
78  * Returns the current setting of the preserve_attributes flag. See
79  * set_preserve_attributes().
80  */
81 INLINE int ModelNode::
83  return _preserve_attributes;
84 }
85 
86 /**
87  *
88  */
89 INLINE ModelNode::
90 ModelNode(const ModelNode &copy) :
91  PandaNode(copy),
92  _preserve_transform(copy._preserve_transform),
93  _preserve_attributes(copy._preserve_attributes),
94  _transform_limit(copy._transform_limit)
95 {
96 }
A basic node of the scene graph or data graph.
Definition: pandaNode.h:64
PreserveTransform get_preserve_transform() const
Returns the current setting of the preserve_transform flag.
Definition: modelNode.I:61
This node is placed at key points within the scene graph to indicate the roots of "models": subtrees ...
Definition: modelNode.h:31
void set_preserve_attributes(int attrib_mask)
Sets the preserve_attributes flag.
Definition: modelNode.I:73
int get_preserve_attributes() const
Returns the current setting of the preserve_attributes flag.
Definition: modelNode.I:82
void set_preserve_transform(PreserveTransform preserve_transform)
Sets the preserve_transform flag.
Definition: modelNode.I:52