Panda3D
|
An interval that lerps one or more properties (like pos, hpr, etc.) on a NodePath over time. More...
#include "cLerpNodePathInterval.h"
Public Member Functions | |
CLerpNodePathInterval (const string &name, double duration, BlendType blend_type, bool bake_in_start, bool fluid, const NodePath &node, const NodePath &other) | |
Constructs a lerp interval that will lerp some properties on the indicated node, possibly relative to the indicated other node (if other is nonempty). | |
virtual TypeHandle | force_init_type () |
const NodePath & | get_node () const |
Returns the node being lerped. | |
const NodePath & | get_other () const |
Returns the "other" node, which the lerped node is being moved relative to. | |
int | get_override () const |
Returns the override value that will be associated with any state changes applied by the lerp. | |
virtual TypeHandle | get_type () const |
virtual void | output (ostream &out) const |
virtual void | priv_initialize (double t) |
This replaces the first call to priv_step(), and indicates that the interval has just begun. | |
virtual void | priv_instant () |
This is called in lieu of priv_initialize() . | |
virtual void | priv_reverse_initialize (double t) |
Similar to priv_initialize(), but this is called when the interval is being played backwards; it indicates that the interval should start at the finishing state and undo any intervening intervals. | |
virtual void | priv_reverse_instant () |
This is called in lieu of priv_reverse_initialize() | |
virtual void | priv_step (double t) |
Advances the time on the interval. | |
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_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 the node. | |
void | set_end_hpr (const LQuaternion &quat) |
Indicates that the rotation of the node should be lerped, and specifies the final rotation of the 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 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 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 node. | |
void | set_end_quat (const LQuaternion &quat) |
Indicates that the rotation of the node should be lerped, and specifies the final rotation 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_end_scale (PN_stdfloat scale) |
Indicates that the scale of the node should be lerped, and specifies the final scale of the 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_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 node. | |
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 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 node. | |
void | set_override (int override) |
Changes 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_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_start_pos (const LVecBase3 &pos) |
Indicates the initial position of the lerped node. | |
void | set_start_quat (const LQuaternion &quat) |
Indicates the initial rotation of the lerped node. | |
void | set_start_scale (const LVecBase3 &scale) |
Indicates the initial scale of the lerped node. | |
void | set_start_scale (PN_stdfloat 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_tex_offset (const LVecBase2 &tex_offset) |
Indicates the initial UV offset of the lerped node. | |
void | set_start_tex_rotate (PN_stdfloat tex_rotate) |
Indicates the initial UV rotate of the lerped node. | |
void | set_start_tex_scale (const LVecBase2 &tex_scale) |
Indicates the initial UV scale 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. | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
This function is declared non-inline to work around a compiler bug in g++ 2.96. |
An interval that lerps one or more properties (like pos, hpr, etc.) on a NodePath over time.
Definition at line 28 of file cLerpNodePathInterval.h.
CLerpNodePathInterval::CLerpNodePathInterval | ( | const string & | name, |
double | duration, | ||
CLerpInterval::BlendType | blend_type, | ||
bool | bake_in_start, | ||
bool | fluid, | ||
const NodePath & | node, | ||
const NodePath & | other | ||
) |
Constructs a lerp interval that will lerp some properties on the indicated node, possibly relative to the indicated other node (if other is nonempty).
You must call set_end_pos(), etc. for the various properties you wish to lerp before the first call to priv_initialize(). If you want to set a starting value for any of the properties, you may call set_start_pos(), etc.; otherwise, the starting value is taken from the actual node's value at the time the lerp is performed.
The starting values may be explicitly specified or omitted. The value of bake_in_start determines the behavior if the starting values are omitted. If bake_in_start is true, the values are obtained the first time the lerp runs, and thenceforth are stored within the interval. If bake_in_start is false, the starting value is computed each frame, based on assuming the current value represents the value set from the last time the interval was run. This "smart" behavior allows code to manipulate the object event while it is being lerped, and the lerp continues to apply in a sensible way.
If fluid is true, the prev_transform is not adjusted by the lerp; otherwise, it is reset.
Definition at line 59 of file cLerpNodePathInterval.cxx.
const NodePath & CLerpNodePathInterval::get_node | ( | ) | const [inline] |
Returns the node being lerped.
Definition at line 22 of file cLerpNodePathInterval.I.
const NodePath & CLerpNodePathInterval::get_other | ( | ) | const [inline] |
Returns the "other" node, which the lerped node is being moved relative to.
If this is an empty node path, the lerped node is being moved in its own coordinate system.
Definition at line 35 of file cLerpNodePathInterval.I.
int CLerpNodePathInterval::get_override | ( | ) | const [inline] |
Returns the override value that will be associated with any state changes applied by the lerp.
See set_override().
Definition at line 474 of file cLerpNodePathInterval.I.
static void CLerpNodePathInterval::init_type | ( | ) | [inline, static] |
This function is declared non-inline to work around a compiler bug in g++ 2.96.
Making it inline seems to cause problems in the optimizer.
Reimplemented from CLerpInterval.
Definition at line 140 of file cLerpNodePathInterval.h.
References CLerpInterval::init_type().
void CLerpNodePathInterval::priv_initialize | ( | double | t | ) | [virtual] |
This replaces the first call to priv_step(), and indicates that the interval has just begun.
This may be overridden by derived classes that need to do some explicit initialization on the first call.
Reimplemented from CInterval.
Definition at line 89 of file cLerpNodePathInterval.cxx.
References CInterval::check_stopped(), priv_step(), and CInterval::recompute().
void CLerpNodePathInterval::priv_instant | ( | ) | [virtual] |
This is called in lieu of priv_initialize() .
. priv_step() .. priv_finalize(), when everything is to happen within one frame. The interval should initialize itself, then leave itself in the final state.
Reimplemented from CInterval.
Definition at line 106 of file cLerpNodePathInterval.cxx.
References CInterval::check_stopped(), CInterval::get_duration(), priv_step(), and CInterval::recompute().
void CLerpNodePathInterval::priv_reverse_initialize | ( | double | t | ) | [virtual] |
Similar to priv_initialize(), but this is called when the interval is being played backwards; it indicates that the interval should start at the finishing state and undo any intervening intervals.
Reimplemented from CInterval.
Definition at line 540 of file cLerpNodePathInterval.cxx.
References CInterval::check_stopped(), priv_step(), and CInterval::recompute().
void CLerpNodePathInterval::priv_reverse_instant | ( | ) | [virtual] |
This is called in lieu of priv_reverse_initialize()
. priv_step() .. priv_reverse_finalize(), when everything is to happen within one frame. The interval should initialize itself, then leave itself in the initial state.
Reimplemented from CInterval.
Definition at line 558 of file cLerpNodePathInterval.cxx.
References CInterval::check_stopped(), priv_step(), and CInterval::recompute().
void CLerpNodePathInterval::priv_step | ( | double | t | ) | [virtual] |
Advances the time on the interval.
The time may either increase (the normal case) or decrease (e.g. if the interval is being played by a slider).
Reimplemented from CInterval.
Definition at line 123 of file cLerpNodePathInterval.cxx.
References CInterval::check_started(), CLerpInterval::compute_delta(), ColorAttrib::get_color(), ColorAttrib::get_color_type(), LQuaternionf::get_hpr(), NodePath::get_prev_transform(), ColorScaleAttrib::get_scale(), NodePath::get_state(), NodePath::get_transform(), NodePath::is_empty(), LQuaternionf::set_hpr(), NodePath::set_hpr(), NodePath::set_hpr_scale(), NodePath::set_pos(), NodePath::set_pos_hpr(), NodePath::set_pos_hpr_scale(), NodePath::set_pos_hpr_scale_shear(), NodePath::set_pos_quat(), NodePath::set_pos_quat_scale(), NodePath::set_pos_quat_scale_shear(), NodePath::set_prev_transform(), NodePath::set_quat(), NodePath::set_quat_scale(), NodePath::set_scale(), NodePath::set_shear(), set_start_hpr(), set_start_pos(), set_start_quat(), set_start_scale(), set_start_shear(), and NodePath::set_state().
Referenced by priv_initialize(), priv_instant(), priv_reverse_initialize(), and priv_reverse_instant().
void CLerpNodePathInterval::set_end_color | ( | const LVecBase4 & | color | ) | [inline] |
Indicates that the color of the node should be lerped, and specifies the final color of the node.
This should be called before priv_initialize(). If this is not called, the node's color will not be affected by the lerp.
Definition at line 305 of file cLerpNodePathInterval.I.
References LVecBase4f::is_nan().
void CLerpNodePathInterval::set_end_color_scale | ( | const LVecBase4 & | color_scale | ) | [inline] |
Indicates that the color scale of the node should be lerped, and specifies the final color scale of the node.
This should be called before priv_initialize(). If this is not called, the node's color scale will not be affected by the lerp.
Definition at line 337 of file cLerpNodePathInterval.I.
References LVecBase4f::is_nan().
void CLerpNodePathInterval::set_end_hpr | ( | const LQuaternion & | quat | ) | [inline] |
Indicates that the rotation of the node should be lerped, and specifies the final rotation of the node.
This should be called before priv_initialize().
This special function is overloaded to accept a quaternion, even though the function name is set_end_hpr(). The quaternion will be implicitly converted to a HPR trio, and the lerp will be performed in HPR space, componentwise.
Definition at line 120 of file cLerpNodePathInterval.I.
References LQuaternionf::get_hpr(), and LVecBase4f::is_nan().
void CLerpNodePathInterval::set_end_hpr | ( | const LVecBase3 & | hpr | ) | [inline] |
Indicates that the rotation of the node should be lerped, and specifies the final rotation of the node.
This should be called before priv_initialize().
This replaces a previous call to set_end_quat(). If neither set_end_hpr() nor set_end_quat() is called, the node's rotation will not be affected by the lerp.
Definition at line 100 of file cLerpNodePathInterval.I.
References LVecBase3f::is_nan().
void CLerpNodePathInterval::set_end_pos | ( | const LVecBase3 & | pos | ) | [inline] |
Indicates that the position of the node should be lerped, and specifies the final position of the node.
This should be called before priv_initialize(). If this is not called, the node's position will not be affected by the lerp.
Definition at line 65 of file cLerpNodePathInterval.I.
References LVecBase3f::is_nan().
void CLerpNodePathInterval::set_end_quat | ( | const LQuaternion & | quat | ) | [inline] |
Indicates that the rotation of the node should be lerped, and specifies the final rotation of the node.
This should be called before priv_initialize().
This replaces a previous call to set_end_hpr(). If neither set_end_quat() nor set_end_hpr() is called, the node's rotation will not be affected by the lerp.
Definition at line 179 of file cLerpNodePathInterval.I.
References LVecBase4f::is_nan().
void CLerpNodePathInterval::set_end_quat | ( | const LVecBase3 & | hpr | ) | [inline] |
Indicates that the rotation of the node should be lerped, and specifies the final rotation of the node.
This should be called before priv_initialize().
This replaces a previous call to set_end_hpr(). If neither set_end_quat() nor set_end_hpr() is called, the node's rotation will not be affected by the lerp.
This special function is overloaded to accept a HPR trio, even though the function name is set_end_quat(). The HPR will be implicitly converted to a quaternion, and the lerp will be performed in quaternion space, as a spherical lerp.
Definition at line 161 of file cLerpNodePathInterval.I.
References LVecBase3f::is_nan(), and LQuaternionf::set_hpr().
void CLerpNodePathInterval::set_end_scale | ( | const LVecBase3 & | scale | ) | [inline] |
Indicates that the scale of the node should be lerped, and specifies the final scale of the node.
This should be called before priv_initialize(). If this is not called, the node's scale will not be affected by the lerp.
Definition at line 226 of file cLerpNodePathInterval.I.
References LVecBase3f::is_nan().
Referenced by set_end_scale().
void CLerpNodePathInterval::set_end_scale | ( | PN_stdfloat | scale | ) | [inline] |
Indicates that the scale of the node should be lerped, and specifies the final scale of the node.
This should be called before priv_initialize(). If this is not called, the node's scale will not be affected by the lerp.
Definition at line 242 of file cLerpNodePathInterval.I.
References set_end_scale().
void CLerpNodePathInterval::set_end_shear | ( | const LVecBase3 & | shear | ) | [inline] |
Indicates that the shear of the node should be lerped, and specifies the final shear of the node.
This should be called before priv_initialize(). If this is not called, the node's shear will not be affected by the lerp.
Definition at line 273 of file cLerpNodePathInterval.I.
References LVecBase3f::is_nan().
void CLerpNodePathInterval::set_end_tex_offset | ( | const LVecBase2 & | tex_offset | ) | [inline] |
Indicates that the UV offset of the node should be lerped, and specifies the final UV offset of the node.
This should be called before priv_initialize(). If this is not called, the node's UV offset will not be affected by the lerp.
Definition at line 381 of file cLerpNodePathInterval.I.
References LVecBase2f::is_nan().
void CLerpNodePathInterval::set_end_tex_rotate | ( | PN_stdfloat | tex_rotate | ) | [inline] |
Indicates that the UV rotate of the node should be lerped, and specifies the final UV rotate of the node.
This should be called before priv_initialize(). If this is not called, the node's UV rotate will not be affected by the lerp.
Definition at line 413 of file cLerpNodePathInterval.I.
void CLerpNodePathInterval::set_end_tex_scale | ( | const LVecBase2 & | tex_scale | ) | [inline] |
Indicates that the UV scale of the node should be lerped, and specifies the final UV scale of the node.
This should be called before priv_initialize(). If this is not called, the node's UV scale will not be affected by the lerp.
Definition at line 445 of file cLerpNodePathInterval.I.
References LVecBase2f::is_nan().
void CLerpNodePathInterval::set_override | ( | int | override | ) | [inline] |
Changes the override value that will be associated with any state changes applied by the lerp.
If this lerp is changing state (for instance, a color lerp or a tex matrix lerp), then the new attributes created by this lerp will be assigned the indicated override value when they are applied to the node.
Definition at line 462 of file cLerpNodePathInterval.I.
void CLerpNodePathInterval::set_start_color | ( | const LVecBase4 & | color | ) | [inline] |
Indicates the initial color of the lerped node.
This is meaningful only if set_end_color() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual color at the time the lerp is performed.
Definition at line 289 of file cLerpNodePathInterval.I.
References LVecBase4f::is_nan().
void CLerpNodePathInterval::set_start_color_scale | ( | const LVecBase4 & | color_scale | ) | [inline] |
Indicates the initial color scale of the lerped node.
This is meaningful only if set_end_color_scale() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual color scale at the time the lerp is performed.
Definition at line 321 of file cLerpNodePathInterval.I.
References LVecBase4f::is_nan().
void CLerpNodePathInterval::set_start_hpr | ( | const LVecBase3 & | hpr | ) | [inline] |
Indicates the initial rotation of the lerped node.
This is meaningful only if either set_end_hpr() or set_end_quat() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual rotation at the time the lerp is performed.
Definition at line 82 of file cLerpNodePathInterval.I.
References LVecBase3f::is_nan().
Referenced by priv_step().
void CLerpNodePathInterval::set_start_pos | ( | const LVecBase3 & | pos | ) | [inline] |
Indicates the initial position of the lerped node.
This is meaningful only if set_end_pos() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual position at the time the lerp is performed.
Definition at line 49 of file cLerpNodePathInterval.I.
References LVecBase3f::is_nan().
Referenced by priv_step().
void CLerpNodePathInterval::set_start_quat | ( | const LQuaternion & | quat | ) | [inline] |
Indicates the initial rotation of the lerped node.
This is meaningful only if either set_end_quat() or set_end_hpr() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual rotation at the time the lerp is performed.
Definition at line 137 of file cLerpNodePathInterval.I.
References LVecBase4f::is_nan().
Referenced by priv_step().
void CLerpNodePathInterval::set_start_scale | ( | const LVecBase3 & | scale | ) | [inline] |
Indicates the initial scale of the lerped node.
This is meaningful only if set_end_scale() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual scale at the time the lerp is performed.
Definition at line 195 of file cLerpNodePathInterval.I.
References LVecBase3f::is_nan().
Referenced by priv_step(), and set_start_scale().
void CLerpNodePathInterval::set_start_scale | ( | PN_stdfloat | scale | ) | [inline] |
Indicates the initial scale of the lerped node.
This is meaningful only if set_end_scale() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual scale at the time the lerp is performed.
Definition at line 211 of file cLerpNodePathInterval.I.
References set_start_scale().
void CLerpNodePathInterval::set_start_shear | ( | const LVecBase3 & | shear | ) | [inline] |
Indicates the initial shear of the lerped node.
This is meaningful only if set_end_shear() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual shear at the time the lerp is performed.
Definition at line 257 of file cLerpNodePathInterval.I.
References LVecBase3f::is_nan().
Referenced by priv_step().
void CLerpNodePathInterval::set_start_tex_offset | ( | const LVecBase2 & | tex_offset | ) | [inline] |
Indicates the initial UV offset of the lerped node.
This is meaningful only if set_end_tex_offset() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual UV offset at the time the lerp is performed.
Definition at line 365 of file cLerpNodePathInterval.I.
References LVecBase2f::is_nan().
void CLerpNodePathInterval::set_start_tex_rotate | ( | PN_stdfloat | tex_rotate | ) | [inline] |
Indicates the initial UV rotate of the lerped node.
This is meaningful only if set_end_tex_rotate() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual UV rotate at the time the lerp is performed.
Definition at line 397 of file cLerpNodePathInterval.I.
void CLerpNodePathInterval::set_start_tex_scale | ( | const LVecBase2 & | tex_scale | ) | [inline] |
Indicates the initial UV scale of the lerped node.
This is meaningful only if set_end_tex_scale() is also called. This parameter is optional; if unspecified, the value will be taken from the node's actual UV scale at the time the lerp is performed.
Definition at line 429 of file cLerpNodePathInterval.I.
References LVecBase2f::is_nan().
void CLerpNodePathInterval::set_texture_stage | ( | TextureStage * | stage | ) | [inline] |
Indicates the texture stage that is adjusted by tex_offset, tex_rotate, and/or tex_scale.
If this is not set, the default is the default texture stage.
Definition at line 351 of file cLerpNodePathInterval.I.