Commit 65d0afb9 authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Introducing StrainFiberRenderer

parent 7158c86a
......@@ -11,6 +11,7 @@ FILE(GLOB ThisModSources RELATIVE ${ModulesDir}
FILE(GLOB ThisModHeaders RELATIVE ${ModulesDir}
modules/columbia/datastructures/*.h
modules/columbia/glsl/*.frag
modules/columbia/glsl/*.geom
modules/columbia/glsl/*.vert
modules/columbia/pipelines/*.h
modules/columbia/processors/*.h
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
#include "tools/shading.frag"
#include "tools/texture3d.frag"
in vec3 geom_Normal; ///< incoming texture coordinate
in vec4 geom_Position;
in vec4 geom_Color;
in float geom_SineFlag;
out vec4 out_Color; ///< outgoing fragment color
uniform vec4 _color;
uniform LightSource _lightSource;
uniform vec3 _cameraPosition;
const float PI = 3.1415926535897932384626433832795;
/**
* Calculate Phong terms for simple OpenGL line primitives according to
* the work of Zöckler, Stalling and Hege in "Interactive Visualization Of
* 3D-Vector Fields Using Illuminated Stream Lines", from 1996.
*/
vec3 phongShadingForLines(vec3 tangent, vec3 view, vec3 light, float shininess) {
// normalize the vectors again which are interpolated per pixel and are
// therefore different for each fragment when transfered from vertex to
// fragment shader!
// light does not need to be re-normalized, as it remains the same for
// all fragments.
//
vec3 t = normalize(tangent); // normalize again as the normal is interpolated per pixel!
vec3 v = normalize(view); // the same for the view vector: it is interpolated per pixel!
float LdotT = clamp(dot(light, t), -1.0, 1.0);
float NdotL = max(sqrt(1.0 - (LdotT * LdotT)), 0.0);
float VdotT = clamp(dot(v, t), -1.0, 1.0);
float VdotN = max(sqrt(1.0 - (VdotT * VdotT)), 0.0);
float RdotV = (LdotT * VdotT) - (NdotL * VdotN);
float specular = max(pow(RdotV, shininess), 0.0);
//const float p = 2.0;
const float p = 4.8;
return vec3(1.0, pow(NdotL, p), specular);
}
vec3 phongShadingForFaces(vec3 normal, vec3 view, vec3 light, float shininess) {
vec3 n = normalize(normal);
vec3 v = normalize(view);
vec3 l = normalize(light);
const float p = 4.8;
float NdotL = max(dot(n, l), 0.0);
vec3 halfVector = normalize(v+l);
float NdotH = max(dot(n, halfVector), 0.0);
return vec3(1.0, pow(NdotL, p), pow(NdotH, shininess));
}
/**
* Applies tube-like texture to triangle strip
*/
vec4 applyTubeTexture(vec3 color) {
float val = max(sin(geom_SineFlag * PI), .4f);
return vec4(color*(val + pow(val, 16.f)), geom_Color.a);
}
void main() {
vec4 color = applyTubeTexture(geom_Color.rbg);//vec4(geom_Normal, 1.0);
out_Color = color;
#ifdef ENABLE_SHADING
// compute tangent (needed for shading and normals)
//vec3 tangent = geom_Normal.rgb;
//vec3 phongTerms = phongShadingForLines(tangent, (geom_Position.xyz / geom_Position.z) - _cameraPosition, _lightSource._position, _lightSource._shininess);
//out_Color.rbg = (color.rbg * _lightSource._ambientColor) + (color.rbg * _lightSource._diffuseColor * phongTerms.y) + (color.rbg * _lightSource._specularColor * phongTerms.z);
out_Color.rgb = calculatePhongShading(geom_Position.xyz / geom_Position.z, _lightSource, _cameraPosition, geom_Normal, color.rgb, color.rgb, vec3(1.0, 1.0, 1.0));
#endif
}
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
layout (lines) in;
layout (triangle_strip, max_vertices = 4) out;
in vec3 vert_TexCoord[]; ///< incoming texture coordinate
in vec4 vert_Position[];
in vec4 vert_Color[];
out vec3 geom_Normal;
out vec4 geom_Position;
out vec4 geom_Color; ///< outgoing fragment color
out float geom_SineFlag;
uniform vec3 _cameraPosition;
uniform float _fiberWidth;
void main() {
vec4 displacement[2];
vec3 normal[2];
for (int i = 0; i < 2; ++i) {
// compute normal
normal[i] = normalize((vert_Position[i].xyz / vert_Position[i].w) - _cameraPosition);
// gather displacement vector from tangent vector (stored in normal vector)
displacement[i] = normalize(vec4(cross(normal[i], vert_TexCoord[i]), 0.0));
displacement[i] *= _fiberWidth;
}
geom_Color = vec4(vert_TexCoord[0], 1.0);
geom_Position = vert_Position[0] + displacement[0];
geom_Normal = normal[0];
geom_SineFlag = 0.0;
gl_Position = geom_Position;
EmitVertex();
geom_Position = vert_Position[0] - displacement[0];
geom_Normal = normal[0];
geom_SineFlag = 1.0;
gl_Position = geom_Position;
EmitVertex();
geom_Color = vec4(vert_TexCoord[1], 1.0);
geom_Position = vert_Position[1] + displacement[1];
geom_Normal = normal[1];
geom_SineFlag = 0.0;
gl_Position = geom_Position;
EmitVertex();
geom_Position = vert_Position[1] - displacement[1];
geom_Normal = normal[1];
geom_SineFlag = 1.0;
gl_Position = geom_Position;
EmitVertex();
EndPrimitive();
}
\ No newline at end of file
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
in vec3 in_Position; ///< incoming vertex position
in vec3 in_TexCoord; ///< incoming texture coordinate
in vec4 in_Color; ///< incoming color
out vec3 vert_TexCoord; ///< outgoing texture coordinate
out vec4 vert_Color; ///< outgoing color
out vec4 vert_Position; ///< outgoing world coordinates
/// Matrix defining model-to-world transformation
uniform mat4 _modelMatrix = mat4(
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);
/// Matrix defining view transformation
uniform mat4 _viewMatrix = mat4(
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);
/// Matrix defining projection transformation
uniform mat4 _projectionMatrix = mat4(
1.0, 0.0, 0.0, 0.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0);
void main() {
vert_Position = _projectionMatrix * (_viewMatrix * (_modelMatrix * vec4(in_Position, 1.0)));
gl_Position = vert_Position;
vert_TexCoord = in_TexCoord;
vert_Color = in_Color;
}
......@@ -42,6 +42,7 @@ namespace campvis {
Columbia1::Columbia1()
: VisualizationPipeline()
, _camera("camera", "Camera")
, _boundsData("BoundsData", "Bounds Data", "sfr", DataNameProperty::READ)
, _imageReader()
, _vtkReader()
, _vr(_effectiveRenderTargetSize)
......@@ -49,9 +50,11 @@ namespace campvis {
, _src(_effectiveRenderTargetSize)
, _gr(_effectiveRenderTargetSize)
, _sft()
, _sfr(_effectiveRenderTargetSize)
, _trackballEH(0)
{
addProperty(&_camera);
addProperty(&_boundsData);
_trackballEH = new TrackballNavigationEventHandler(this, &_camera, _canvasSize.getValue());
_eventHandlers.push_back(_trackballEH);
......@@ -64,6 +67,7 @@ namespace campvis {
addProcessor(&_sr);
addProcessor(&_gr);
addProcessor(&_sft);
addProcessor(&_sfr);
}
Columbia1::~Columbia1() {
......@@ -78,11 +82,12 @@ namespace campvis {
_camera.addSharedProperty(&_vr.p_camera);
_camera.addSharedProperty(&_src.p_camera);
_camera.addSharedProperty(&_gr.p_camera);
_camera.addSharedProperty(&_sfr.p_camera);
_vr.p_outputImage.setValue("vr");
_sr.p_targetImageID.setValue("sr");
_src.p_targetImageID.setValue("src");
_renderTargetID.setValue("sr");
_renderTargetID.setValue("sfr");
_imageReader.p_url.setValue("D:/Medical Data/Columbia/outputs/FullVolumeLV_3D_25Hz_[IM_0004]_NIF_crop_flow_field_00_00.ltf");
_imageReader.p_size.setValue(tgt::ivec3(224, 176, 208));
......@@ -108,6 +113,9 @@ namespace campvis {
_gr.p_renderTargetID.setValue("gr");
_sft.p_outputID.setValue("fibers");
_sft.p_outputID.connect(&_sfr.p_strainId);
_sfr.p_renderTargetID.setValue("sfr");
_trackballEH->setViewportSize(_effectiveRenderTargetSize.getValue());
_effectiveRenderTargetSize.s_changed.connect<Columbia1>(this, &Columbia1::onRenderTargetSizeChanged);
......@@ -146,4 +154,5 @@ namespace campvis {
}
}
\ No newline at end of file
......@@ -40,6 +40,7 @@
#include "modules/columbia/processors/geometrystrainrenderer.h"
#include "modules/columbia/processors/imageseriessplitter.h"
#include "modules/columbia/processors/strainfibertracker.h"
#include "modules/columbia/processors/strainfiberrenderer.h"
#include "modules/columbia/processors/strainraycaster.h"
#include "modules/vis/processors/geometryrenderer.h"
#include "modules/vis/processors/sliceextractor.h"
......@@ -79,6 +80,7 @@ namespace campvis {
virtual void onProcessorValidated(AbstractProcessor* processor);
CameraProperty _camera;
DataNameProperty _boundsData;
LtfImageReader _imageReader;
VtkImageReader _vtkReader;
......@@ -89,6 +91,7 @@ namespace campvis {
GeometryRenderer _gr;
StrainFiberTracker _sft;
StrainFiberRenderer _sfr;
TrackballNavigationEventHandler* _trackballEH;
......
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universitt Mnchen
// Boltzmannstr. 3, 85748 Garching b. Mnchen, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
#include "strainfiberrenderer.h"
#include "tgt/glmath.h"
#include "tgt/logmanager.h"
#include "tgt/shadermanager.h"
#include "tgt/textureunit.h"
#include "modules/columbia/datastructures/fiberdata.h"
#include "core/datastructures/imagedata.h"
#include "core/datastructures/imagerepresentationgl.h"
#include "core/datastructures/imagerepresentationrendertarget.h"
#include "core/datastructures/meshgeometry.h"
#include "core/pipeline/processordecoratorshading.h"
namespace campvis {
const std::string StrainFiberRenderer::loggerCat_ = "CAMPVis.modules.vis.StrainFiberRenderer";
StrainFiberRenderer::StrainFiberRenderer(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
, p_strainId("StrainDataId", "Input Strain Data ID", "gr.strain", DataNameProperty::READ)
, p_renderTargetID("p_renderTargetID", "Output Image", "gr.output", DataNameProperty::WRITE)
, p_camera("Camera", "Camera ID")//, "camera", DataNameProperty::READ, AbstractProcessor::INVALID_RESULT, DataNameProperty::CameraData)
, p_lineWidth("LineWidth", "Line width", 3.f, .5f, 10.f)
, p_color("color", "Rendering Color", tgt::vec4(1.f), tgt::vec4(0.f), tgt::vec4(1.f))
, _shader(0)
{
addDecorator(new ProcessorDecoratorShading());
addProperty(&p_strainId);
addProperty(&p_renderTargetID);
addProperty(&p_camera);
addProperty(&p_color);
addProperty(&p_lineWidth);
decoratePropertyCollection(this);
}
StrainFiberRenderer::~StrainFiberRenderer() {
}
void StrainFiberRenderer::init() {
VisualizationProcessor::init();
_shader = ShdrMgr.loadSeparate("modules/columbia/glsl/strainfiberrenderer.vert", "modules/columbia/glsl/strainfiberrenderer.geom", "modules/columbia/glsl/strainfiberrenderer.frag", "", false);
if (_shader != 0) {
_shader->setAttributeLocation(0, "in_Position");
_shader->setAttributeLocation(1, "in_TexCoord");
}
}
void StrainFiberRenderer::deinit() {
ShdrMgr.dispose(_shader);
_shader = 0;
VisualizationProcessor::deinit();
}
void StrainFiberRenderer::process(DataContainer& data) {
DataContainer::ScopedTypedData<FiberData> strainData(data, p_strainId.getValue());
if (strainData != 0 && _shader != 0) {
if (hasInvalidShader()) {
_shader->setHeaders(generateGlslHeader());
_shader->rebuild();
validate(INVALID_SHADER);
}
const tgt::Camera& camera = p_camera.getValue();
// set modelview and projection matrices
_shader->activate();
_shader->setIgnoreUniformLocationError(true);
decorateRenderProlog(data, _shader);
_shader->setUniform("_projectionMatrix", camera.getProjectionMatrix());
_shader->setUniform("_viewMatrix", camera.getViewMatrix());
_shader->setUniform("_cameraPosition", camera.getPosition());
_shader->setUniform("_fiberWidth", p_lineWidth.getValue());
_shader->setIgnoreUniformLocationError(false);
// create entry points texture
std::pair<ImageData*, ImageRepresentationRenderTarget*> rt = ImageRepresentationRenderTarget::createWithImageData(_renderTargetSize.getValue(), GL_RGBA16);
rt.second->activate();
glEnable(GL_DEPTH_TEST);
glDepthFunc(GL_LESS);
glClearDepth(1.0f);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLineWidth(p_lineWidth.getValue());
strainData->render();
glLineWidth(1.f);
rt.second->deactivate();
decorateRenderEpilog(_shader);
_shader->deactivate();
glDisable(GL_DEPTH_TEST);
LGL_ERROR;
data.addData(p_renderTargetID.getValue(), rt.first);
p_renderTargetID.issueWrite();
}
else {
LERROR("No suitable input geometry found.");
}
validate(INVALID_RESULT);
}
std::string StrainFiberRenderer::generateGlslHeader() const {
std::string toReturn = getDecoratedHeader();
return toReturn;
}
}
// ================================================================================================
//
// This file is part of the CAMPVis Software Framework.
//
// If not explicitly stated otherwise: Copyright (C) 2012, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures
// Technische Universität München
// Boltzmannstr. 3, 85748 Garching b. München, Germany
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
//
// The licensing of this softare is not yet resolved. Until then, redistribution in source or
// binary forms outside the CAMP chair is not permitted, unless explicitly stated in legal form.
// However, the names of the original authors and the above copyright notice must retain in its
// original state in any case.
//
// Legal disclaimer provided by the BSD license:
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
// AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
// CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
// OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
// POSSIBILITY OF SUCH DAMAGE.
//
// ================================================================================================
#ifndef STRAINFIBERRENDERER_H__
#define STRAINFIBERRENDERER_H__
#include <string>
#include "core/pipeline/visualizationprocessor.h"
#include "core/pipeline/abstractprocessordecorator.h"
#include "core/properties/datanameproperty.h"
#include "core/properties/genericproperty.h"
#include "core/properties/numericproperty.h"
#include "core/properties/cameraproperty.h"
namespace tgt {
class Shader;
}
namespace campvis {
/**
* Renders Strain Fibers
*/
class StrainFiberRenderer : public VisualizationProcessor, public HasProcessorDecorators {
public:
/**
* Constructs a new StrainFiberRenderer Processor
**/
StrainFiberRenderer(IVec2Property& canvasSize);
/**
* Destructor
**/
virtual ~StrainFiberRenderer();
/// \see AbstractProcessor::init
virtual void init();
/// \see AbstractProcessor::deinit
virtual void deinit();
/// \see AbstractProcessor::getName()
virtual const std::string getName() const { return "StrainFiberRenderer"; };
/// \see AbstractProcessor::getDescription()
virtual const std::string getDescription() const { return "Renders Strain Fibers"; };
virtual void process(DataContainer& data);
DataNameProperty p_strainId; ///< ID for input strain data
DataNameProperty p_renderTargetID; ///< image ID for output image
CameraProperty p_camera;
FloatProperty p_lineWidth;
Vec4Property p_color; ///< rendering color
protected:
/**
* Generates the GLSL header.
*/
std::string generateGlslHeader() const;
tgt::Shader* _shader; ///< Shader for EEP generation
static const std::string loggerCat_;
};
}
#endif // STRAINFIBERRENDERER_H__
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