#include #include "wrapper/TextureFormat.h" TextureFormat::TextureFormat(GLint internalformat, GLenum format, GLenum type, bool depth) : internalformat(internalformat), format(format), type(type), depth(depth) { } TextureFormat TextureFormat::color8(int channels) { switch(channels) { case 1: return TextureFormat(GL_RED, GL_RED, GL_UNSIGNED_BYTE); case 2: return TextureFormat(GL_RG, GL_RG, GL_UNSIGNED_BYTE); case 3: return TextureFormat(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE); case 4: return TextureFormat(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE); } std::cout << channels << " is not a valid amount of channels\n"; return TextureFormat(GL_RGBA, GL_RGBA, GL_UNSIGNED_BYTE); } TextureFormat TextureFormat::float16(int channels) { switch(channels) { case 1: return TextureFormat(GL_R16F, GL_RED, GL_FLOAT); case 2: return TextureFormat(GL_RG16F, GL_RG, GL_FLOAT); case 3: return TextureFormat(GL_RGB16F, GL_RGB, GL_FLOAT); case 4: return TextureFormat(GL_RGBA16F, GL_RGBA, GL_FLOAT); } std::cout << channels << " is not a valid amount of channels\n"; return TextureFormat(GL_RGBA16F, GL_RGBA, GL_FLOAT); } TextureFormat TextureFormat::float32(int channels) { switch(channels) { case 1: return TextureFormat(GL_R32F, GL_RED, GL_FLOAT); case 2: return TextureFormat(GL_RG32F, GL_RG, GL_FLOAT); case 3: return TextureFormat(GL_RGB32F, GL_RGB, GL_FLOAT); case 4: return TextureFormat(GL_RGBA32F, GL_RGBA, GL_FLOAT); } std::cout << channels << " is not a valid amount of channels\n"; return TextureFormat(GL_RGBA32F, GL_RGBA, GL_FLOAT); } TextureFormat TextureFormat::depth16() { return TextureFormat(GL_DEPTH_COMPONENT16, GL_DEPTH_COMPONENT, GL_FLOAT, true); } TextureFormat TextureFormat::depth32() { return TextureFormat(GL_DEPTH_COMPONENT32, GL_DEPTH_COMPONENT, GL_FLOAT, true); } TextureFormat TextureFormat::unknown() { return TextureFormat(-1, -1, -1, false); }