Panda3D
Public Member Functions | List of all members
ColorInterpolationManager Class Reference

High level class for color interpolation. More...

#include "colorInterpolationManager.h"

Inheritance diagram for ColorInterpolationManager:
ReferenceCount MemoryBase

Public Member Functions

 ColorInterpolationManager ()
 default constructor More...
 
 ColorInterpolationManager (const LColor &c)
 constructor More...
 
 ColorInterpolationManager (const ColorInterpolationManager &copy)
 copy constructor More...
 
virtual ~ColorInterpolationManager ()
 destructor More...
 
int add_constant (const PN_stdfloat time_begin=0.0f, const PN_stdfloat time_end=1.0f, const LColor &color=LColor(1.0f, 1.0f, 1.0f, 1.0f), const bool is_modulated=true)
 Adds a constant segment of the specified color to the manager and returns the segment's id as known by the manager. More...
 
int add_linear (const PN_stdfloat time_begin=0.0f, const PN_stdfloat time_end=1.0f, const LColor &color_a=LColor(1.0f, 0.0f, 0.0f, 1.0f), const LColor &color_b=LColor(0.0f, 1.0f, 0.0f, 1.0f), const bool is_modulated=true)
 Adds a linear segment between two colors to the manager and returns the segment's id as known by the manager. More...
 
int add_sinusoid (const PN_stdfloat time_begin=0.0f, const PN_stdfloat time_end=1.0f, const LColor &color_a=LColor(1.0f, 0.0f, 0.0f, 1.0f), const LColor &color_b=LColor(0.0f, 1.0f, 0.0f, 1.0f), const PN_stdfloat period=1.0f, const bool is_modulated=true)
 Adds a stepwave segment of two colors and a specified period to the manager and returns the segment's id as known by the manager. More...
 
int add_stepwave (const PN_stdfloat time_begin=0.0f, const PN_stdfloat time_end=1.0f, const LColor &color_a=LColor(1.0f, 0.0f, 0.0f, 1.0f), const LColor &color_b=LColor(0.0f, 1.0f, 0.0f, 1.0f), const PN_stdfloat width_a=0.5f, const PN_stdfloat width_b=0.5f, const bool is_modulated=true)
 Adds a stepwave segment of two colors to the manager and returns the segment's id as known by the manager. More...
 
void clear_segment (const int seg_id)
 Removes the segment of 'id' from the manager. More...
 
void clear_to_initial ()
 Removes all segments from the manager. More...
 
LColor generateColor (const PN_stdfloat interpolated_time)
 For time 'interpolated_time', this returns the additive composite color of all segments that influence that instant in the particle's lifetime. More...
 
ColorInterpolationSegmentget_segment (const int seg_id)
 Returns the segment that corresponds to 'seg_id'. More...
 
std::string get_segment_id_list ()
 Returns a space delimited list of all of the ids in the manager at the time. More...
 
void set_default_color (const LColor &c)
 Sets the color to used if no segments are present. More...
 
- Public Member Functions inherited from ReferenceCount
int get_ref_count () const
 
WeakReferenceListget_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...
 
WeakReferenceListweak_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...
 

Additional Inherited Members

- Static Public Member Functions inherited from ReferenceCount
static TypeHandle get_class_type ()
 
static void init_type ()
 
- Public Attributes inherited from ReferenceCount
 get_ref_count
 Returns the current reference count. More...
 

Detailed Description

High level class for color interpolation.

Segments must be added to the manager in order to achieve results using the "add_*****()" functions. Access to these segments is provided but not necessary general use.

Definition at line 269 of file colorInterpolationManager.h.

Constructor & Destructor Documentation

◆ ColorInterpolationManager() [1/3]

ColorInterpolationManager::ColorInterpolationManager ( )

default constructor

Definition at line 224 of file colorInterpolationManager.cxx.

◆ ColorInterpolationManager() [2/3]

ColorInterpolationManager::ColorInterpolationManager ( const LColor &  c)

constructor

Definition at line 234 of file colorInterpolationManager.cxx.

◆ ColorInterpolationManager() [3/3]

ColorInterpolationManager::ColorInterpolationManager ( const ColorInterpolationManager copy)

copy constructor

Definition at line 244 of file colorInterpolationManager.cxx.

◆ ~ColorInterpolationManager()

ColorInterpolationManager::~ColorInterpolationManager ( )
virtual

destructor

Definition at line 255 of file colorInterpolationManager.cxx.

Member Function Documentation

◆ add_constant()

int ColorInterpolationManager::add_constant ( const PN_stdfloat  time_begin = 0.0f,
const PN_stdfloat  time_end = 1.0f,
const LColor &  color = LColor(1.0f,1.0f,1.0f,1.0f),
const bool  is_modulated = true 
)

Adds a constant segment of the specified color to the manager and returns the segment's id as known by the manager.

Definition at line 264 of file colorInterpolationManager.cxx.

◆ add_linear()

int ColorInterpolationManager::add_linear ( const PN_stdfloat  time_begin = 0.0f,
const PN_stdfloat  time_end = 1.0f,
const LColor &  color_a = LColor(1.0f,0.0f,0.0f,1.0f),
const LColor &  color_b = LColor(0.0f,1.0f,0.0f,1.0f),
const bool  is_modulated = true 
)

Adds a linear segment between two colors to the manager and returns the segment's id as known by the manager.

Definition at line 279 of file colorInterpolationManager.cxx.

◆ add_sinusoid()

int ColorInterpolationManager::add_sinusoid ( const PN_stdfloat  time_begin = 0.0f,
const PN_stdfloat  time_end = 1.0f,
const LColor &  color_a = LColor(1.0f,0.0f,0.0f,1.0f),
const LColor &  color_b = LColor(0.0f,1.0f,0.0f,1.0f),
const PN_stdfloat  period = 1.0f,
const bool  is_modulated = true 
)

Adds a stepwave segment of two colors and a specified period to the manager and returns the segment's id as known by the manager.

Definition at line 309 of file colorInterpolationManager.cxx.

◆ add_stepwave()

int ColorInterpolationManager::add_stepwave ( const PN_stdfloat  time_begin = 0.0f,
const PN_stdfloat  time_end = 1.0f,
const LColor &  color_a = LColor(1.0f,0.0f,0.0f,1.0f),
const LColor &  color_b = LColor(0.0f,1.0f,0.0f,1.0f),
const PN_stdfloat  width_a = 0.5f,
const PN_stdfloat  width_b = 0.5f,
const bool  is_modulated = true 
)

Adds a stepwave segment of two colors to the manager and returns the segment's id as known by the manager.

Definition at line 294 of file colorInterpolationManager.cxx.

◆ clear_segment()

void ColorInterpolationManager::clear_segment ( const int  seg_id)

Removes the segment of 'id' from the manager.

Definition at line 323 of file colorInterpolationManager.cxx.

◆ clear_to_initial()

void ColorInterpolationManager::clear_to_initial ( )

Removes all segments from the manager.

Definition at line 339 of file colorInterpolationManager.cxx.

◆ generateColor()

LColor ColorInterpolationManager::generateColor ( const PN_stdfloat  interpolated_time)

For time 'interpolated_time', this returns the additive composite color of all segments that influence that instant in the particle's lifetime.

If no segments cover that time, the manager's default color is returned.

Definition at line 351 of file colorInterpolationManager.cxx.

◆ get_segment()

ColorInterpolationSegment * ColorInterpolationManager::get_segment ( const int  seg_id)
inline

Returns the segment that corresponds to 'seg_id'.

Definition at line 227 of file colorInterpolationManager.I.

◆ get_segment_id_list()

std::string ColorInterpolationManager::get_segment_id_list ( )
inline

Returns a space delimited list of all of the ids in the manager at the time.

Definition at line 243 of file colorInterpolationManager.I.

◆ set_default_color()

void ColorInterpolationManager::set_default_color ( const LColor &  c)
inline

Sets the color to used if no segments are present.

Definition at line 218 of file colorInterpolationManager.I.


The documentation for this class was generated from the following files: