Currently job artifacts in CI/CD pipelines on LRZ GitLab never expire. Starting from Wed 26.1.2022 the default expiration time will be 30 days (GitLab default). Currently existing artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 75668c09 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Further work on RenderData + proof-of-concept implementation in EEPGenerator->RaycastingProcessor

parent dd2a5a3c
......@@ -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());
......
......@@ -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
*/
......
......@@ -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) {
......
......@@ -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();
}
......
Markdown is supported
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