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.

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 = 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}
int y
Definition simple.h:93
int x
Definition simple.h:92
uint8_t pos
Definition Blur.ino:11
Tile2x2_u8 at_splat_extrapolate(float i) const
fl::u16 mWidth
Definition corkscrew.h:235
fl::span< CRGB > data()
fl::pair< vec2< u16 >, u8 > Entry
Definition tile2x2.h:108
unsigned char u8
Definition int.h:17

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

Referenced by at_wrap(), and initializeCache().

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