Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
94289f81
Commit
94289f81
authored
Dec 30, 2013
by
Christian Schulte zu Berge
Browse files
Added support for 3x3 matrix images (ImageData with 9 channels, each element is a tgt::mat3)
parent
b6a82f71
Changes
1
Hide whitespace changes
Inline
Side-by-side
core/tools/typetraits.h
View file @
94289f81
...
...
@@ -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
;
}
};
// ================================================================================================
// ================================================================================================
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment