| 175 | } |
| 176 | |
| 177 | Tile2x2_u8_wrap Corkscrew::calculateTileAtWrap(float i) const { |
| 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); |
| 181 | Tile2x2_u8_wrap::Entry data[2][2]; |
| 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 | } |
| 195 | |
| 196 | void Corkscrew::setCachingEnabled(bool enabled) { |
| 197 | if (!enabled && mCachingEnabled) { |
nothing calls this directly
no test coverage detected