| 71 | return glm::vec4(mem[0], mem[1], mem[2], mem[3]); |
| 72 | } |
| 73 | glm::vec4 Texture::TexelFetch(int u, int v, int w, int mip) |
| 74 | { |
| 75 | if (m_isInvalid()) |
| 76 | return glm::vec4(1.0f); |
| 77 | |
| 78 | // clamp (TODO: wrap) |
| 79 | u = std::min(Width, std::max(0, w)); |
| 80 | v = std::min(Height, std::max(0, v)); |
| 81 | w = std::min(Depth, std::max(0, w)); |
| 82 | |
| 83 | // clamp mipmap level |
| 84 | mip = std::min(MipmapLevels, std::max(0, mip)); |
| 85 | |
| 86 | float* mem = &Data[mip][(u + Width * (v + Depth * w)) * 4]; |
| 87 | |
| 88 | return glm::vec4(mem[0], mem[1], mem[2], mem[3]); |
| 89 | } |
| 90 | void Texture::m_cleanup() |
| 91 | { |
| 92 | if (Data != nullptr) { |
no outgoing calls
no test coverage detected