Panda3D
|
00001 // Filename: modelNode.I 00002 // Created by: drose (16Mar02) 00003 // 00004 //////////////////////////////////////////////////////////////////// 00005 // 00006 // PANDA 3D SOFTWARE 00007 // Copyright (c) Carnegie Mellon University. All rights reserved. 00008 // 00009 // All use of this software is subject to the terms of the revised BSD 00010 // license. You should have received a copy of this license along 00011 // with this source code in a file named "LICENSE." 00012 // 00013 //////////////////////////////////////////////////////////////////// 00014 00015 00016 //////////////////////////////////////////////////////////////////// 00017 // Function: ModelNode::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE ModelNode:: 00022 ModelNode(const string &name) : 00023 PandaNode(name) 00024 { 00025 _preserve_transform = PT_none; 00026 _preserve_attributes = 0; 00027 _transform_limit = 0; 00028 } 00029 00030 //////////////////////////////////////////////////////////////////// 00031 // Function: ModelNode::set_preserve_transform 00032 // Access: Public 00033 // Description: Sets the preserve_transform flag. This restricts the 00034 // ability of a flatten operation to affect the 00035 // transform stored on this node, and/or the node 00036 // itself. In the order from weakest to strongest 00037 // restrictions, the possible flags are: 00038 // 00039 // PT_drop_node - This node should be removed at the 00040 // next flatten call. 00041 // 00042 // PT_none - The transform may be adjusted at will. The 00043 // node itself will not be removed. This is the 00044 // default. 00045 // 00046 // PT_net - Preserve the net transform from the root, 00047 // but it's acceptable to modify the local transform 00048 // stored on this particular node if necessary, so long 00049 // as the net transform is not changed. This eliminates 00050 // the need to drop an extra transform on the node 00051 // above. 00052 // 00053 // PT_local - The local (and net) transform should not 00054 // be changed in any way. If necessary, an extra 00055 // transform will be left on the node above to guarantee 00056 // this. This is a stronger restriction than PT_net. 00057 // 00058 // PT_no_touch - The local transform will not be 00059 // changed, the node will not be removed, and 00060 // furthermore any flatten operation will not continue 00061 // below this node--this node and all descendents are 00062 // protected from the effects of flatten. 00063 //////////////////////////////////////////////////////////////////// 00064 INLINE void ModelNode:: 00065 set_preserve_transform(ModelNode::PreserveTransform preserve_transform) { 00066 _preserve_transform = preserve_transform; 00067 } 00068 00069 //////////////////////////////////////////////////////////////////// 00070 // Function: ModelNode::get_preserve_transform 00071 // Access: Public 00072 // Description: Returns the current setting of the preserve_transform 00073 // flag. See set_preserve_transform(). 00074 //////////////////////////////////////////////////////////////////// 00075 INLINE ModelNode::PreserveTransform ModelNode:: 00076 get_preserve_transform() const { 00077 return _preserve_transform; 00078 } 00079 00080 //////////////////////////////////////////////////////////////////// 00081 // Function: ModelNode::set_preserve_attributes 00082 // Access: Public 00083 // Description: Sets the preserve_attributes flag. This restricts the 00084 // ability of a flatten operation to affect the 00085 // render attributes stored on this node. 00086 // 00087 // The value should be the union of bits from 00088 // SceneGraphReducer::AttribTypes that represent the 00089 // attributes that should *not* be changed. 00090 //////////////////////////////////////////////////////////////////// 00091 INLINE void ModelNode:: 00092 set_preserve_attributes(int preserve_attributes) { 00093 _preserve_attributes = preserve_attributes; 00094 } 00095 00096 //////////////////////////////////////////////////////////////////// 00097 // Function: ModelNode::get_preserve_attributes 00098 // Access: Public 00099 // Description: Returns the current setting of the preserve_attributes 00100 // flag. See set_preserve_attributes(). 00101 //////////////////////////////////////////////////////////////////// 00102 INLINE int ModelNode:: 00103 get_preserve_attributes() const { 00104 return _preserve_attributes; 00105 } 00106 00107 //////////////////////////////////////////////////////////////////// 00108 // Function: ModelNode::Copy Constructor 00109 // Access: Protected 00110 // Description: 00111 //////////////////////////////////////////////////////////////////// 00112 INLINE ModelNode:: 00113 ModelNode(const ModelNode ©) : 00114 PandaNode(copy), 00115 _preserve_transform(copy._preserve_transform), 00116 _preserve_attributes(copy._preserve_attributes), 00117 _transform_limit(copy._transform_limit) 00118 { 00119 }