Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
CAMP
campvis-public
Commits
75668c09
Commit
75668c09
authored
Sep 04, 2013
by
Christian Schulte zu Berge
Browse files
Further work on RenderData + proof-of-concept implementation in EEPGenerator->RaycastingProcessor
parent
dd2a5a3c
Changes
4
Hide whitespace changes
Inline
Side-by-side
core/datastructures/renderdata.cpp
View file @
75668c09
...
...
@@ -29,6 +29,7 @@
#include
"renderdata.h"
#include
"tgt/framebufferobject.h"
#include
"tgt/textureunit.h"
#include
"tgt/shadermanager.h"
...
...
@@ -46,6 +47,25 @@ namespace campvis {
}
RenderData
::
RenderData
(
const
tgt
::
FramebufferObject
*
fbo
)
:
AbstractData
()
,
_depthTexture
(
0
)
{
tgt
::
Texture
*
const
*
const
attachments
=
fbo
->
getAttachments
();
for
(
size_t
i
=
0
;
i
<
TGT_FRAMEBUFFEROBJECT_MAX_SUPPORTED_COLOR_ATTACHMENTS
;
++
i
)
{
if
(
attachments
[
i
]
!=
0
)
{
ImageData
*
img
=
new
ImageData
(
2
,
attachments
[
i
]
->
getDimensions
(),
attachments
[
i
]
->
getNumChannels
());
ImageRepresentationGL
*
rep
=
ImageRepresentationGL
::
create
(
img
,
attachments
[
i
]);
_colorTextures
.
push_back
(
DataHandle
(
img
));
}
}
if
(
attachments
[
TGT_FRAMEBUFFEROBJECT_MAX_SUPPORTED_COLOR_ATTACHMENTS
]
!=
0
)
{
ImageData
*
img
=
new
ImageData
(
2
,
attachments
[
TGT_FRAMEBUFFEROBJECT_MAX_SUPPORTED_COLOR_ATTACHMENTS
]
->
getDimensions
(),
attachments
[
TGT_FRAMEBUFFEROBJECT_MAX_SUPPORTED_COLOR_ATTACHMENTS
]
->
getNumChannels
());
ImageRepresentationGL
*
rep
=
ImageRepresentationGL
::
create
(
img
,
attachments
[
TGT_FRAMEBUFFEROBJECT_MAX_SUPPORTED_COLOR_ATTACHMENTS
]);
_depthTexture
=
DataHandle
(
img
);
}
}
RenderData
::~
RenderData
()
{
}
...
...
@@ -88,7 +108,7 @@ namespace campvis {
const
ImageData
*
RenderData
::
getColorTexture
(
size_t
index
/*= 0*/
)
const
{
tgtAssert
(
index
<
_colorTextures
.
size
(),
"Index out of bounds."
);
if
(
index
<
_colorTextures
.
size
())
if
(
index
>=
_colorTextures
.
size
())
return
0
;
return
static_cast
<
const
ImageData
*>
(
_colorTextures
[
index
].
getData
());
...
...
@@ -116,7 +136,7 @@ namespace campvis {
void
RenderData
::
bindColorTexture
(
tgt
::
Shader
*
shader
,
const
tgt
::
TextureUnit
&
colorTexUnit
,
const
std
::
string
&
colorTexUniform
/*= "_colorTexture"*/
,
const
std
::
string
&
texParamsUniform
/*= "_texParams"*/
,
size_t
index
/*= 0*/
)
const
{
tgtAssert
(
index
<
_colorTextures
.
size
(),
"Index out of bounds."
);
if
(
index
<
_colorTextures
.
size
())
if
(
index
>=
_colorTextures
.
size
())
return
;
const
ImageData
*
id
=
static_cast
<
const
ImageData
*>
(
_colorTextures
[
index
].
getData
());
...
...
core/datastructures/renderdata.h
View file @
75668c09
...
...
@@ -36,6 +36,7 @@
#include
<vector>
namespace
tgt
{
class
FramebufferObject
;
class
Shader
;
class
TextureUnit
;
}
...
...
@@ -59,6 +60,13 @@ namespace campvis {
*/
RenderData
();
/**
* Constructur, creates RenderData from all textures attached to \a fbo.
* \note Must be called from a valid OpenGL context.
* \param fbo FBO to use textures from.
*/
explicit
RenderData
(
const
tgt
::
FramebufferObject
*
fbo
);
/**
* Destructor
*/
...
...
core/pipeline/raycastingprocessor.cpp
View file @
75668c09
...
...
@@ -34,6 +34,7 @@
#include
"tgt/textureunit.h"
#include
"core/datastructures/imagedata.h"
#include
"core/datastructures/renderdata.h"
#include
"core/datastructures/imagerepresentationrendertarget.h"
...
...
@@ -86,8 +87,8 @@ namespace campvis {
void
RaycastingProcessor
::
process
(
DataContainer
&
data
)
{
ImageRepresentationGL
::
ScopedRepresentation
img
(
data
,
p_sourceImageID
.
getValue
());
ImageRepresentationRenderTarget
::
ScopedRepresentation
entryPoints
(
data
,
p_entryImageID
.
getValue
());
ImageRepresentationRenderTarget
::
ScopedRepresentation
exitPoints
(
data
,
p_exitImageID
.
getValue
());
DataContainer
::
ScopedTypedData
<
RenderData
>
entryPoints
(
data
,
p_entryImageID
.
getValue
());
DataContainer
::
ScopedTypedData
<
RenderData
>
exitPoints
(
data
,
p_exitImageID
.
getValue
());
if
(
img
!=
0
&&
entryPoints
!=
0
&&
exitPoints
!=
0
)
{
if
(
img
->
getDimensionality
()
==
3
)
{
...
...
modules/vis/processors/eepgenerator.cpp
View file @
75668c09
...
...
@@ -37,6 +37,7 @@
#include
"core/datastructures/imagedata.h"
#include
"core/datastructures/imagerepresentationgl.h"
#include
"core/datastructures/imagerepresentationrendertarget.h"
#include
"core/datastructures/renderdata.h"
#include
"core/datastructures/meshgeometry.h"
#include
"core/pipeline/processordecoratormasking.h"
...
...
@@ -186,7 +187,7 @@ namespace campvis {
glCullFace
(
p_enableMirror
.
getValue
()
?
GL_FRONT
:
GL_BACK
);
clipped
.
render
(
GL_POLYGON
);
std
::
pair
<
ImageData
*
,
ImageRepresentationRenderTarget
*>
entrypoints
=
ImageRepresentationRenderTarget
::
createWithImageData
(
_renderTargetSize
.
getValue
(),
_fbo
);
RenderData
*
entrypoints
=
new
RenderData
(
_fbo
);
_fbo
->
detachAll
();
// create exit points texture
...
...
@@ -195,7 +196,7 @@ namespace campvis {
_shader
->
setUniform
(
"_isEntrypoint"
,
false
);
if
(
geometryImage
!=
0
)
{
entrypoints
.
second
->
bindDepthTexture
(
_shader
,
entryDepthUnit
,
"_entryDepthTexture"
,
"_entryDepthTexParams"
);
entrypoints
->
bindDepthTexture
(
_shader
,
entryDepthUnit
,
"_entryDepthTexture"
,
"_entryDepthTexParams"
);
}
glDepthFunc
(
GL_GREATER
);
...
...
@@ -204,7 +205,8 @@ namespace campvis {
glCullFace
(
p_enableMirror
.
getValue
()
?
GL_BACK
:
GL_FRONT
);
clipped
.
render
(
GL_POLYGON
);
std
::
pair
<
ImageData
*
,
ImageRepresentationRenderTarget
*>
exitpoints
=
ImageRepresentationRenderTarget
::
createWithImageData
(
_renderTargetSize
.
getValue
(),
_fbo
);
RenderData
*
exitpoints
=
new
RenderData
(
_fbo
);
//std::pair<ImageData*, ImageRepresentationRenderTarget*> exitpoints = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), _fbo);
decorateRenderEpilog
(
_shader
);
_shader
->
deactivate
();
...
...
@@ -216,8 +218,8 @@ namespace campvis {
LGL_ERROR
;
data
.
addData
(
p_entryImageID
.
getValue
(),
entrypoints
.
first
);
data
.
addData
(
p_exitImageID
.
getValue
(),
exitpoints
.
first
);
data
.
addData
(
p_entryImageID
.
getValue
(),
entrypoints
);
data
.
addData
(
p_exitImageID
.
getValue
(),
exitpoints
);
p_entryImageID
.
issueWrite
();
p_exitImageID
.
issueWrite
();
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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