FastLED 3.10.8
Loading...
Searching...
No Matches

◆ render_value()

FASTLED_FORCE_INLINE float fl::render_value ( render_parameters & animation)

Definition at line 104 of file engine_core.h.

104 {
105 // Convert polar coordinates back to cartesian ones
106 float newx = (animation.offset_x + animation.center_x -
107 (FL_COS_F(animation.angle) * animation.dist)) *
108 animation.scale_x;
109 float newy = (animation.offset_y + animation.center_y -
110 (FL_SIN_F(animation.angle) * animation.dist)) *
111 animation.scale_y;
112 float newz = (animation.offset_z + animation.z) * animation.scale_z;
113
114 // Render noise value at this new cartesian point
115 float raw_noise_field_value = pnoise(newx, newy, newz);
116
117 // Enhance histogram (improve contrast) by setting black and white point
118 if (raw_noise_field_value < animation.low_limit)
119 raw_noise_field_value = animation.low_limit;
120 if (raw_noise_field_value > animation.high_limit)
121 raw_noise_field_value = animation.high_limit;
122
123 float scaled_noise_value =
124 map_float(raw_noise_field_value, animation.low_limit,
125 animation.high_limit, 0, 255);
126
127 return scaled_noise_value;
128}
#define FL_SIN_F(x)
Definition engine_core.h:18
#define FL_COS_F(x)
Definition engine_core.h:19
FASTLED_FORCE_INLINE float pnoise(float x, float y, float z) FL_NO_EXCEPT
FASTLED_FORCE_INLINE float map_float(float x, float in_min, float in_max, float out_min, float out_max) FL_NO_EXCEPT
Definition engine_core.h:91

References FASTLED_FORCE_INLINE, FL_COS_F, FL_NO_EXCEPT, FL_SIN_F, map_float(), and pnoise().

Referenced by fl::Engine::render_value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function: