Panda3D

Loading...
Searching...
No Matches
Public Member Functions | List of all members
ColorInterpolationManager Class Reference

High level class for color interpolation. More...

`#include "colorInterpolationManager.h"`

Inheritance diagram for ColorInterpolationManager:

## Public Member Functions
| ColorInterpolationManager ()
| default constructor
| ColorInterpolationManager (const ColorInterpolationManager &copy)
| copy constructor
| ColorInterpolationManager (const LColor &c)
| constructor
virtual | ~ColorInterpolationManager ()
| destructor
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.
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.
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.
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.
void | clear_segment (const int seg_id)
| Removes the segment of 'id' from the manager.
void | clear_to_initial ()
| Removes all segments from the manager.
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.
ColorInterpolationSegment * | get_segment (const int seg_id)
| Returns the segment that corresponds to 'seg_id'.
std::string | get_segment_id_list ()
| Returns a space delimited list of all of the ids in the manager at the time.
void | set_default_color (const LColor &c)
| Sets the color to used if no segments are present.
Public Member Functions inherited from ReferenceCount
int | get_ref_count () const
WeakReferenceList * | get_weak_list () const
| Returns the WeakReferenceList associated with this ReferenceCount object.
bool | has_weak_list () const
| Returns true if this particular ReferenceCount object has a WeakReferenceList created, false otherwise.
void | local_object ()
| This function should be called, once, immediately after creating a new instance of some ReferenceCount-derived object on the stack.
void | ref () const
| Explicitly increments the reference count.
bool | ref_if_nonzero () const
| Atomically increases the reference count of this object if it is not zero.
bool | test_ref_count_integrity () const
| Does some easy checks to make sure that the reference count isn't completely bogus.
bool | test_ref_count_nonzero () const
| Does some easy checks to make sure that the reference count isn't zero, or completely bogus.
virtual bool | unref () const
| Explicitly decrements the reference count.
bool | unref_if_one () const
| Atomically decreases the reference count of this object if it is one.
WeakReferenceList * | weak_ref ()
| Adds the indicated PointerToVoid as a weak reference to this object.
void | weak_unref ()
| Removes the indicated PointerToVoid as a weak reference to this object.
Public Member Functions inherited from MemoryBase
void | operator delete (void *, void *)
void | operator delete (void *ptr)
void | operator delete[] (void *, void *)
void | operator delete[] (void *ptr)
void * | operator new (size_t size)
void * | operator new (size_t size, void *ptr)
void * | operator new[] (size_t size)
void * | operator new[] (size_t size, void *ptr)

## 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.

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

Referenced by ColorInterpolationManager().

## ◆ ColorInterpolationManager() [2/3]

ColorInterpolationManager::ColorInterpolationManager | ( | const LColor & | c | ) |

constructor

Definition at line 233 of file colorInterpolationManager.cxx.

## ◆ ColorInterpolationManager() [3/3]

ColorInterpolationManager::ColorInterpolationManager | ( | const ColorInterpolationManager & | copy | ) |

copy constructor

Definition at line 243 of file colorInterpolationManager.cxx.

References ColorInterpolationManager().

## ◆ ~ColorInterpolationManager()

ColorInterpolationManager::~ColorInterpolationManager | ( |  | ) |
| virtual

destructor

Definition at line 254 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 263 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 278 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 308 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 293 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 322 of file colorInterpolationManager.cxx.

## ◆ clear_to_initial()

void ColorInterpolationManager::clear_to_initial | ( |  | ) |

Removes all segments from the manager.

Definition at line 338 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 350 of file colorInterpolationManager.cxx.

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

## ◆ get_segment()

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

Returns the segment that corresponds to 'seg_id'.

Definition at line 226 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 242 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 217 of file colorInterpolationManager.I.

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

- panda/src/particlesystem/colorInterpolationManager.h
- panda/src/particlesystem/colorInterpolationManager.cxx
- panda/src/particlesystem/colorInterpolationManager.I