Panda3D
cLerpNodePathInterval.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 cLerpNodePathInterval.I
10  * @author drose
11  * @date 2002-08-27
12  */
13 
14 /**
15  * Returns the node being lerped.
16  */
18 get_node() const {
19  return _node;
20 }
21 
22 /**
23  * Returns the "other" node, which the lerped node is being moved relative to.
24  * If this is an empty node path, the lerped node is being moved in its own
25  * coordinate system.
26  */
28 get_other() const {
29  return _other;
30 }
31 
32 /**
33  * Indicates the initial position of the lerped node. This is meaningful only
34  * if set_end_pos() is also called. This parameter is optional; if
35  * unspecified, the value will be taken from the node's actual position at the
36  * time the lerp is performed.
37  */
38 INLINE void CLerpNodePathInterval::
39 set_start_pos(const LVecBase3 &pos) {
40  nassertv(!pos.is_nan());
41  _start_pos = pos;
42  _flags |= F_start_pos;
43 }
44 
45 /**
46  * Indicates that the position of the node should be lerped, and specifies the
47  * final position of the node. This should be called before
48  * priv_initialize(). If this is not called, the node's position will not be
49  * affected by the lerp.
50  */
51 INLINE void CLerpNodePathInterval::
52 set_end_pos(const LVecBase3 &pos) {
53  nassertv(!pos.is_nan());
54  _end_pos = pos;
55  _flags |= F_end_pos;
56 }
57 
58 /**
59  * Indicates the initial rotation of the lerped node. This is meaningful only
60  * if either set_end_hpr() or set_end_quat() is also called. This parameter
61  * is optional; if unspecified, the value will be taken from the node's actual
62  * rotation at the time the lerp is performed.
63  */
64 INLINE void CLerpNodePathInterval::
65 set_start_hpr(const LVecBase3 &hpr) {
66  nassertv(!hpr.is_nan());
67  _start_hpr = hpr;
68  _flags = (_flags & ~(F_slerp_setup | F_start_quat)) | F_start_hpr;
69 }
70 
71 /**
72  * Indicates that the rotation of the node should be lerped, and specifies the
73  * final rotation of the node. This should be called before
74  * priv_initialize().
75  *
76  * This replaces a previous call to set_end_quat(). If neither set_end_hpr()
77  * nor set_end_quat() is called, the node's rotation will not be affected by
78  * the lerp.
79  */
80 INLINE void CLerpNodePathInterval::
81 set_end_hpr(const LVecBase3 &hpr) {
82  nassertv(!hpr.is_nan());
83  _end_hpr = hpr;
84  _flags = (_flags & ~F_end_quat) | F_end_hpr;
85 }
86 
87 /**
88  * Indicates that the rotation of the node should be lerped, and specifies the
89  * final rotation of the node. This should be called before
90  * priv_initialize().
91  *
92  * This special function is overloaded to accept a quaternion, even though the
93  * function name is set_end_hpr(). The quaternion will be implicitly
94  * converted to a HPR trio, and the lerp will be performed in HPR space,
95  * componentwise.
96  */
97 INLINE void CLerpNodePathInterval::
98 set_end_hpr(const LQuaternion &quat) {
99  nassertv(!quat.is_nan());
100  _end_hpr = quat.get_hpr();
101  _flags = (_flags & ~F_end_quat) | F_end_hpr;
102 }
103 
104 /**
105  * Indicates the initial rotation of the lerped node. This is meaningful only
106  * if either set_end_quat() or set_end_hpr() is also called. This parameter
107  * is optional; if unspecified, the value will be taken from the node's actual
108  * rotation at the time the lerp is performed.
109  */
110 INLINE void CLerpNodePathInterval::
111 set_start_quat(const LQuaternion &quat) {
112  nassertv(!quat.is_nan());
113  _start_quat = quat;
114  _flags = (_flags & ~(F_slerp_setup | F_start_hpr)) | F_start_quat;
115 }
116 
117 /**
118  * Indicates that the rotation of the node should be lerped, and specifies the
119  * final rotation of the node. This should be called before
120  * priv_initialize().
121  *
122  * This replaces a previous call to set_end_hpr(). If neither set_end_quat()
123  * nor set_end_hpr() is called, the node's rotation will not be affected by
124  * the lerp.
125  *
126  * This special function is overloaded to accept a HPR trio, even though the
127  * function name is set_end_quat(). The HPR will be implicitly converted to a
128  * quaternion, and the lerp will be performed in quaternion space, as a
129  * spherical lerp.
130  */
131 INLINE void CLerpNodePathInterval::
132 set_end_quat(const LVecBase3 &hpr) {
133  nassertv(!hpr.is_nan());
134  _end_quat.set_hpr(hpr);
135  _flags = (_flags & ~(F_slerp_setup | F_end_hpr)) | F_end_quat;
136 }
137 
138 /**
139  * Indicates that the rotation of the node should be lerped, and specifies the
140  * final rotation of the node. This should be called before
141  * priv_initialize().
142  *
143  * This replaces a previous call to set_end_hpr(). If neither set_end_quat()
144  * nor set_end_hpr() is called, the node's rotation will not be affected by
145  * the lerp.
146  */
147 INLINE void CLerpNodePathInterval::
148 set_end_quat(const LQuaternion &quat) {
149  nassertv(!quat.is_nan());
150  _end_quat = quat;
151  _flags = (_flags & ~(F_slerp_setup | F_end_hpr)) | F_end_quat;
152 }
153 
154 /**
155  * Indicates the initial scale of the lerped node. This is meaningful only if
156  * set_end_scale() is also called. This parameter is optional; if
157  * unspecified, the value will be taken from the node's actual scale at the
158  * time the lerp is performed.
159  */
160 INLINE void CLerpNodePathInterval::
161 set_start_scale(const LVecBase3 &scale) {
162  nassertv(!scale.is_nan());
163  _start_scale = scale;
164  _flags |= F_start_scale;
165 }
166 
167 /**
168  * Indicates the initial scale of the lerped node. This is meaningful only if
169  * set_end_scale() is also called. This parameter is optional; if
170  * unspecified, the value will be taken from the node's actual scale at the
171  * time the lerp is performed.
172  */
173 INLINE void CLerpNodePathInterval::
174 set_start_scale(PN_stdfloat scale) {
175  nassertv(!cnan(scale));
176  set_start_scale(LVecBase3(scale, scale, scale));
177 }
178 
179 /**
180  * Indicates that the scale of the node should be lerped, and specifies the
181  * final scale of the node. This should be called before priv_initialize().
182  * If this is not called, the node's scale will not be affected by the lerp.
183  */
184 INLINE void CLerpNodePathInterval::
185 set_end_scale(const LVecBase3 &scale) {
186  nassertv(!scale.is_nan());
187  _end_scale = scale;
188  _flags |= F_end_scale;
189 }
190 
191 /**
192  * Indicates that the scale of the node should be lerped, and specifies the
193  * final scale of the node. This should be called before priv_initialize().
194  * If this is not called, the node's scale will not be affected by the lerp.
195  */
196 INLINE void CLerpNodePathInterval::
197 set_end_scale(PN_stdfloat scale) {
198  nassertv(!cnan(scale));
199  set_end_scale(LVecBase3(scale, scale, scale));
200 }
201 
202 /**
203  * Indicates the initial shear of the lerped node. This is meaningful only if
204  * set_end_shear() is also called. This parameter is optional; if
205  * unspecified, the value will be taken from the node's actual shear at the
206  * time the lerp is performed.
207  */
208 INLINE void CLerpNodePathInterval::
209 set_start_shear(const LVecBase3 &shear) {
210  nassertv(!shear.is_nan());
211  _start_shear = shear;
212  _flags |= F_start_shear;
213 }
214 
215 /**
216  * Indicates that the shear of the node should be lerped, and specifies the
217  * final shear of the node. This should be called before priv_initialize().
218  * If this is not called, the node's shear will not be affected by the lerp.
219  */
220 INLINE void CLerpNodePathInterval::
221 set_end_shear(const LVecBase3 &shear) {
222  nassertv(!shear.is_nan());
223  _end_shear = shear;
224  _flags |= F_end_shear;
225 }
226 
227 /**
228  * Indicates the initial color of the lerped node. This is meaningful only if
229  * set_end_color() is also called. This parameter is optional; if
230  * unspecified, the value will be taken from the node's actual color at the
231  * time the lerp is performed.
232  */
233 INLINE void CLerpNodePathInterval::
234 set_start_color(const LVecBase4 &color) {
235  nassertv(!color.is_nan());
236  _start_color = color;
237  _flags |= F_start_color;
238 }
239 
240 /**
241  * Indicates that the color of the node should be lerped, and specifies the
242  * final color of the node. This should be called before priv_initialize().
243  * If this is not called, the node's color will not be affected by the lerp.
244  */
245 INLINE void CLerpNodePathInterval::
246 set_end_color(const LVecBase4 &color) {
247  nassertv(!color.is_nan());
248  _end_color = color;
249  _flags |= F_end_color;
250 }
251 
252 /**
253  * Indicates the initial color scale of the lerped node. This is meaningful
254  * only if set_end_color_scale() is also called. This parameter is optional;
255  * if unspecified, the value will be taken from the node's actual color scale
256  * at the time the lerp is performed.
257  */
258 INLINE void CLerpNodePathInterval::
259 set_start_color_scale(const LVecBase4 &color_scale) {
260  nassertv(!color_scale.is_nan());
261  _start_color_scale = color_scale;
262  _flags |= F_start_color_scale;
263 }
264 
265 /**
266  * Indicates that the color scale of the node should be lerped, and specifies
267  * the final color scale of the node. This should be called before
268  * priv_initialize(). If this is not called, the node's color scale will not
269  * be affected by the lerp.
270  */
271 INLINE void CLerpNodePathInterval::
272 set_end_color_scale(const LVecBase4 &color_scale) {
273  nassertv(!color_scale.is_nan());
274  _end_color_scale = color_scale;
275  _flags |= F_end_color_scale;
276 }
277 
278 /**
279  * Indicates the texture stage that is adjusted by tex_offset, tex_rotate,
280  * and/or tex_scale. If this is not set, the default is the default texture
281  * stage.
282  */
283 INLINE void CLerpNodePathInterval::
285  _texture_stage = stage;
286 }
287 
288 /**
289  * Indicates the initial UV offset of the lerped node. This is meaningful
290  * only if set_end_tex_offset() is also called. This parameter is optional;
291  * if unspecified, the value will be taken from the node's actual UV offset at
292  * the time the lerp is performed.
293  */
294 INLINE void CLerpNodePathInterval::
295 set_start_tex_offset(const LVecBase2 &tex_offset) {
296  nassertv(!tex_offset.is_nan());
297  _start_tex_offset = tex_offset;
298  _flags |= F_start_tex_offset;
299 }
300 
301 /**
302  * Indicates that the UV offset of the node should be lerped, and specifies
303  * the final UV offset of the node. This should be called before
304  * priv_initialize(). If this is not called, the node's UV offset will not be
305  * affected by the lerp.
306  */
307 INLINE void CLerpNodePathInterval::
308 set_end_tex_offset(const LVecBase2 &tex_offset) {
309  nassertv(!tex_offset.is_nan());
310  _end_tex_offset = tex_offset;
311  _flags |= F_end_tex_offset;
312 }
313 
314 /**
315  * Indicates the initial UV rotate of the lerped node. This is meaningful
316  * only if set_end_tex_rotate() is also called. This parameter is optional;
317  * if unspecified, the value will be taken from the node's actual UV rotate at
318  * the time the lerp is performed.
319  */
320 INLINE void CLerpNodePathInterval::
321 set_start_tex_rotate(PN_stdfloat tex_rotate) {
322  nassertv(!cnan(tex_rotate));
323  _start_tex_rotate = tex_rotate;
324  _flags |= F_start_tex_rotate;
325 }
326 
327 /**
328  * Indicates that the UV rotate of the node should be lerped, and specifies
329  * the final UV rotate of the node. This should be called before
330  * priv_initialize(). If this is not called, the node's UV rotate will not be
331  * affected by the lerp.
332  */
333 INLINE void CLerpNodePathInterval::
334 set_end_tex_rotate(PN_stdfloat tex_rotate) {
335  nassertv(!cnan(tex_rotate));
336  _end_tex_rotate = tex_rotate;
337  _flags |= F_end_tex_rotate;
338 }
339 
340 /**
341  * Indicates the initial UV scale of the lerped node. This is meaningful only
342  * if set_end_tex_scale() is also called. This parameter is optional; if
343  * unspecified, the value will be taken from the node's actual UV scale at the
344  * time the lerp is performed.
345  */
346 INLINE void CLerpNodePathInterval::
347 set_start_tex_scale(const LVecBase2 &tex_scale) {
348  nassertv(!tex_scale.is_nan());
349  _start_tex_scale = tex_scale;
350  _flags |= F_start_tex_scale;
351 }
352 
353 /**
354  * Indicates that the UV scale of the node should be lerped, and specifies the
355  * final UV scale of the node. This should be called before
356  * priv_initialize(). If this is not called, the node's UV scale will not be
357  * affected by the lerp.
358  */
359 INLINE void CLerpNodePathInterval::
360 set_end_tex_scale(const LVecBase2 &tex_scale) {
361  nassertv(!tex_scale.is_nan());
362  _end_tex_scale = tex_scale;
363  _flags |= F_end_tex_scale;
364 }
365 
366 /**
367  * Changes the override value that will be associated with any state changes
368  * applied by the lerp. If this lerp is changing state (for instance, a color
369  * lerp or a tex matrix lerp), then the new attributes created by this lerp
370  * will be assigned the indicated override value when they are applied to the
371  * node.
372  */
373 INLINE void CLerpNodePathInterval::
374 set_override(int override) {
375  _override = override;
376 }
377 
378 /**
379  * Returns the override value that will be associated with any state changes
380  * applied by the lerp. See set_override().
381  */
382 INLINE int CLerpNodePathInterval::
383 get_override() const {
384  return _override;
385 }
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.
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.
void set_start_quat(const LQuaternion &quat)
Indicates the initial rotation 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_texture_stage(TextureStage *stage)
Indicates the texture stage that is adjusted by tex_offset, tex_rotate, and/or tex_scale.
void set_start_color(const LVecBase4 &color)
Indicates the initial color of the lerped node.
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...
const NodePath & get_node() const
Returns the node being lerped.
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...
void set_override(int override)
Changes the override value that will be associated with any state changes applied by the lerp.
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.
const NodePath & get_other() const
Returns the "other" node, which the lerped node is being moved relative to.
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:35
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:161