Panda3D
Public Member Functions | Protected Member Functions | Protected Attributes
ColorInterpolationSegment Class Reference

A single unit of interpolation. More...

#include "colorInterpolationManager.h"

Inheritance diagram for ColorInterpolationSegment:
ReferenceCount MemoryBase

List of all members.

Public Member Functions

 ColorInterpolationSegment (ColorInterpolationFunction *function, const PN_stdfloat &time_begin, const PN_stdfloat &time_end, const bool is_modulated, const int id)
 constructor
 ColorInterpolationSegment (const ColorInterpolationSegment &s)
 copy constructor
virtual ~ColorInterpolationSegment ()
 destructor
TypedReferenceCountget_function () const
 Returns a reference to the function object corresponding to this segment.
int get_id () const
 Returns the id assigned to this segment by the manager that created it.
PN_stdfloat get_time_begin () const
 Returns the point in the particle's lifetime at which this segment begins its effect.
PN_stdfloat get_time_end () const
 Returns the point in the particle's lifetime at which this segment's effect stops.
LColor interpolateColor (const PN_stdfloat t) const
 Returns the interpolated color according to the segment's function and start and end times.
bool is_enabled () const
 Returns whether the segments effects are being applied.
bool is_modulated () const
 Returns whether the function is additive or modulated.
void set_enabled (const bool enabled)
 Sets whether the segments effects should be applied.
void set_function (ColorInterpolationFunction *function)
 Sets the function that the segment will use for its interpolation calculations.
void set_is_modulated (const bool flag)
 Sets how the function is applied to the final color.
void set_time_begin (const PN_stdfloat time)
 Sets the point in the particle's lifetime at which this segment begins its effect.
void set_time_end (const PN_stdfloat time)
 Sets the point in the particle's lifetime at which this segment's effect ends.

Protected Member Functions

 PT (ColorInterpolationFunction) _color_inter_func

Protected Attributes

bool _enabled
const int _id
bool _is_modulated
PN_stdfloat _t_begin
PN_stdfloat _t_end
PN_stdfloat _t_total

Detailed Description

A single unit of interpolation.

The begin and end times are interpolated over the lifetime of the particle, thus have the range of [0,1]. Each segment also has a function associated with it.

Definition at line 241 of file colorInterpolationManager.h.


Constructor & Destructor Documentation

ColorInterpolationSegment::ColorInterpolationSegment ( ColorInterpolationFunction function,
const PN_stdfloat &  time_begin,
const PN_stdfloat &  time_end,
const bool  is_modulated,
const int  id 
)

constructor

Definition at line 199 of file colorInterpolationManager.cxx.

copy constructor

Definition at line 220 of file colorInterpolationManager.cxx.

destructor

Definition at line 237 of file colorInterpolationManager.cxx.


Member Function Documentation

Returns a reference to the function object corresponding to this segment.

Definition at line 138 of file colorInterpolationManager.I.

int ColorInterpolationSegment::get_id ( ) const [inline]

Returns the id assigned to this segment by the manager that created it.

Definition at line 198 of file colorInterpolationManager.I.

PN_stdfloat ColorInterpolationSegment::get_time_begin ( ) const [inline]

Returns the point in the particle's lifetime at which this segment begins its effect.

It is an interpolated value in the range [0,1].

Definition at line 151 of file colorInterpolationManager.I.

Referenced by ColorInterpolationManager::generateColor().

PN_stdfloat ColorInterpolationSegment::get_time_end ( ) const [inline]

Returns the point in the particle's lifetime at which this segment's effect stops.

It is an interpolated value in the range [0,1].

Definition at line 164 of file colorInterpolationManager.I.

Referenced by ColorInterpolationManager::generateColor().

LColor ColorInterpolationSegment::interpolateColor ( const PN_stdfloat  t) const

Returns the interpolated color according to the segment's function and start and end times.

't' is a value in [0-1] where corresponds to beginning of the segment and 1 corresponds to the end.

Definition at line 250 of file colorInterpolationManager.cxx.

Referenced by ColorInterpolationManager::generateColor().

bool ColorInterpolationSegment::is_enabled ( ) const [inline]

Returns whether the segments effects are being applied.

Definition at line 186 of file colorInterpolationManager.I.

Referenced by ColorInterpolationManager::generateColor().

bool ColorInterpolationSegment::is_modulated ( ) const [inline]

Returns whether the function is additive or modulated.

Definition at line 175 of file colorInterpolationManager.I.

Referenced by ColorInterpolationManager::generateColor().

void ColorInterpolationSegment::set_enabled ( const bool  enabled) [inline]

Sets whether the segments effects should be applied.

Definition at line 262 of file colorInterpolationManager.I.

Sets the function that the segment will use for its interpolation calculations.

Definition at line 210 of file colorInterpolationManager.I.

void ColorInterpolationSegment::set_is_modulated ( const bool  flag) [inline]

Sets how the function is applied to the final color.

If true, the value is multiplied. If false, the value is simply added. Default is true.

Definition at line 251 of file colorInterpolationManager.I.

void ColorInterpolationSegment::set_time_begin ( const PN_stdfloat  time) [inline]

Sets the point in the particle's lifetime at which this segment begins its effect.

It is an interpolated value in the range [0,1].

Definition at line 223 of file colorInterpolationManager.I.

void ColorInterpolationSegment::set_time_end ( const PN_stdfloat  time) [inline]

Sets the point in the particle's lifetime at which this segment's effect ends.

It is an interpolated value in the range [0,1].

Definition at line 237 of file colorInterpolationManager.I.


The documentation for this class was generated from the following files:
 All Classes Functions Variables Enumerations