Panda3D
Loading...
Searching...
No Matches
qtessSurface.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 qtessSurface.I
10 * @author drose
11 * @date 2003-10-13
12 */
13
14/**
15 *
16 */
17INLINE const std::string &QtessSurface::
18get_name() const {
19 return _egg_surface->get_name();
20}
21
22/**
23 * Returns true if the defined surface is valid, false otherwise.
24 */
25INLINE bool QtessSurface::
26is_valid() const {
27 return (_nurbs != nullptr);
28}
29
30/**
31 * Sets the importance of the surface, as a ratio in proportion to the square
32 * of its size.
33 */
34INLINE void QtessSurface::
35set_importance(double importance2) {
36 _importance = sqrt(importance2);
37 _importance2 = importance2;
38}
39
40/**
41 * Indicates the surface to which this surface must match in its U direction.
42 * If u_to_u is true, it matches to the other surface's U direction;
43 * otherwise, it matches to the other surface's V direction.
44 *
45 * Note that the surface pointer is an indirect pointer. The value passed in
46 * is the address of the pointer to the actual surface (which may or may not
47 * be filled in yet). The actual pointer may be filled in later.
48 */
49INLINE void QtessSurface::
50set_match_u(QtessSurface **match_u, bool match_u_to_u) {
51 _match_u = match_u;
52 _match_u_to_u = match_u_to_u;
53}
54
55/**
56 * Indicates the surface to which this surface must match in its V direction.
57 * If v_to_v is true, it matches to the other surface's V direction;
58 * otherwise, it matches to the other surface's U direction.
59 *
60 * Note that the surface pointer is an indirect pointer. The value passed in
61 * is the address of the pointer to the actual surface (which may or may not
62 * be filled in yet). The actual pointer may be filled in later.
63 */
64INLINE void QtessSurface::
65set_match_v(QtessSurface **match_v, bool match_v_to_v) {
66 _match_v = match_v;
67 _match_v_to_v = match_v_to_v;
68}
69
70/**
71 * Specifies the absolute minimum number of segments allowed in the U
72 * direction.
73 */
74INLINE void QtessSurface::
75set_min_u(int min_u) {
76 _min_u = min_u;
77}
78
79/**
80 * Specifies the absolute minimum number of segments allowed in the V
81 * direction.
82 */
83INLINE void QtessSurface::
84set_min_v(int min_v) {
85 _min_v = min_v;
86}
87
88
89/**
90 * Returns the number of patches the NURBS contains. Each patch is a square
91 * area bounded by isoparams. This actually scales by the importance of the
92 * surface, if it is not 1.
93 */
94INLINE double QtessSurface::
95count_patches() const {
96 return _num_u * _num_v * _importance2;
97}
98
99/**
100 * Returns the number of triangles that will be generated by the current
101 * tesselation parameters.
102 */
104count_tris() const {
105 return _tess_u * _tess_v * 2;
106}
107
108/**
109 * Returns the extra dimension number within the surface where the vertex
110 * membership in the indicated joint should be stored.
111 */
112INLINE int QtessSurface::
113get_joint_membership_index(EggGroup *joint) {
114 JointTable::iterator jti = _joint_table.find(joint);
115 if (jti != _joint_table.end()) {
116 return (*jti).second;
117 }
118 int d = _next_d;
119 _next_d++;
120 _joint_table[joint] = d;
121 return d;
122}
123
124/**
125 * Returns the extra dimension number within the surface where the indicated
126 * Dxyz morph offset should be stored.
127 */
128INLINE int QtessSurface::
129get_dxyz_index(const std::string &morph_name) {
130 MorphTable::iterator mti = _dxyz_table.find(morph_name);
131 if (mti != _dxyz_table.end()) {
132 return (*mti).second;
133 }
134 int d = _next_d;
135 _next_d += 3;
136 _dxyz_table[morph_name] = d;
137 return d;
138}
139
140/**
141 * Returns the extra dimension number within the surface where the indicated
142 * Drgba morph offset should be stored.
143 */
144INLINE int QtessSurface::
145get_drgba_index(const std::string &morph_name) {
146 MorphTable::iterator mti = _drgba_table.find(morph_name);
147 if (mti != _drgba_table.end()) {
148 return (*mti).second;
149 }
150 int d = _next_d;
151 _next_d += 4;
152 _drgba_table[morph_name] = d;
153 return d;
154}
The main glue of the egg hierarchy, this corresponds to the <Group>, <Instance>, and <Joint> type nod...
Definition eggGroup.h:34
A reference to an EggNurbsSurface in the egg file, and its parameters as set by the user input file a...
int count_tris() const
Returns the number of triangles that will be generated by the current tesselation parameters.
void set_min_u(int min_u)
Specifies the absolute minimum number of segments allowed in the U direction.
void set_match_u(QtessSurface **match_u, bool match_u_to_u)
Indicates the surface to which this surface must match in its U direction.
double count_patches() const
Returns the number of patches the NURBS contains.
void set_min_v(int min_v)
Specifies the absolute minimum number of segments allowed in the V direction.
void set_match_v(QtessSurface **match_v, bool match_v_to_v)
Indicates the surface to which this surface must match in its V direction.
void set_importance(double importance2)
Sets the importance of the surface, as a ratio in proportion to the square of its size.
bool is_valid() const
Returns true if the defined surface is valid, false otherwise.