FastLED 3.9.15
Loading...
Searching...
No Matches

◆ render_value()

FASTLED_FORCE_INLINE float fl::render_value ( render_parameters & animation)

Definition at line 103 of file engine_core.h.

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

References fl::render_parameters::angle, fl::render_parameters::center_x, fl::render_parameters::center_y, fl::render_parameters::dist, FASTLED_FORCE_INLINE, FL_COS_F, FL_SIN_F, fl::render_parameters::high_limit, fl::render_parameters::low_limit, map_float(), fl::render_parameters::offset_x, fl::render_parameters::offset_y, fl::render_parameters::offset_z, pnoise(), fl::render_parameters::scale_x, fl::render_parameters::scale_y, fl::render_parameters::scale_z, and fl::render_parameters::z.

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

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