modelNode.I 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. // Filename: modelNode.I
  2. // Created by: drose (16Mar02)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. ////////////////////////////////////////////////////////////////////
  19. // Function: ModelNode::Constructor
  20. // Access: Public
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE ModelNode::
  24. ModelNode(const string &name) :
  25. PandaNode(name)
  26. {
  27. _preserve_transform = PT_none;
  28. _preserve_attributes = 0;
  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. If the flag is:
  36. //
  37. // PT_none - the transform may be adjusted at will.
  38. //
  39. // PT_local - the local (and net) transform should not
  40. // be changed in any way. If necessary, an extra
  41. // transform will be left on the node above to guarantee
  42. // this. This is the strongest restriction.
  43. //
  44. // PT_net - preserve the net transform from the
  45. // root, but it's acceptable to modify the local
  46. // transform stored on this particular node if
  47. // necessary, so long as the net transform is not
  48. // changed. This eliminates the need to drop an extra
  49. // transform on the node above.
  50. ////////////////////////////////////////////////////////////////////
  51. INLINE void ModelNode::
  52. set_preserve_transform(ModelNode::PreserveTransform preserve_transform) {
  53. _preserve_transform = preserve_transform;
  54. }
  55. ////////////////////////////////////////////////////////////////////
  56. // Function: ModelNode::get_preserve_transform
  57. // Access: Public
  58. // Description: Returns the current setting of the preserve_transform
  59. // flag. See set_preserve_transform().
  60. ////////////////////////////////////////////////////////////////////
  61. INLINE ModelNode::PreserveTransform ModelNode::
  62. get_preserve_transform() const {
  63. return _preserve_transform;
  64. }
  65. ////////////////////////////////////////////////////////////////////
  66. // Function: ModelNode::set_preserve_attributes
  67. // Access: Public
  68. // Description: Sets the preserve_attributes flag. This restricts the
  69. // ability of a flatten operation to affect the
  70. // render attributes stored on this node.
  71. //
  72. // The value should be the union of bits from
  73. // SceneGraphReducer::AttribTypes that represent the
  74. // attributes that should *not* be changed.
  75. ////////////////////////////////////////////////////////////////////
  76. INLINE void ModelNode::
  77. set_preserve_attributes(int preserve_attributes) {
  78. _preserve_attributes = preserve_attributes;
  79. }
  80. ////////////////////////////////////////////////////////////////////
  81. // Function: ModelNode::get_preserve_attributes
  82. // Access: Public
  83. // Description: Returns the current setting of the preserve_attributes
  84. // flag. See set_preserve_attributes().
  85. ////////////////////////////////////////////////////////////////////
  86. INLINE int ModelNode::
  87. get_preserve_attributes() const {
  88. return _preserve_attributes;
  89. }
  90. ////////////////////////////////////////////////////////////////////
  91. // Function: ModelNode::Copy Constructor
  92. // Access: Protected
  93. // Description:
  94. ////////////////////////////////////////////////////////////////////
  95. INLINE ModelNode::
  96. ModelNode(const ModelNode &copy) :
  97. PandaNode(copy),
  98. _preserve_transform(copy._preserve_transform),
  99. _preserve_attributes(copy._preserve_attributes)
  100. {
  101. }