|
@@ -1,54 +1,41 @@
|
|
|
+#include <iostream>
|
|
|
+
|
|
|
#include "wrapper/TextureFormat.h"
|
|
|
|
|
|
TextureFormat::TextureFormat(GLint internalformat, GLenum format, GLenum type, bool depth) :
|
|
|
internalformat(internalformat), format(format), type(type), depth(depth) {
|
|
|
}
|
|
|
|
|
|
-TextureFormat TextureFormat::color1() {
|
|
|
- return TextureFormat(GL_RED, GL_RED, GL_UNSIGNED_BYTE);
|
|
|
-}
|
|
|
-
|
|
|
-TextureFormat TextureFormat::color2() {
|
|
|
- return TextureFormat(GL_RG, GL_RG, GL_UNSIGNED_BYTE);
|
|
|
-}
|
|
|
-
|
|
|
-TextureFormat TextureFormat::color3() {
|
|
|
- return TextureFormat(GL_RGB, GL_RGB, GL_UNSIGNED_BYTE);
|
|
|
-}
|
|
|
-
|
|
|
-TextureFormat TextureFormat::color4() {
|
|
|
+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() {
|
|
|
- return TextureFormat(GL_R16F, GL_RED, GL_FLOAT);
|
|
|
-}
|
|
|
-
|
|
|
-TextureFormat TextureFormat::float32() {
|
|
|
- return TextureFormat(GL_R32F, GL_RED, GL_FLOAT);
|
|
|
-}
|
|
|
-
|
|
|
-TextureFormat TextureFormat::float16Vector2() {
|
|
|
- return TextureFormat(GL_RG16F, GL_RG, GL_FLOAT);
|
|
|
-}
|
|
|
-
|
|
|
-TextureFormat TextureFormat::float16Vector3() {
|
|
|
- return TextureFormat(GL_RGB16F, GL_RGB, GL_FLOAT);
|
|
|
-}
|
|
|
-
|
|
|
-TextureFormat TextureFormat::float16Vector4() {
|
|
|
+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::float32Vector2() {
|
|
|
- return TextureFormat(GL_RG32F, GL_RG, GL_FLOAT);
|
|
|
-}
|
|
|
-
|
|
|
-TextureFormat TextureFormat::float32Vector3() {
|
|
|
- return TextureFormat(GL_RGB32F, GL_RGB, GL_FLOAT);
|
|
|
-}
|
|
|
-
|
|
|
-TextureFormat TextureFormat::float32Vector4() {
|
|
|
+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);
|
|
|
}
|
|
|
|