sheetNode.I 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. // Filename: sheetNode.I
  2. // Created by: drose (11Oct03)
  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: SheetNode::CData::Constructor
  20. // Access: Public
  21. // Description:
  22. ////////////////////////////////////////////////////////////////////
  23. INLINE SheetNode::CData::
  24. CData() {
  25. _surface = new NurbsSurfaceEvaluator;
  26. _use_vertex_color = false;
  27. _num_u_subdiv = 2;
  28. _num_v_subdiv = 2;
  29. }
  30. ////////////////////////////////////////////////////////////////////
  31. // Function: SheetNode::CData::Copy Constructor
  32. // Access: Public
  33. // Description:
  34. ////////////////////////////////////////////////////////////////////
  35. INLINE SheetNode::CData::
  36. CData(const SheetNode::CData &copy) :
  37. _surface(copy._surface),
  38. _use_vertex_color(copy._use_vertex_color),
  39. _num_u_subdiv(copy._num_u_subdiv),
  40. _num_v_subdiv(copy._num_v_subdiv)
  41. {
  42. }
  43. ////////////////////////////////////////////////////////////////////
  44. // Function: set_surface
  45. // Access: Public
  46. // Description: Sets the particular surface represented by the
  47. // SheetNode.
  48. ////////////////////////////////////////////////////////////////////
  49. INLINE void SheetNode::
  50. set_surface(NurbsSurfaceEvaluator *surface) {
  51. CDWriter cdata(_cycler);
  52. cdata->_surface = surface;
  53. }
  54. ////////////////////////////////////////////////////////////////////
  55. // Function: get_surface
  56. // Access: Public
  57. // Description: Returns the surface represented by the SheetNode.
  58. ////////////////////////////////////////////////////////////////////
  59. INLINE NurbsSurfaceEvaluator *SheetNode::
  60. get_surface() const {
  61. CDReader cdata(_cycler);
  62. return cdata->_surface;
  63. }
  64. ////////////////////////////////////////////////////////////////////
  65. // Function: set_use_vertex_color
  66. // Access: Public
  67. // Description: Sets the "use vertex color" flag. When this is true,
  68. // the R, G, B, A vertex color is assumed to be stored
  69. // as the dimensions 0, 1, 2, 3, respectively, of the
  70. // extended vertex values. Use
  71. // NurbsCurveEvaluator::set_extended_vertex() to set
  72. // these values.
  73. ////////////////////////////////////////////////////////////////////
  74. INLINE void SheetNode::
  75. set_use_vertex_color(bool flag) {
  76. CDWriter cdata(_cycler);
  77. cdata->_use_vertex_color = flag;
  78. }
  79. ////////////////////////////////////////////////////////////////////
  80. // Function: get_use_vertex_color
  81. // Access: Public
  82. // Description: Returns the "use vertex color" flag. See
  83. // set_use_vertex_color().
  84. ////////////////////////////////////////////////////////////////////
  85. INLINE bool SheetNode::
  86. get_use_vertex_color() const {
  87. CDReader cdata(_cycler);
  88. return cdata->_use_vertex_color;
  89. }
  90. ////////////////////////////////////////////////////////////////////
  91. // Function: set_num_u_subdiv
  92. // Access: Public
  93. // Description: Specifies the number of subdivisions per cubic
  94. // segment (that is, per unique knot value) to draw in a
  95. // fixed uniform tesselation of the surface in the U
  96. // direction.
  97. ////////////////////////////////////////////////////////////////////
  98. INLINE void SheetNode::
  99. set_num_u_subdiv(int num_u_subdiv) {
  100. nassertv(num_u_subdiv >= 0);
  101. CDWriter cdata(_cycler);
  102. cdata->_num_u_subdiv = num_u_subdiv;
  103. }
  104. ////////////////////////////////////////////////////////////////////
  105. // Function: get_num_u_subdiv
  106. // Access: Public
  107. // Description: Returns the number of subdivisions per cubic segment
  108. // to draw in the U direction. See set_num_u_subdiv().
  109. ////////////////////////////////////////////////////////////////////
  110. INLINE int SheetNode::
  111. get_num_u_subdiv() const {
  112. CDReader cdata(_cycler);
  113. return cdata->_num_u_subdiv;
  114. }
  115. ////////////////////////////////////////////////////////////////////
  116. // Function: set_num_v_subdiv
  117. // Access: Public
  118. // Description: Specifies the number of subdivisions per cubic
  119. // segment (that is, per unique knot value) to draw in a
  120. // fixed uniform tesselation of the surface in the V
  121. // direction.
  122. ////////////////////////////////////////////////////////////////////
  123. INLINE void SheetNode::
  124. set_num_v_subdiv(int num_v_subdiv) {
  125. nassertv(num_v_subdiv >= 0);
  126. CDWriter cdata(_cycler);
  127. cdata->_num_v_subdiv = num_v_subdiv;
  128. }
  129. ////////////////////////////////////////////////////////////////////
  130. // Function: get_num_v_subdiv
  131. // Access: Public
  132. // Description: Returns the number of subdivisions per cubic segment
  133. // to draw in the V direction. See set_num_v_subdiv().
  134. ////////////////////////////////////////////////////////////////////
  135. INLINE int SheetNode::
  136. get_num_v_subdiv() const {
  137. CDReader cdata(_cycler);
  138. return cdata->_num_v_subdiv;
  139. }