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  */
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  */
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  */
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  */
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  */
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  * The given quaternion needs to be normalized.
111  */
113 set_start_quat(const LQuaternion &quat) {
114  nassertv(!quat.is_nan());
115  _start_quat = quat;
116  _flags = (_flags & ~(F_slerp_setup | F_start_hpr)) | F_start_quat;
117 }
118 
119 /**
120  * Indicates that the rotation of the node should be lerped, and specifies the
121  * final rotation of the node. This should be called before
122  * priv_initialize().
123  *
124  * This replaces a previous call to set_end_hpr(). If neither set_end_quat()
125  * nor set_end_hpr() is called, the node's rotation will not be affected by
126  * the lerp.
127  *
128  * This special function is overloaded to accept a HPR trio, even though the
129  * function name is set_end_quat(). The HPR will be implicitly converted to a
130  * quaternion, and the lerp will be performed in quaternion space, as a
131  * spherical lerp.
132  */
134 set_end_quat(const LVecBase3 &hpr) {
135  nassertv(!hpr.is_nan());
136  _end_quat.set_hpr(hpr);
137  _flags = (_flags & ~(F_slerp_setup | F_end_hpr)) | F_end_quat;
138 }
139 
140 /**
141  * Indicates that the rotation of the node should be lerped, and specifies the
142  * final rotation of the node. This should be called before
143  * priv_initialize().
144  *
145  * This replaces a previous call to set_end_hpr(). If neither set_end_quat()
146  * nor set_end_hpr() is called, the node's rotation will not be affected by
147  * the lerp.
148  *
149  * The given quaternion needs to be normalized.
150  */
152 set_end_quat(const LQuaternion &quat) {
153  nassertv(!quat.is_nan());
154  _end_quat = quat;
155  _flags = (_flags & ~(F_slerp_setup | F_end_hpr)) | F_end_quat;
156 }
157 
158 /**
159  * Indicates the initial scale of the lerped node. This is meaningful only if
160  * set_end_scale() is also called. This parameter is optional; if
161  * unspecified, the value will be taken from the node's actual scale at the
162  * time the lerp is performed.
163  */
165 set_start_scale(const LVecBase3 &scale) {
166  nassertv(!scale.is_nan());
167  _start_scale = scale;
168  _flags |= F_start_scale;
169 }
170 
171 /**
172  * Indicates the initial scale of the lerped node. This is meaningful only if
173  * set_end_scale() is also called. This parameter is optional; if
174  * unspecified, the value will be taken from the node's actual scale at the
175  * time the lerp is performed.
176  */
178 set_start_scale(PN_stdfloat scale) {
179  nassertv(!cnan(scale));
180  set_start_scale(LVecBase3(scale, scale, scale));
181 }
182 
183 /**
184  * Indicates that the scale of the node should be lerped, and specifies the
185  * final scale of the node. This should be called before priv_initialize().
186  * If this is not called, the node's scale will not be affected by the lerp.
187  */
189 set_end_scale(const LVecBase3 &scale) {
190  nassertv(!scale.is_nan());
191  _end_scale = scale;
192  _flags |= F_end_scale;
193 }
194 
195 /**
196  * Indicates that the scale of the node should be lerped, and specifies the
197  * final scale of the node. This should be called before priv_initialize().
198  * If this is not called, the node's scale will not be affected by the lerp.
199  */
201 set_end_scale(PN_stdfloat scale) {
202  nassertv(!cnan(scale));
203  set_end_scale(LVecBase3(scale, scale, scale));
204 }
205 
206 /**
207  * Indicates the initial shear of the lerped node. This is meaningful only if
208  * set_end_shear() is also called. This parameter is optional; if
209  * unspecified, the value will be taken from the node's actual shear at the
210  * time the lerp is performed.
211  */
213 set_start_shear(const LVecBase3 &shear) {
214  nassertv(!shear.is_nan());
215  _start_shear = shear;
216  _flags |= F_start_shear;
217 }
218 
219 /**
220  * Indicates that the shear of the node should be lerped, and specifies the
221  * final shear of the node. This should be called before priv_initialize().
222  * If this is not called, the node's shear will not be affected by the lerp.
223  */
225 set_end_shear(const LVecBase3 &shear) {
226  nassertv(!shear.is_nan());
227  _end_shear = shear;
228  _flags |= F_end_shear;
229 }
230 
231 /**
232  * Indicates the initial color of the lerped node. This is meaningful only if
233  * set_end_color() is also called. This parameter is optional; if
234  * unspecified, the value will be taken from the node's actual color at the
235  * time the lerp is performed.
236  */
238 set_start_color(const LVecBase4 &color) {
239  nassertv(!color.is_nan());
240  _start_color = color;
241  _flags |= F_start_color;
242 }
243 
244 /**
245  * Indicates that the color of the node should be lerped, and specifies the
246  * final color of the node. This should be called before priv_initialize().
247  * If this is not called, the node's color will not be affected by the lerp.
248  */
250 set_end_color(const LVecBase4 &color) {
251  nassertv(!color.is_nan());
252  _end_color = color;
253  _flags |= F_end_color;
254 }
255 
256 /**
257  * Indicates the initial color scale of the lerped node. This is meaningful
258  * only if set_end_color_scale() is also called. This parameter is optional;
259  * if unspecified, the value will be taken from the node's actual color scale
260  * at the time the lerp is performed.
261  */
263 set_start_color_scale(const LVecBase4 &color_scale) {
264  nassertv(!color_scale.is_nan());
265  _start_color_scale = color_scale;
266  _flags |= F_start_color_scale;
267 }
268 
269 /**
270  * Indicates that the color scale of the node should be lerped, and specifies
271  * the final color scale of the node. This should be called before
272  * priv_initialize(). If this is not called, the node's color scale will not
273  * be affected by the lerp.
274  */
276 set_end_color_scale(const LVecBase4 &color_scale) {
277  nassertv(!color_scale.is_nan());
278  _end_color_scale = color_scale;
279  _flags |= F_end_color_scale;
280 }
281 
282 /**
283  * Indicates the texture stage that is adjusted by tex_offset, tex_rotate,
284  * and/or tex_scale. If this is not set, the default is the default texture
285  * stage.
286  */
289  _texture_stage = stage;
290 }
291 
292 /**
293  * Indicates the initial UV offset of the lerped node. This is meaningful
294  * only if set_end_tex_offset() is also called. This parameter is optional;
295  * if unspecified, the value will be taken from the node's actual UV offset at
296  * the time the lerp is performed.
297  */
299 set_start_tex_offset(const LVecBase2 &tex_offset) {
300  nassertv(!tex_offset.is_nan());
301  _start_tex_offset = tex_offset;
302  _flags |= F_start_tex_offset;
303 }
304 
305 /**
306  * Indicates that the UV offset of the node should be lerped, and specifies
307  * the final UV offset of the node. This should be called before
308  * priv_initialize(). If this is not called, the node's UV offset will not be
309  * affected by the lerp.
310  */
312 set_end_tex_offset(const LVecBase2 &tex_offset) {
313  nassertv(!tex_offset.is_nan());
314  _end_tex_offset = tex_offset;
315  _flags |= F_end_tex_offset;
316 }
317 
318 /**
319  * Indicates the initial UV rotate of the lerped node. This is meaningful
320  * only if set_end_tex_rotate() is also called. This parameter is optional;
321  * if unspecified, the value will be taken from the node's actual UV rotate at
322  * the time the lerp is performed.
323  */
325 set_start_tex_rotate(PN_stdfloat tex_rotate) {
326  nassertv(!cnan(tex_rotate));
327  _start_tex_rotate = tex_rotate;
328  _flags |= F_start_tex_rotate;
329 }
330 
331 /**
332  * Indicates that the UV rotate of the node should be lerped, and specifies
333  * the final UV rotate of the node. This should be called before
334  * priv_initialize(). If this is not called, the node's UV rotate will not be
335  * affected by the lerp.
336  */
338 set_end_tex_rotate(PN_stdfloat tex_rotate) {
339  nassertv(!cnan(tex_rotate));
340  _end_tex_rotate = tex_rotate;
341  _flags |= F_end_tex_rotate;
342 }
343 
344 /**
345  * Indicates the initial UV scale of the lerped node. This is meaningful only
346  * if set_end_tex_scale() is also called. This parameter is optional; if
347  * unspecified, the value will be taken from the node's actual UV scale at the
348  * time the lerp is performed.
349  */
351 set_start_tex_scale(const LVecBase2 &tex_scale) {
352  nassertv(!tex_scale.is_nan());
353  _start_tex_scale = tex_scale;
354  _flags |= F_start_tex_scale;
355 }
356 
357 /**
358  * Indicates that the UV scale of the node should be lerped, and specifies the
359  * final UV scale of the node. This should be called before
360  * priv_initialize(). If this is not called, the node's UV scale will not be
361  * affected by the lerp.
362  */
364 set_end_tex_scale(const LVecBase2 &tex_scale) {
365  nassertv(!tex_scale.is_nan());
366  _end_tex_scale = tex_scale;
367  _flags |= F_end_tex_scale;
368 }
369 
370 /**
371  * Changes the override value that will be associated with any state changes
372  * applied by the lerp. If this lerp is changing state (for instance, a color
373  * lerp or a tex matrix lerp), then the new attributes created by this lerp
374  * will be assigned the indicated override value when they are applied to the
375  * node.
376  */
378 set_override(int override) {
379  _override = override;
380 }
381 
382 /**
383  * Returns the override value that will be associated with any state changes
384  * applied by the lerp. See set_override().
385  */
387 get_override() const {
388  return _override;
389 }
void set_start_scale(const LVecBase3 &scale)
Indicates the initial scale of the lerped node.
void set_start_color_scale(const LVecBase4 &color_scale)
Indicates the initial color scale of the lerped node.
void set_start_hpr(const LVecBase3 &hpr)
Indicates the initial rotation of the lerped node.
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...
const NodePath & get_node() const
Returns the node being lerped.
int get_override() const
Returns the override value that will be associated with any state changes applied by the lerp.
void set_start_color(const LVecBase4 &color)
Indicates the initial color 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_start_tex_offset(const LVecBase2 &tex_offset)
Indicates the initial UV offset of the lerped node.
void set_start_tex_scale(const LVecBase2 &tex_scale)
Indicates the initial UV scale of the lerped node.
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...
void set_override(int override)
Changes the override value that will be associated with any state changes applied by the lerp.
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_quat(const LQuaternion &quat)
Indicates the initial rotation of the lerped node.
void set_start_tex_rotate(PN_stdfloat tex_rotate)
Indicates the initial UV rotate of the lerped node.
void set_texture_stage(TextureStage *stage)
Indicates the texture stage that is adjusted by tex_offset, tex_rotate, and/or tex_scale.
const NodePath & get_other() const
Returns the "other" node, which the lerped node is being moved relative to.
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_start_pos(const LVecBase3 &pos)
Indicates the initial position 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...
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_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_start_shear(const LVecBase3 &shear)
Indicates the initial shear 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.
NodePath is the fundamental system for disambiguating instances, and also provides a higher-level int...
Definition: nodePath.h:159
Defines the properties of a named stage of the multitexture pipeline.
Definition: textureStage.h:35