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 std::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). More... | |
virtual TypeHandle | force_init_type () |
const NodePath & | get_node () const |
Returns the node being lerped. More... | |
const NodePath & | get_other () const |
Returns the "other" node, which the lerped node is being moved relative to. More... | |
int | get_override () const |
Returns the override value that will be associated with any state changes applied by the lerp. More... | |
virtual TypeHandle | get_type () const |
virtual void | output (std::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. More... | |
virtual void | priv_instant () |
This is called in lieu of priv_initialize() . More... | |
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. More... | |
virtual void | priv_reverse_instant () |
This is called in lieu of priv_reverse_initialize() . More... | |
virtual void | priv_step (double t) |
Advances the time on the interval. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
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. More... | |
void | set_override (int override) |
Changes the override value that will be associated with any state changes applied by the lerp. More... | |
void | set_start_color (const LVecBase4 &color) |
Indicates the initial color of the lerped node. More... | |
void | set_start_color_scale (const LVecBase4 &color_scale) |
Indicates the initial color scale of the lerped node. More... | |
void | set_start_hpr (const LVecBase3 &hpr) |
Indicates the initial rotation of the lerped node. More... | |
void | set_start_pos (const LVecBase3 &pos) |
Indicates the initial position of the lerped node. More... | |
void | set_start_quat (const LQuaternion &quat) |
Indicates the initial rotation of the lerped node. More... | |
void | set_start_scale (const LVecBase3 &scale) |
Indicates the initial scale of the lerped node. More... | |
void | set_start_scale (PN_stdfloat scale) |
Indicates the initial scale of the lerped node. More... | |
void | set_start_shear (const LVecBase3 &shear) |
Indicates the initial shear of the lerped node. More... | |
void | set_start_tex_offset (const LVecBase2 &tex_offset) |
Indicates the initial UV offset of the lerped node. More... | |
void | set_start_tex_rotate (PN_stdfloat tex_rotate) |
Indicates the initial UV rotate of the lerped node. More... | |
void | set_start_tex_scale (const LVecBase2 &tex_scale) |
Indicates the initial UV scale of the lerped node. More... | |
void | set_texture_stage (TextureStage *stage) |
Indicates the texture stage that is adjusted by tex_offset, tex_rotate, and/or tex_scale. More... | |
Public Member Functions inherited from CLerpInterval | |
CLerpInterval (const std::string &name, double duration, BlendType blend_type) | |
BlendType | get_blend_type () const |
Returns the blend type specified for the interval. More... | |
Public Member Functions inherited from CInterval | |
CInterval (const std::string &name, double duration, bool open_ended) | |
bool | check_t_callback () |
Returns true if the wants_t_callback() flag is true and the interval's t value has changed since the last call to check_t_callback(), false otherwise. More... | |
void | clear_to_initial () |
Pauses the interval, if it is playing, and resets its state to its initial state, abandoning any state changes already in progress in the middle of the interval. More... | |
void | finish () |
Stops the interval from playing and sets it to its final state. More... | |
bool | get_auto_finish () const |
bool | get_auto_pause () const |
const std::string & | get_done_event () const |
double | get_duration () const |
CIntervalManager * | get_manager () const |
const std::string & | get_name () const |
bool | get_open_ended () const |
double | get_play_rate () const |
State | get_state () const |
double | get_t () const |
bool | get_wants_t_callback () const |
Returns the state of the 'wants_t_callback' flag. More... | |
bool | is_playing () const |
bool | is_stopped () const |
void | loop (double start_t=0.0, double end_t=-1.0, double play_rate=1.0) |
Starts the interval playing by registering it with the current CIntervalManager. More... | |
void | mark_dirty () |
Called by a derived class to indicate the interval has been changed internally and must be recomputed before its duration may be returned. More... | |
double | pause () |
Stops the interval from playing but leaves it in its current state. More... | |
void | priv_do_event (double t, EventType event) |
Calls the appropriate event function indicated by the EventType. More... | |
virtual void | priv_finalize () |
This is called to stop an interval, forcing it to whatever state it would be after it played all the way through. More... | |
virtual void | priv_interrupt () |
This is called while the interval is playing to indicate that it is about to be interrupted; that is, priv_step() will not be called for a length of time. More... | |
virtual void | priv_reverse_finalize () |
Called generally following a priv_reverse_initialize(), this indicates the interval should set itself to the initial state. More... | |
void | resume () |
Restarts the interval from its current point after a previous call to pause(). More... | |
void | resume (double start_t) |
Restarts the interval from the indicated point after a previous call to pause(). More... | |
void | resume_until (double end_t) |
Restarts the interval from the current point after a previous call to pause() (or a previous play-to-point-and-stop), to play until the indicated point and then stop. More... | |
void | set_auto_finish (bool auto_finish) |
void | set_auto_pause (bool auto_pause) |
void | set_done_event (const std::string &event) |
void | set_manager (CIntervalManager *manager) |
void | set_play_rate (double play_rate) |
void | set_t (double t) |
void | set_wants_t_callback (bool wants_t_callback) |
Changes the state of the 'wants_t_callback' flag. More... | |
void | setup_play (double start_time, double end_time, double play_rate, bool do_loop) |
Called to prepare the interval for automatic timed playback, e.g. More... | |
void | setup_resume () |
Called to prepare the interval for restarting at the current point within the interval after an interruption. More... | |
void | setup_resume_until (double end_t) |
Called to prepare the interval for restarting from the current point after a previous call to pause() (or a previous play-to-point-and-stop), to play until the indicated point and then stop. More... | |
void | start (double start_t=0.0, double end_t=-1.0, double play_rate=1.0) |
Starts the interval playing by registering it with the current CIntervalManager. More... | |
bool | step_play () |
Should be called once per frame to execute the automatic timed playback begun with setup_play(). More... | |
virtual void | write (std::ostream &out, int indent_level) const |
Public Member Functions inherited from TypedReferenceCount | |
TypedReferenceCount (const TypedReferenceCount ©) | |
void | operator= (const TypedReferenceCount ©) |
Public Member Functions inherited from TypedObject | |
TypedObject (const TypedObject ©)=default | |
TypedObject * | as_typed_object () |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
const TypedObject * | as_typed_object () const |
Returns the object, upcast (if necessary) to a TypedObject pointer. More... | |
int | get_best_parent_from_Set (const std::set< int > &) const |
int | get_type_index () const |
Returns the internal index number associated with this object's TypeHandle, a unique number for each different type. More... | |
bool | is_exact_type (TypeHandle handle) const |
Returns true if the current object is the indicated type exactly. More... | |
bool | is_of_type (TypeHandle handle) const |
Returns true if the current object is or derives from the indicated type. More... | |
TypedObject & | operator= (const TypedObject ©)=default |
Public Member Functions inherited from ReferenceCount | |
int | get_ref_count () const |
WeakReferenceList * | get_weak_list () const |
Returns the WeakReferenceList associated with this ReferenceCount object. More... | |
bool | has_weak_list () const |
Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise. More... | |
void | local_object () |
This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack. More... | |
void | ref () const |
Explicitly increments the reference count. More... | |
bool | ref_if_nonzero () const |
Atomically increases the reference count of this object if it is not zero. More... | |
bool | test_ref_count_integrity () const |
Does some easy checks to make sure that the reference count isn't completely bogus. More... | |
bool | test_ref_count_nonzero () const |
Does some easy checks to make sure that the reference count isn't zero, or completely bogus. More... | |
virtual bool | unref () const |
Explicitly decrements the reference count. More... | |
WeakReferenceList * | weak_ref () |
Adds the indicated PointerToVoid as a weak reference to this object. More... | |
void | weak_unref () |
Removes the indicated PointerToVoid as a weak reference to this object. More... | |
Static Public Member Functions | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from CLerpInterval | |
static TypeHandle | get_class_type () |
static void | init_type () |
static BlendType | string_blend_type (const std::string &blend_type) |
Returns the BlendType enumerated value corresponding to the indicated string, or BT_invalid if the string doesn't match anything. More... | |
Static Public Member Functions inherited from CInterval | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from TypedReferenceCount | |
static TypeHandle | get_class_type () |
static void | init_type () |
Static Public Member Functions inherited from TypedObject | |
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. More... | |
Static Public Member Functions inherited from ReferenceCount | |
static TypeHandle | get_class_type () |
static void | init_type () |
Additional Inherited Members | |
Public Types inherited from CLerpInterval | |
enum | BlendType { BT_no_blend, BT_ease_in, BT_ease_out, BT_ease_in_out, BT_invalid } |
Public Types inherited from CInterval | |
enum | EventType { ET_initialize, ET_instant, ET_step, ET_finalize, ET_reverse_initialize, ET_reverse_instant, ET_reverse_finalize, ET_interrupt } |
enum | State { S_initial, S_started, S_paused, S_final } |
Public Attributes inherited from CInterval | |
get_auto_finish | |
Returns the state of the 'auto_finish' flag. More... | |
get_auto_pause | |
Returns the state of the 'auto_pause' flag. More... | |
get_done_event | |
Returns the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own. More... | |
get_duration | |
Returns the duration of the interval in seconds. More... | |
get_manager | |
Returns the CIntervalManager object which will be responsible for playing this interval. More... | |
get_name | |
Returns the interval's name. More... | |
get_open_ended | |
Returns the state of the "open_ended" flag. More... | |
get_play_rate | |
Returns the play rate as set by the last call to start(), loop(), or set_play_rate(). More... | |
get_state | |
Indicates the state the interval believes it is in: whether it has been started, is currently in the middle, or has been finalized. More... | |
get_t | |
Returns the current time of the interval: the last value of t passed to priv_initialize(), priv_step(), or priv_finalize(). More... | |
is_playing | |
Returns true if the interval is currently playing, false otherwise. More... | |
is_stopped | |
Returns true if the interval is in either its initial or final states (but not in a running or paused state). More... | |
set_auto_finish | |
Changes the state of the 'auto_finish' flag. More... | |
set_auto_pause | |
Changes the state of the 'auto_pause' flag. More... | |
set_done_event | |
Sets the event that is generated whenever the interval reaches its final state, whether it is explicitly finished or whether it gets there on its own. More... | |
set_manager | |
Indicates the CIntervalManager object which will be responsible for playing this interval. More... | |
set_play_rate | |
Changes the play rate of the interval. More... | |
set_t | |
Explicitly sets the time within the interval. More... | |
Public Attributes inherited from TypedObject | |
get_type | |
Public Attributes inherited from ReferenceCount | |
get_ref_count | |
Returns the current reference count. More... | |
An interval that lerps one or more properties (like pos, hpr, etc.) on a NodePath over time.
Definition at line 26 of file cLerpNodePathInterval.h.
|
explicit |
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 50 of file cLerpNodePathInterval.cxx.
|
inline |
Returns the node being lerped.
Definition at line 18 of file cLerpNodePathInterval.I.
|
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 28 of file cLerpNodePathInterval.I.
|
inline |
Returns the override value that will be associated with any state changes applied by the lerp.
See set_override().
Definition at line 383 of file cLerpNodePathInterval.I.
|
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 77 of file cLerpNodePathInterval.cxx.
References priv_step().
|
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 91 of file cLerpNodePathInterval.cxx.
References CInterval::get_duration, and priv_step().
|
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 519 of file cLerpNodePathInterval.cxx.
References priv_step().
|
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 534 of file cLerpNodePathInterval.cxx.
References priv_step().
|
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 106 of file cLerpNodePathInterval.cxx.
Referenced by priv_initialize(), priv_instant(), priv_reverse_initialize(), and priv_reverse_instant().
|
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 246 of file cLerpNodePathInterval.I.
|
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 272 of file cLerpNodePathInterval.I.
|
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 81 of file cLerpNodePathInterval.I.
|
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 98 of file cLerpNodePathInterval.I.
|
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 52 of file cLerpNodePathInterval.I.
|
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 132 of file cLerpNodePathInterval.I.
|
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 148 of file cLerpNodePathInterval.I.
|
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 185 of file cLerpNodePathInterval.I.
|
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 197 of file cLerpNodePathInterval.I.
|
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 221 of file cLerpNodePathInterval.I.
|
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 308 of file cLerpNodePathInterval.I.
|
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 334 of file cLerpNodePathInterval.I.
|
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 360 of file cLerpNodePathInterval.I.
|
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 374 of file cLerpNodePathInterval.I.
|
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 234 of file cLerpNodePathInterval.I.
|
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 259 of file cLerpNodePathInterval.I.
|
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 65 of file cLerpNodePathInterval.I.
|
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 39 of file cLerpNodePathInterval.I.
|
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 111 of file cLerpNodePathInterval.I.
|
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 161 of file cLerpNodePathInterval.I.
|
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 174 of file cLerpNodePathInterval.I.
|
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 209 of file cLerpNodePathInterval.I.
|
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 295 of file cLerpNodePathInterval.I.
|
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 321 of file cLerpNodePathInterval.I.
|
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 347 of file cLerpNodePathInterval.I.
|
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 284 of file cLerpNodePathInterval.I.