00001 // Filename: sheetNode.I 00002 // Created by: drose (11Oct03) 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: SheetNode::CData::Constructor 00018 // Access: Public 00019 // Description: 00020 //////////////////////////////////////////////////////////////////// 00021 INLINE SheetNode::CData:: 00022 CData() { 00023 _surface = new NurbsSurfaceEvaluator; 00024 _use_vertex_color = false; 00025 _num_u_subdiv = 2; 00026 _num_v_subdiv = 2; 00027 } 00028 00029 //////////////////////////////////////////////////////////////////// 00030 // Function: SheetNode::CData::Copy Constructor 00031 // Access: Public 00032 // Description: 00033 //////////////////////////////////////////////////////////////////// 00034 INLINE SheetNode::CData:: 00035 CData(const SheetNode::CData ©) : 00036 _surface(copy._surface), 00037 _use_vertex_color(copy._use_vertex_color), 00038 _num_u_subdiv(copy._num_u_subdiv), 00039 _num_v_subdiv(copy._num_v_subdiv) 00040 { 00041 } 00042 00043 //////////////////////////////////////////////////////////////////// 00044 // Function: set_surface 00045 // Access: Public 00046 // Description: Sets the particular surface represented by the 00047 // SheetNode. 00048 //////////////////////////////////////////////////////////////////// 00049 INLINE void SheetNode:: 00050 set_surface(NurbsSurfaceEvaluator *surface) { 00051 CDWriter cdata(_cycler); 00052 cdata->_surface = surface; 00053 } 00054 00055 //////////////////////////////////////////////////////////////////// 00056 // Function: get_surface 00057 // Access: Public 00058 // Description: Returns the surface represented by the SheetNode. 00059 //////////////////////////////////////////////////////////////////// 00060 INLINE NurbsSurfaceEvaluator *SheetNode:: 00061 get_surface() const { 00062 CDReader cdata(_cycler); 00063 return cdata->_surface; 00064 } 00065 00066 //////////////////////////////////////////////////////////////////// 00067 // Function: set_use_vertex_color 00068 // Access: Public 00069 // Description: Sets the "use vertex color" flag. When this is true, 00070 // the R, G, B, A vertex color is assumed to be stored 00071 // as the dimensions 0, 1, 2, 3, respectively, of the 00072 // extended vertex values. Use 00073 // NurbsCurveEvaluator::set_extended_vertex() to set 00074 // these values. 00075 //////////////////////////////////////////////////////////////////// 00076 INLINE void SheetNode:: 00077 set_use_vertex_color(bool flag) { 00078 CDWriter cdata(_cycler); 00079 cdata->_use_vertex_color = flag; 00080 } 00081 00082 //////////////////////////////////////////////////////////////////// 00083 // Function: get_use_vertex_color 00084 // Access: Public 00085 // Description: Returns the "use vertex color" flag. See 00086 // set_use_vertex_color(). 00087 //////////////////////////////////////////////////////////////////// 00088 INLINE bool SheetNode:: 00089 get_use_vertex_color() const { 00090 CDReader cdata(_cycler); 00091 return cdata->_use_vertex_color; 00092 } 00093 00094 //////////////////////////////////////////////////////////////////// 00095 // Function: set_num_u_subdiv 00096 // Access: Public 00097 // Description: Specifies the number of subdivisions per cubic 00098 // segment (that is, per unique knot value) to draw in a 00099 // fixed uniform tesselation of the surface in the U 00100 // direction. 00101 //////////////////////////////////////////////////////////////////// 00102 INLINE void SheetNode:: 00103 set_num_u_subdiv(int num_u_subdiv) { 00104 nassertv(num_u_subdiv >= 0); 00105 CDWriter cdata(_cycler); 00106 cdata->_num_u_subdiv = num_u_subdiv; 00107 } 00108 00109 //////////////////////////////////////////////////////////////////// 00110 // Function: get_num_u_subdiv 00111 // Access: Public 00112 // Description: Returns the number of subdivisions per cubic segment 00113 // to draw in the U direction. See set_num_u_subdiv(). 00114 //////////////////////////////////////////////////////////////////// 00115 INLINE int SheetNode:: 00116 get_num_u_subdiv() const { 00117 CDReader cdata(_cycler); 00118 return cdata->_num_u_subdiv; 00119 } 00120 00121 //////////////////////////////////////////////////////////////////// 00122 // Function: set_num_v_subdiv 00123 // Access: Public 00124 // Description: Specifies the number of subdivisions per cubic 00125 // segment (that is, per unique knot value) to draw in a 00126 // fixed uniform tesselation of the surface in the V 00127 // direction. 00128 //////////////////////////////////////////////////////////////////// 00129 INLINE void SheetNode:: 00130 set_num_v_subdiv(int num_v_subdiv) { 00131 nassertv(num_v_subdiv >= 0); 00132 CDWriter cdata(_cycler); 00133 cdata->_num_v_subdiv = num_v_subdiv; 00134 } 00135 00136 //////////////////////////////////////////////////////////////////// 00137 // Function: get_num_v_subdiv 00138 // Access: Public 00139 // Description: Returns the number of subdivisions per cubic segment 00140 // to draw in the V direction. See set_num_v_subdiv(). 00141 //////////////////////////////////////////////////////////////////// 00142 INLINE int SheetNode:: 00143 get_num_v_subdiv() const { 00144 CDReader cdata(_cycler); 00145 return cdata->_num_v_subdiv; 00146 }