Panda3D
 All Classes Functions Variables Enumerations
cLerpNodePathInterval.I
1 // Filename: cLerpNodePathInterval.I
2 // Created by: drose (27Aug02)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 
16 ////////////////////////////////////////////////////////////////////
17 // Function: CLerpNodePathInterval::get_node
18 // Access: Published
19 // Description: Returns the node being lerped.
20 ////////////////////////////////////////////////////////////////////
22 get_node() const {
23  return _node;
24 }
25 
26 ////////////////////////////////////////////////////////////////////
27 // Function: CLerpNodePathInterval::get_other
28 // Access: Published
29 // Description: Returns the "other" node, which the lerped node is
30 // being moved relative to. If this is an empty node
31 // path, the lerped node is being moved in its own
32 // coordinate system.
33 ////////////////////////////////////////////////////////////////////
35 get_other() const {
36  return _other;
37 }
38 
39 ////////////////////////////////////////////////////////////////////
40 // Function: CLerpNodePathInterval::set_start_pos
41 // Access: Published
42 // Description: Indicates the initial position of the lerped node.
43 // This is meaningful only if set_end_pos() is also
44 // called. This parameter is optional; if unspecified,
45 // the value will be taken from the node's actual
46 // position at the time the lerp is performed.
47 ////////////////////////////////////////////////////////////////////
48 INLINE void CLerpNodePathInterval::
49 set_start_pos(const LVecBase3 &pos) {
50  nassertv(!pos.is_nan());
51  _start_pos = pos;
52  _flags |= F_start_pos;
53 }
54 
55 ////////////////////////////////////////////////////////////////////
56 // Function: CLerpNodePathInterval::set_end_pos
57 // Access: Published
58 // Description: Indicates that the position of the node should be
59 // lerped, and specifies the final position of the node.
60 // This should be called before priv_initialize(). If this
61 // is not called, the node's position will not be
62 // affected by the lerp.
63 ////////////////////////////////////////////////////////////////////
64 INLINE void CLerpNodePathInterval::
65 set_end_pos(const LVecBase3 &pos) {
66  nassertv(!pos.is_nan());
67  _end_pos = pos;
68  _flags |= F_end_pos;
69 }
70 
71 ////////////////////////////////////////////////////////////////////
72 // Function: CLerpNodePathInterval::set_start_hpr
73 // Access: Published
74 // Description: Indicates the initial rotation of the lerped node.
75 // This is meaningful only if either set_end_hpr() or
76 // set_end_quat() is also called. This parameter is
77 // optional; if unspecified, the value will be taken
78 // from the node's actual rotation at the time the lerp
79 // is performed.
80 ////////////////////////////////////////////////////////////////////
81 INLINE void CLerpNodePathInterval::
82 set_start_hpr(const LVecBase3 &hpr) {
83  nassertv(!hpr.is_nan());
84  _start_hpr = hpr;
85  _flags = (_flags & ~(F_slerp_setup | F_start_quat)) | F_start_hpr;
86 }
87 
88 ////////////////////////////////////////////////////////////////////
89 // Function: CLerpNodePathInterval::set_end_hpr
90 // Access: Published
91 // Description: Indicates that the rotation of the node should be
92 // lerped, and specifies the final rotation of the node.
93 // This should be called before priv_initialize().
94 //
95 // This replaces a previous call to set_end_quat(). If
96 // neither set_end_hpr() nor set_end_quat() is called,
97 // the node's rotation will not be affected by the lerp.
98 ////////////////////////////////////////////////////////////////////
99 INLINE void CLerpNodePathInterval::
100 set_end_hpr(const LVecBase3 &hpr) {
101  nassertv(!hpr.is_nan());
102  _end_hpr = hpr;
103  _flags = (_flags & ~F_end_quat) | F_end_hpr;
104 }
105 
106 ////////////////////////////////////////////////////////////////////
107 // Function: CLerpNodePathInterval::set_end_hpr
108 // Access: Published
109 // Description: Indicates that the rotation of the node should be
110 // lerped, and specifies the final rotation of the node.
111 // This should be called before priv_initialize().
112 //
113 // This special function is overloaded to accept a
114 // quaternion, even though the function name is
115 // set_end_hpr(). The quaternion will be implicitly
116 // converted to a HPR trio, and the lerp will be
117 // performed in HPR space, componentwise.
118 ////////////////////////////////////////////////////////////////////
119 INLINE void CLerpNodePathInterval::
120 set_end_hpr(const LQuaternion &quat) {
121  nassertv(!quat.is_nan());
122  _end_hpr = quat.get_hpr();
123  _flags = (_flags & ~F_end_quat) | F_end_hpr;
124 }
125 
126 ////////////////////////////////////////////////////////////////////
127 // Function: CLerpNodePathInterval::set_start_quat
128 // Access: Published
129 // Description: Indicates the initial rotation of the lerped node.
130 // This is meaningful only if either set_end_quat() or
131 // set_end_hpr() is also called. This parameter is
132 // optional; if unspecified, the value will be taken
133 // from the node's actual rotation at the time the lerp
134 // is performed.
135 ////////////////////////////////////////////////////////////////////
136 INLINE void CLerpNodePathInterval::
138  nassertv(!quat.is_nan());
139  _start_quat = quat;
140  _flags = (_flags & ~(F_slerp_setup | F_start_hpr)) | F_start_quat;
141 }
142 
143 ////////////////////////////////////////////////////////////////////
144 // Function: CLerpNodePathInterval::set_end_quat
145 // Access: Published
146 // Description: Indicates that the rotation of the node should be
147 // lerped, and specifies the final rotation of the node.
148 // This should be called before priv_initialize().
149 //
150 // This replaces a previous call to set_end_hpr(). If
151 // neither set_end_quat() nor set_end_hpr() is called,
152 // the node's rotation will not be affected by the lerp.
153 //
154 // This special function is overloaded to accept a HPR
155 // trio, even though the function name is
156 // set_end_quat(). The HPR will be implicitly converted
157 // to a quaternion, and the lerp will be performed in
158 // quaternion space, as a spherical lerp.
159 ////////////////////////////////////////////////////////////////////
160 INLINE void CLerpNodePathInterval::
161 set_end_quat(const LVecBase3 &hpr) {
162  nassertv(!hpr.is_nan());
163  _end_quat.set_hpr(hpr);
164  _flags = (_flags & ~(F_slerp_setup | F_end_hpr)) | F_end_quat;
165 }
166 
167 ////////////////////////////////////////////////////////////////////
168 // Function: CLerpNodePathInterval::set_end_quat
169 // Access: Published
170 // Description: Indicates that the rotation of the node should be
171 // lerped, and specifies the final rotation of the node.
172 // This should be called before priv_initialize().
173 //
174 // This replaces a previous call to set_end_hpr(). If
175 // neither set_end_quat() nor set_end_hpr() is called,
176 // the node's rotation will not be affected by the lerp.
177 ////////////////////////////////////////////////////////////////////
178 INLINE void CLerpNodePathInterval::
179 set_end_quat(const LQuaternion &quat) {
180  nassertv(!quat.is_nan());
181  _end_quat = quat;
182  _flags = (_flags & ~(F_slerp_setup | F_end_hpr)) | F_end_quat;
183 }
184 
185 ////////////////////////////////////////////////////////////////////
186 // Function: CLerpNodePathInterval::set_start_scale
187 // Access: Published
188 // Description: Indicates the initial scale of the lerped node.
189 // This is meaningful only if set_end_scale() is also
190 // called. This parameter is optional; if unspecified,
191 // the value will be taken from the node's actual
192 // scale at the time the lerp is performed.
193 ////////////////////////////////////////////////////////////////////
194 INLINE void CLerpNodePathInterval::
195 set_start_scale(const LVecBase3 &scale) {
196  nassertv(!scale.is_nan());
197  _start_scale = scale;
198  _flags |= F_start_scale;
199 }
200 
201 ////////////////////////////////////////////////////////////////////
202 // Function: CLerpNodePathInterval::set_start_scale
203 // Access: Published
204 // Description: Indicates the initial scale of the lerped node.
205 // This is meaningful only if set_end_scale() is also
206 // called. This parameter is optional; if unspecified,
207 // the value will be taken from the node's actual
208 // scale at the time the lerp is performed.
209 ////////////////////////////////////////////////////////////////////
210 INLINE void CLerpNodePathInterval::
211 set_start_scale(PN_stdfloat scale) {
212  nassertv(!cnan(scale));
213  set_start_scale(LVecBase3(scale, scale, scale));
214 }
215 
216 ////////////////////////////////////////////////////////////////////
217 // Function: CLerpNodePathInterval::set_end_scale
218 // Access: Published
219 // Description: Indicates that the scale of the node should be
220 // lerped, and specifies the final scale of the node.
221 // This should be called before priv_initialize(). If this
222 // is not called, the node's scale will not be
223 // affected by the lerp.
224 ////////////////////////////////////////////////////////////////////
225 INLINE void CLerpNodePathInterval::
226 set_end_scale(const LVecBase3 &scale) {
227  nassertv(!scale.is_nan());
228  _end_scale = scale;
229  _flags |= F_end_scale;
230 }
231 
232 ////////////////////////////////////////////////////////////////////
233 // Function: CLerpNodePathInterval::set_end_scale
234 // Access: Published
235 // Description: Indicates that the scale of the node should be
236 // lerped, and specifies the final scale of the node.
237 // This should be called before priv_initialize(). If this
238 // is not called, the node's scale will not be
239 // affected by the lerp.
240 ////////////////////////////////////////////////////////////////////
241 INLINE void CLerpNodePathInterval::
242 set_end_scale(PN_stdfloat scale) {
243  nassertv(!cnan(scale));
244  set_end_scale(LVecBase3(scale, scale, scale));
245 }
246 
247 ////////////////////////////////////////////////////////////////////
248 // Function: CLerpNodePathInterval::set_start_shear
249 // Access: Published
250 // Description: Indicates the initial shear of the lerped node.
251 // This is meaningful only if set_end_shear() is also
252 // called. This parameter is optional; if unspecified,
253 // the value will be taken from the node's actual
254 // shear at the time the lerp is performed.
255 ////////////////////////////////////////////////////////////////////
256 INLINE void CLerpNodePathInterval::
257 set_start_shear(const LVecBase3 &shear) {
258  nassertv(!shear.is_nan());
259  _start_shear = shear;
260  _flags |= F_start_shear;
261 }
262 
263 ////////////////////////////////////////////////////////////////////
264 // Function: CLerpNodePathInterval::set_end_shear
265 // Access: Published
266 // Description: Indicates that the shear of the node should be
267 // lerped, and specifies the final shear of the node.
268 // This should be called before priv_initialize(). If this
269 // is not called, the node's shear will not be
270 // affected by the lerp.
271 ////////////////////////////////////////////////////////////////////
272 INLINE void CLerpNodePathInterval::
273 set_end_shear(const LVecBase3 &shear) {
274  nassertv(!shear.is_nan());
275  _end_shear = shear;
276  _flags |= F_end_shear;
277 }
278 
279 ////////////////////////////////////////////////////////////////////
280 // Function: CLerpNodePathInterval::set_start_color
281 // Access: Published
282 // Description: Indicates the initial color of the lerped node.
283 // This is meaningful only if set_end_color() is also
284 // called. This parameter is optional; if unspecified,
285 // the value will be taken from the node's actual
286 // color at the time the lerp is performed.
287 ////////////////////////////////////////////////////////////////////
288 INLINE void CLerpNodePathInterval::
290  nassertv(!color.is_nan());
291  _start_color = color;
292  _flags |= F_start_color;
293 }
294 
295 ////////////////////////////////////////////////////////////////////
296 // Function: CLerpNodePathInterval::set_end_color
297 // Access: Published
298 // Description: Indicates that the color of the node should be
299 // lerped, and specifies the final color of the node.
300 // This should be called before priv_initialize(). If this
301 // is not called, the node's color will not be
302 // affected by the lerp.
303 ////////////////////////////////////////////////////////////////////
304 INLINE void CLerpNodePathInterval::
306  nassertv(!color.is_nan());
307  _end_color = color;
308  _flags |= F_end_color;
309 }
310 
311 ////////////////////////////////////////////////////////////////////
312 // Function: CLerpNodePathInterval::set_start_color_scale
313 // Access: Published
314 // Description: Indicates the initial color scale of the lerped node.
315 // This is meaningful only if set_end_color_scale() is also
316 // called. This parameter is optional; if unspecified,
317 // the value will be taken from the node's actual
318 // color scale at the time the lerp is performed.
319 ////////////////////////////////////////////////////////////////////
320 INLINE void CLerpNodePathInterval::
321 set_start_color_scale(const LVecBase4 &color_scale) {
322  nassertv(!color_scale.is_nan());
323  _start_color_scale = color_scale;
324  _flags |= F_start_color_scale;
325 }
326 
327 ////////////////////////////////////////////////////////////////////
328 // Function: CLerpNodePathInterval::set_end_color_scale
329 // Access: Published
330 // Description: Indicates that the color scale of the node should be
331 // lerped, and specifies the final color scale of the node.
332 // This should be called before priv_initialize(). If this
333 // is not called, the node's color scale will not be
334 // affected by the lerp.
335 ////////////////////////////////////////////////////////////////////
336 INLINE void CLerpNodePathInterval::
337 set_end_color_scale(const LVecBase4 &color_scale) {
338  nassertv(!color_scale.is_nan());
339  _end_color_scale = color_scale;
340  _flags |= F_end_color_scale;
341 }
342 
343 ////////////////////////////////////////////////////////////////////
344 // Function: CLerpNodePathInterval::set_texture_stage
345 // Access: Published
346 // Description: Indicates the texture stage that is adjusted by
347 // tex_offset, tex_rotate, and/or tex_scale. If this is
348 // not set, the default is the default texture stage.
349 ////////////////////////////////////////////////////////////////////
350 INLINE void CLerpNodePathInterval::
352  _texture_stage = stage;
353 }
354 
355 ////////////////////////////////////////////////////////////////////
356 // Function: CLerpNodePathInterval::set_start_tex_offset
357 // Access: Published
358 // Description: Indicates the initial UV offset of the lerped node.
359 // This is meaningful only if set_end_tex_offset() is also
360 // called. This parameter is optional; if unspecified,
361 // the value will be taken from the node's actual
362 // UV offset at the time the lerp is performed.
363 ////////////////////////////////////////////////////////////////////
364 INLINE void CLerpNodePathInterval::
365 set_start_tex_offset(const LVecBase2 &tex_offset) {
366  nassertv(!tex_offset.is_nan());
367  _start_tex_offset = tex_offset;
368  _flags |= F_start_tex_offset;
369 }
370 
371 ////////////////////////////////////////////////////////////////////
372 // Function: CLerpNodePathInterval::set_end_tex_offset
373 // Access: Published
374 // Description: Indicates that the UV offset of the node should be
375 // lerped, and specifies the final UV offset of the node.
376 // This should be called before priv_initialize(). If this
377 // is not called, the node's UV offset will not be
378 // affected by the lerp.
379 ////////////////////////////////////////////////////////////////////
380 INLINE void CLerpNodePathInterval::
381 set_end_tex_offset(const LVecBase2 &tex_offset) {
382  nassertv(!tex_offset.is_nan());
383  _end_tex_offset = tex_offset;
384  _flags |= F_end_tex_offset;
385 }
386 
387 ////////////////////////////////////////////////////////////////////
388 // Function: CLerpNodePathInterval::set_start_tex_rotate
389 // Access: Published
390 // Description: Indicates the initial UV rotate of the lerped node.
391 // This is meaningful only if set_end_tex_rotate() is also
392 // called. This parameter is optional; if unspecified,
393 // the value will be taken from the node's actual
394 // UV rotate at the time the lerp is performed.
395 ////////////////////////////////////////////////////////////////////
396 INLINE void CLerpNodePathInterval::
397 set_start_tex_rotate(PN_stdfloat tex_rotate) {
398  nassertv(!cnan(tex_rotate));
399  _start_tex_rotate = tex_rotate;
400  _flags |= F_start_tex_rotate;
401 }
402 
403 ////////////////////////////////////////////////////////////////////
404 // Function: CLerpNodePathInterval::set_end_tex_rotate
405 // Access: Published
406 // Description: Indicates that the UV rotate of the node should be
407 // lerped, and specifies the final UV rotate of the node.
408 // This should be called before priv_initialize(). If this
409 // is not called, the node's UV rotate will not be
410 // affected by the lerp.
411 ////////////////////////////////////////////////////////////////////
412 INLINE void CLerpNodePathInterval::
413 set_end_tex_rotate(PN_stdfloat tex_rotate) {
414  nassertv(!cnan(tex_rotate));
415  _end_tex_rotate = tex_rotate;
416  _flags |= F_end_tex_rotate;
417 }
418 
419 ////////////////////////////////////////////////////////////////////
420 // Function: CLerpNodePathInterval::set_start_tex_scale
421 // Access: Published
422 // Description: Indicates the initial UV scale of the lerped node.
423 // This is meaningful only if set_end_tex_scale() is also
424 // called. This parameter is optional; if unspecified,
425 // the value will be taken from the node's actual
426 // UV scale at the time the lerp is performed.
427 ////////////////////////////////////////////////////////////////////
428 INLINE void CLerpNodePathInterval::
429 set_start_tex_scale(const LVecBase2 &tex_scale) {
430  nassertv(!tex_scale.is_nan());
431  _start_tex_scale = tex_scale;
432  _flags |= F_start_tex_scale;
433 }
434 
435 ////////////////////////////////////////////////////////////////////
436 // Function: CLerpNodePathInterval::set_end_tex_scale
437 // Access: Published
438 // Description: Indicates that the UV scale of the node should be
439 // lerped, and specifies the final UV scale of the node.
440 // This should be called before priv_initialize(). If this
441 // is not called, the node's UV scale will not be
442 // affected by the lerp.
443 ////////////////////////////////////////////////////////////////////
444 INLINE void CLerpNodePathInterval::
445 set_end_tex_scale(const LVecBase2 &tex_scale) {
446  nassertv(!tex_scale.is_nan());
447  _end_tex_scale = tex_scale;
448  _flags |= F_end_tex_scale;
449 }
450 
451 ////////////////////////////////////////////////////////////////////
452 // Function: CLerpNodePathInterval::set_override
453 // Access: Published
454 // Description: Changes the override value that will be associated
455 // with any state changes applied by the lerp. If this
456 // lerp is changing state (for instance, a color lerp or
457 // a tex matrix lerp), then the new attributes created
458 // by this lerp will be assigned the indicated override
459 // value when they are applied to the node.
460 ////////////////////////////////////////////////////////////////////
461 INLINE void CLerpNodePathInterval::
462 set_override(int override) {
463  _override = override;
464 }
465 
466 ////////////////////////////////////////////////////////////////////
467 // Function: CLerpNodePathInterval::get_override
468 // Access: Published
469 // Description: Returns the override value that will be associated
470 // with any state changes applied by the lerp. See
471 // set_override().
472 ////////////////////////////////////////////////////////////////////
473 INLINE int CLerpNodePathInterval::
474 get_override() const {
475  return _override;
476 }
void set_start_scale(const LVecBase3 &scale)
Indicates the initial scale of the lerped node.
void set_start_shear(const LVecBase3 &shear)
Indicates the initial shear of the lerped node.
void set_start_hpr(const LVecBase3 &hpr)
Indicates the initial rotation of the lerped node.
void set_end_shear(const LVecBase3 &shear)
Indicates that the shear of the node should be lerped, and specifies the final shear of the node...
void set_end_scale(const LVecBase3 &scale)
Indicates that the scale of the node should be lerped, and specifies the final scale of the node...
This is the base class for all three-component vectors and points.
Definition: lvecBase3.h:105
void set_start_color_scale(const LVecBase4 &color_scale)
Indicates the initial color scale of the lerped node.
void set_end_hpr(const LVecBase3 &hpr)
Indicates that the rotation of the node should be lerped, and specifies the final rotation of the nod...
void set_end_color(const LVecBase4 &color)
Indicates that the color of the node should be lerped, and specifies the final color of the node...
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
Definition: lvecBase2.h:430
void set_start_quat(const LQuaternion &quat)
Indicates the initial rotation of the lerped node.
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
Definition: lvecBase4.h:575
void set_texture_stage(TextureStage *stage)
Indicates the texture stage that is adjusted by tex_offset, tex_rotate, and/or tex_scale.
bool is_nan() const
Returns true if any component of the vector is not-a-number, false otherwise.
Definition: lvecBase3.h:463
const NodePath & get_node() const
Returns the node being lerped.
void set_start_color(const LVecBase4 &color)
Indicates the initial color of the lerped node.
int get_override() const
Returns the override value that will be associated with any state changes applied by the lerp...
void set_end_tex_scale(const LVecBase2 &tex_scale)
Indicates that the UV scale of the node should be lerped, and specifies the final UV scale of the nod...
void set_start_tex_offset(const LVecBase2 &tex_offset)
Indicates the initial UV offset of the lerped node.
void set_end_pos(const LVecBase3 &pos)
Indicates that the position of the node should be lerped, and specifies the final position of the nod...
This is the base class for all two-component vectors and points.
Definition: lvecBase2.h:105
void set_override(int override)
Changes the override value that will be associated with any state changes applied by the lerp...
void set_hpr(const LVecBase3f &hpr, CoordinateSystem cs=CS_default)
Sets the quaternion as the unit quaternion that is equivalent to these Euler angles.
void set_start_tex_scale(const LVecBase2 &tex_scale)
Indicates the initial UV scale of the lerped node.
void set_start_tex_rotate(PN_stdfloat tex_rotate)
Indicates the initial UV rotate of the lerped node.
This is the base class for all three-component vectors and points.
Definition: lvecBase4.h:111
This is the base quaternion class.
Definition: lquaternion.h:96
void set_start_pos(const LVecBase3 &pos)
Indicates the initial position of the lerped node.
void set_end_color_scale(const LVecBase4 &color_scale)
Indicates that the color scale of the node should be lerped, and specifies the final color scale of t...
void set_end_tex_rotate(PN_stdfloat tex_rotate)
Indicates that the UV rotate of the node should be lerped, and specifies the final UV rotate of the n...
void set_end_quat(const LVecBase3 &hpr)
Indicates that the rotation of the node should be lerped, and specifies the final rotation of the nod...
void set_end_tex_offset(const LVecBase2 &tex_offset)
Indicates that the UV offset of the node should be lerped, and specifies the final UV offset of the n...
Defines the properties of a named stage of the multitexture pipeline.
Definition: textureStage.h:38
LVecBase3f get_hpr(CoordinateSystem cs=CS_default) const
Extracts the equivalent Euler angles from the unit quaternion.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:165
const NodePath & get_other() const
Returns the "other" node, which the lerped node is being moved relative to.