Panda3D

sheetNode.I
Go to the documentation of this file.
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 sheetNode.I
10 * @author drose
11 * @date 2003-10-11
12 */
13
14 /**
15 *
16 */
17 INLINE SheetNode::CData::
18 CData() {
19 _surface = new NurbsSurfaceEvaluator;
20 _use_vertex_color = false;
21 _num_u_subdiv = 2;
22 _num_v_subdiv = 2;
23 }
24
25 /**
26 *
27 */
28 INLINE SheetNode::CData::
29 CData(const SheetNode::CData &copy) :
30 _surface(copy._surface),
31 _use_vertex_color(copy._use_vertex_color),
32 _num_u_subdiv(copy._num_u_subdiv),
33 _num_v_subdiv(copy._num_v_subdiv)
34 {
35 }
36
37 /**
38 * Sets the particular surface represented by the SheetNode.
39 */
40 INLINE void SheetNode::
41 set_surface(NurbsSurfaceEvaluator *surface) {
42 CDWriter cdata(_cycler);
43 cdata->_surface = surface;
44 }
45
46 /**
47 * Returns the surface represented by the SheetNode.
48 */
49 INLINE NurbsSurfaceEvaluator *SheetNode::
50 get_surface() const {
51 CDReader cdata(_cycler);
52 return cdata->_surface;
53 }
54
55 /**
56 * Sets the "use vertex color" flag. When this is true, the R, G, B, A vertex
57 * color is assumed to be stored as the dimensions 0, 1, 2, 3, respectively,
58 * of the extended vertex values. Use
59 * NurbsCurveEvaluator::set_extended_vertex() to set these values.
60 */
61 INLINE void SheetNode::
62 set_use_vertex_color(bool flag) {
63 CDWriter cdata(_cycler);
64 cdata->_use_vertex_color = flag;
65 }
66
67 /**
68 * Returns the "use vertex color" flag. See set_use_vertex_color().
69 */
70 INLINE bool SheetNode::
71 get_use_vertex_color() const {
72 CDReader cdata(_cycler);
73 return cdata->_use_vertex_color;
74 }
75
76 /**
77 * Specifies the number of subdivisions per cubic segment (that is, per unique
78 * knot value) to draw in a fixed uniform tesselation of the surface in the U
79 * direction.
80 */
81 INLINE void SheetNode::
82 set_num_u_subdiv(int num_u_subdiv) {
83 nassertv(num_u_subdiv >= 0);
84 CDWriter cdata(_cycler);
85 cdata->_num_u_subdiv = num_u_subdiv;
86 }
87
88 /**
89 * Returns the number of subdivisions per cubic segment to draw in the U
90 * direction. See set_num_u_subdiv().
91 */
92 INLINE int SheetNode::
93 get_num_u_subdiv() const {
94 CDReader cdata(_cycler);
95 return cdata->_num_u_subdiv;
96 }
97
98 /**
99 * Specifies the number of subdivisions per cubic segment (that is, per unique
100 * knot value) to draw in a fixed uniform tesselation of the surface in the V
101 * direction.
102 */
103 INLINE void SheetNode::
104 set_num_v_subdiv(int num_v_subdiv) {
105 nassertv(num_v_subdiv >= 0);
106 CDWriter cdata(_cycler);
107 cdata->_num_v_subdiv = num_v_subdiv;
108 }
109
110 /**
111 * Returns the number of subdivisions per cubic segment to draw in the V
112 * direction. See set_num_v_subdiv().
113 */
114 INLINE int SheetNode::
115 get_num_v_subdiv() const {
116 CDReader cdata(_cycler);
117 return cdata->_num_v_subdiv;
118 }
CycleDataReader
This template class calls PipelineCycler::read_unlocked(), and then provides a transparent read-only ...
Definition: cycleDataReader.h:35
CycleDataWriter
This template class calls PipelineCycler::write() in the constructor and PipelineCycler::release_writ...
Definition: cycleDataWriter.h:34
NurbsSurfaceEvaluator
This class is an abstraction for evaluating NURBS surfaces.
Definition: nurbsSurfaceEvaluator.h:34
SheetNode::set_num_u_subdiv
void set_num_u_subdiv(int num_u_subdiv)
Specifies the number of subdivisions per cubic segment (that is, per unique knot value) to draw in a ...
Definition: sheetNode.I:82
SheetNode::get_surface
NurbsSurfaceEvaluator * get_surface() const
Returns the surface represented by the SheetNode.
Definition: sheetNode.I:50
SheetNode::get_use_vertex_color
bool get_use_vertex_color() const
Returns the "use vertex color" flag.
Definition: sheetNode.I:71
SheetNode::set_surface
void set_surface(NurbsSurfaceEvaluator *surface)
Sets the particular surface represented by the SheetNode.
Definition: sheetNode.I:41
SheetNode::set_num_v_subdiv
void set_num_v_subdiv(int num_v_subdiv)
Specifies the number of subdivisions per cubic segment (that is, per unique knot value) to draw in a ...
Definition: sheetNode.I:104
SheetNode::get_num_u_subdiv
int get_num_u_subdiv() const
Returns the number of subdivisions per cubic segment to draw in the U direction.
Definition: sheetNode.I:93
SheetNode::get_num_v_subdiv
int get_num_v_subdiv() const
Returns the number of subdivisions per cubic segment to draw in the V direction.
Definition: sheetNode.I:115
SheetNode::set_use_vertex_color
void set_use_vertex_color(bool flag)
Sets the "use vertex color" flag.
Definition: sheetNode.I:62