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

◆ calculateTileAtWrap()

Tile2x2_u8_wrap fl::Corkscrew::calculateTileAtWrap ( float i) const
private

Definition at line 177 of file corkscrew.cpp.hpp.

177 {
178 // This is a splatted pixel, but wrapped around the cylinder.
179 // This is useful for rendering the corkscrew in a cylindrical way.
180 Tile2x2_u8 tile = at_splat_extrapolate(i);
182 vec2<u16> origin = tile.origin();
183 for (fl::u8 x = 0; x < 2; x++) {
184 for (fl::u8 y = 0; y < 2; y++) {
185 // For each pixel in the tile, map it to the cylinder so that each subcomponent
186 // is mapped to the correct position on the cylinder.
187 vec2<u16> pos = origin + vec2<u16>(x, y);
188 // now wrap the x-position
189 pos.x = fl::fmodf(pos.x, static_cast<float>(mWidth));
190 data[x][y] = {pos, tile.at(x, y)};
191 }
192 }
193 return Tile2x2_u8_wrap(data);
194}
uint8_t pos
Definition Blur.ino:11
Tile2x2_u8 at_splat_extrapolate(float i) const
fl::u16 mWidth
Definition corkscrew.h:228
fl::span< CRGB > data()
fl::pair< vec2< u16 >, u8 > Entry
Definition tile2x2.h:103
unsigned char u8
Definition s16x16x4.h:132
float fmodf(float x, float y) FL_NOEXCEPT
Definition math.h:336

References fl::Tile2x2_u8::at(), at_splat_extrapolate(), data(), fl::fmodf(), mWidth, fl::Tile2x2_u8::origin(), pos, fl::x, and fl::y.

Referenced by at_wrap(), and initializeCache().

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