| 185 | ////////////////////////////////////////////////////////////////////////////// |
| 186 | |
| 187 | extern "C" void *Texture2D_create(Vec2i &size, void *data, |
| 188 | uint32_t type, uint32_t flags) |
| 189 | { |
| 190 | Texture2D *self = (Texture2D*) alignedUSMMalloc(sizeof(Texture2D),16); |
| 191 | self->size = size; |
| 192 | |
| 193 | // Due to float rounding frac(x) can be exactly 1.0f (e.g. for very small |
| 194 | // negative x), although it should be strictly smaller than 1.0f. We handle |
| 195 | // this case by having sizef slightly smaller than size, such that |
| 196 | // frac(x)*sizef is always < size. |
| 197 | self->sizef = Vec2f(nextafter((float)size.x, -1.0f), nextafter((float)size.y, -1.0f)); |
| 198 | self->halfTexel = Vec2f(0.5f/size.x, 0.5f/size.y); |
| 199 | self->data = data; |
| 200 | self->get = Texture2D_get_addr(type, flags & TEXTURE_FILTER_NEAREST); |
| 201 | |
| 202 | return self; |
| 203 | } |
| 204 | |
| 205 | } // namespace embree |
nothing calls this directly
no test coverage detected