modelNode.I 2.9 KB

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