14 #ifndef COLORINTERPOLATIONMANAGER_H 15 #define COLORINTERPOLATIONMANAGER_H 35 virtual LColor interpolate(
const PN_stdfloat t = 0)
const = 0;
42 static void init_type() {
43 TypedReferenceCount::init_type();
45 TypedReferenceCount::get_class_type());
49 return get_class_type();
51 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
62 INLINE LColor get_color_a()
const;
64 INLINE
void set_color_a(
const LColor &c);
71 virtual LColor interpolate(
const PN_stdfloat t = 0)
const;
81 static void init_type() {
82 ColorInterpolationFunction::init_type();
83 register_type(_type_handle,
"ColorInterpolationFunctionConstant",
84 ColorInterpolationFunction::get_class_type());
88 return get_class_type();
90 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
101 INLINE LColor get_color_b()
const;
103 INLINE
void set_color_b(
const LColor &c);
110 LColor interpolate(
const PN_stdfloat t = 0)
const;
120 static void init_type() {
121 ColorInterpolationFunctionConstant::init_type();
122 register_type(_type_handle,
"ColorInterpolationFunctionLinear",
123 ColorInterpolationFunctionConstant::get_class_type());
127 return get_class_type();
129 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
143 INLINE PN_stdfloat get_width_a()
const;
144 INLINE PN_stdfloat get_width_b()
const;
146 INLINE
void set_width_a(
const PN_stdfloat w);
147 INLINE
void set_width_b(
const PN_stdfloat w);
154 LColor interpolate(
const PN_stdfloat t = 0)
const;
165 static void init_type() {
166 ColorInterpolationFunctionLinear::init_type();
167 register_type(_type_handle,
"ColorInterpolationFunctionStepwave",
168 ColorInterpolationFunctionLinear::get_class_type());
172 return get_class_type();
174 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
188 INLINE PN_stdfloat get_period()
const;
190 INLINE
void set_period(
const PN_stdfloat p);
197 LColor interpolate(
const PN_stdfloat t = 0)
const;
207 static void init_type() {
208 ColorInterpolationFunctionLinear::init_type();
209 register_type(_type_handle,
"ColorInterpolationFunctionSinusoid",
210 ColorInterpolationFunctionLinear::get_class_type());
214 return get_class_type();
216 virtual TypeHandle force_init_type() {init_type();
return get_class_type();}
238 INLINE PN_stdfloat get_time_begin()
const;
239 INLINE PN_stdfloat get_time_end()
const;
240 INLINE
bool is_modulated()
const;
241 INLINE
int get_id()
const;
242 INLINE
bool is_enabled()
const;
245 INLINE
void set_time_begin(
const PN_stdfloat time);
246 INLINE
void set_time_end(
const PN_stdfloat time);
247 INLINE
void set_is_modulated(
const bool flag);
248 INLINE
void set_enabled(
const bool enabled);
251 LColor interpolateColor(
const PN_stdfloat t)
const;
255 PN_stdfloat _t_begin;
257 PN_stdfloat _t_total;
276 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);
277 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);
278 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);
279 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);
281 INLINE
void set_default_color(
const LColor &c);
283 INLINE std::string get_segment_id_list();
284 void clear_segment(
const int seg_id);
285 void clear_to_initial();
288 LColor generateColor(
const PN_stdfloat interpolated_time);
291 LColor _default_color;
298 #endif //COLORINTERPOLATIONMANAGER_H A single unit of interpolation.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
void register_type(TypeHandle &type_handle, const std::string &name)
This inline function is just a convenient way to call TypeRegistry::register_type(), along with zero to four record_derivation()s.
A base class for things which need to inherit from both TypedObject and from ReferenceCount.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
High level class for color interpolation.
Defines a discrete cyclical transition between two colors.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
Defines a sinusoidal blending between two colors.
Abstract class from which all other functions should inherit.
A base class for all things that want to be reference-counted.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
TypeHandle is the identifier used to differentiate C++ class types.
Defines a constant color over the lifetime of the segment.
Defines a linear interpolation over the lifetime of the segment.