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...
 
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
 Returns the current reference count. More...
 
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 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...
 
void weak_ref (WeakPointerToVoid *ptv)
 Adds the indicated PointerToVoid as a weak reference to this object. More...
 
void weak_unref (WeakPointerToVoid *ptv)
 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 ()
 

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 283 of file colorInterpolationManager.h.

Constructor & Destructor Documentation

◆ ColorInterpolationManager() [1/3]

ColorInterpolationManager::ColorInterpolationManager ( )

default constructor

Definition at line 261 of file colorInterpolationManager.cxx.

Referenced by ColorInterpolationManager(), and ColorInterpolationSegment::interpolateColor().

◆ ColorInterpolationManager() [2/3]

ColorInterpolationManager::ColorInterpolationManager ( const LColor c)

constructor

Definition at line 273 of file colorInterpolationManager.cxx.

References ColorInterpolationManager().

◆ ColorInterpolationManager() [3/3]

ColorInterpolationManager::ColorInterpolationManager ( const ColorInterpolationManager copy)

copy constructor

Definition at line 285 of file colorInterpolationManager.cxx.

References ~ColorInterpolationManager().

◆ ~ColorInterpolationManager()

ColorInterpolationManager::~ColorInterpolationManager ( )
virtual

destructor

Definition at line 298 of file colorInterpolationManager.cxx.

References add_constant().

Referenced by ColorInterpolationManager().

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 310 of file colorInterpolationManager.cxx.

References add_linear().

Referenced by ~ColorInterpolationManager().

◆ 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 327 of file colorInterpolationManager.cxx.

References add_stepwave().

Referenced by add_constant().

◆ 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 362 of file colorInterpolationManager.cxx.

References clear_segment().

Referenced by add_stepwave().

◆ 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 344 of file colorInterpolationManager.cxx.

References add_sinusoid().

Referenced by add_linear().

◆ clear_segment()

void ColorInterpolationManager::clear_segment ( const int  seg_id)

Removes the segment of 'id' from the manager.

Definition at line 378 of file colorInterpolationManager.cxx.

References clear_to_initial().

Referenced by add_sinusoid().

◆ clear_to_initial()

void ColorInterpolationManager::clear_to_initial ( )

Removes all segments from the manager.

Definition at line 396 of file colorInterpolationManager.cxx.

References generateColor().

Referenced by clear_segment().

◆ 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 411 of file colorInterpolationManager.cxx.

References ColorInterpolationSegment::get_time_begin(), ColorInterpolationSegment::get_time_end(), ColorInterpolationSegment::interpolateColor(), ColorInterpolationSegment::is_enabled(), and ColorInterpolationSegment::is_modulated().

Referenced by clear_to_initial().

◆ get_segment()

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

Returns the segment that corresponds to 'seg_id'.

Definition at line 284 of file colorInterpolationManager.I.

References get_segment_id_list().

Referenced by set_default_color().

◆ get_segment_id_list()

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 302 of file colorInterpolationManager.I.

Referenced by get_segment().

◆ 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 273 of file colorInterpolationManager.I.

References get_segment().

Referenced by ColorInterpolationSegment::set_enabled().


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