Commit 94289f81 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Added support for 3x3 matrix images (ImageData with 9 channels, each element is a tgt::mat3)

parent b6a82f71
......@@ -27,6 +27,7 @@
#include "tgt/tgt_gl.h"
#include "tgt/tgt_math.h"
#include "tgt/matrix.h"
#include "tgt/vector.h"
#include "core/datastructures/tensor.h"
#include "core/tools/weaklytypedpointer.h"
......@@ -72,6 +73,11 @@ namespace {
static const GLint glFormat = GL_RGB;
};
template<>
struct TypeTraitsHelperPerChannel<9> {
static const GLint glFormat = GL_RGB;
};
// ================================================================================================
// ================================================================================================
......@@ -130,6 +136,14 @@ namespace {
SPCIALIZE_TTIF(int32_t, 6, GL_RGB32F)
SPCIALIZE_TTIF(float, 6, GL_RGB32F)
SPCIALIZE_TTIF(uint8_t, 9, GL_RGB8)
SPCIALIZE_TTIF(int8_t, 9, GL_RGB8)
SPCIALIZE_TTIF(uint16_t,9, GL_RGB16)
SPCIALIZE_TTIF(int16_t, 9, GL_RGB16)
SPCIALIZE_TTIF(uint32_t,9, GL_RGB32F)
SPCIALIZE_TTIF(int32_t, 9, GL_RGB32F)
SPCIALIZE_TTIF(float, 9, GL_RGB32F)
// ================================================================================================
// ================================================================================================
......@@ -288,6 +302,21 @@ namespace {
}
};
template<typename BASETYPE>
struct TypeTraitsHelperOfBasetypePerChannel<BASETYPE, 9> {
typedef tgt::Matrix3< BASETYPE > ElementType;
static inline BASETYPE getChannel(const ElementType& element, size_t channel) {
tgtAssert(channel >= 0 && channel <= 8, "Channel out of bounds!");
return element.elem[channel];
}
static inline void setChannel(ElementType& element, size_t channel, BASETYPE value) {
tgtAssert(channel >= 0 && channel <= 8, "Channel out of bounds!");
element.elem[channel] = value;
}
};
// ================================================================================================
// ================================================================================================
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment