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

work on #135: changed VisualizationProcessor::_renderTargetSize to pointer and...

work on #135: changed VisualizationProcessor::_renderTargetSize to pointer and introducing VisualizationProcessor::setViewportSizeProperty()
parent 31d6af0f
......@@ -47,7 +47,7 @@ namespace campvis {
/**
* Constructs a new QuadView Processor
**/
QuadView(IVec2Property& canvasSize);
QuadView(IVec2Property* viewportSizeProp);
/**
* Destructor
......
......@@ -51,8 +51,8 @@ namespace campvis {
const std::string RenderTargetCompositor::loggerCat_ = "CAMPVis.modules.vis.RenderTargetCompositor";
RenderTargetCompositor::RenderTargetCompositor(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
RenderTargetCompositor::RenderTargetCompositor(IVec2Property* viewportSizeProp)
: VisualizationProcessor(viewportSizeProp)
, p_firstImageId("FirstImageId", "First Input Image", "", DataNameProperty::READ)
, p_secondImageId("SecondImageId", "Second Input Image", "", DataNameProperty::READ)
, p_targetImageId("TargetImageId", "Output Image", "", DataNameProperty::WRITE)
......
......@@ -61,7 +61,7 @@ namespace campvis {
/**
* Constructs a new RenderTargetCompositor Processor
**/
RenderTargetCompositor(IVec2Property& canvasSize);
RenderTargetCompositor(IVec2Property* viewportSizeProp);
/**
* Destructor
......
......@@ -36,8 +36,8 @@
namespace campvis {
const std::string SimpleRaycaster::loggerCat_ = "CAMPVis.modules.vis.SimpleRaycaster";
SimpleRaycaster::SimpleRaycaster(IVec2Property& canvasSize)
: RaycastingProcessor(canvasSize, "modules/vis/glsl/simpleraycaster.frag", true)
SimpleRaycaster::SimpleRaycaster(IVec2Property* viewportSizeProp)
: RaycastingProcessor(viewportSizeProp, "modules/vis/glsl/simpleraycaster.frag", true)
, p_targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
, p_enableShadowing("EnableShadowing", "Enable Hard Shadows", false, AbstractProcessor::INVALID_SHADER)
, p_shadowIntensity("ShadowIntensity", "Shadow Intensity", .5f, .0f, 1.f)
......
......@@ -52,7 +52,7 @@ namespace campvis {
/**
* Constructs a new SimpleRaycaster Processor
**/
SimpleRaycaster(IVec2Property& canvasSize);
SimpleRaycaster(IVec2Property* viewportSizeProp);
/**
* Destructor
......
......@@ -51,8 +51,8 @@ namespace campvis {
const std::string SliceExtractor::loggerCat_ = "CAMPVis.modules.vis.SliceExtractor";
SliceExtractor::SliceExtractor(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
SliceExtractor::SliceExtractor(IVec2Property* viewportSizeProp)
: VisualizationProcessor(viewportSizeProp)
, p_sourceImageID("sourceImageID", "Input Image", "", DataNameProperty::READ, AbstractProcessor::INVALID_RESULT | AbstractProcessor::INVALID_PROPERTIES)
, p_targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
, p_sliceOrientation("SliceOrientation", "Slice Orientation", compositingOptions, 3)
......@@ -114,7 +114,7 @@ namespace campvis {
// texture coordinate transformation matrix (will be configured later)
tgt::mat4 texCoordsMatrix = tgt::mat4::zero;
float renderTargetRatio = static_cast<float>(_renderTargetSize.getValue().x) / static_cast<float>(_renderTargetSize.getValue().y);
float renderTargetRatio = static_cast<float>(_viewportSizeProperty->getValue().x) / static_cast<float>(_viewportSizeProperty->getValue().y);
float sliceRatio = 1.f;
switch (p_sliceOrientation.getValue()) {
......
......@@ -65,7 +65,7 @@ namespace campvis {
/**
* Constructs a new SliceExtractor Processor
**/
SliceExtractor(IVec2Property& canvasSize);
SliceExtractor(IVec2Property* viewportSizeProp);
/**
* Destructor
......
......@@ -47,8 +47,8 @@
namespace campvis {
const std::string SliceRenderer3D::loggerCat_ = "CAMPVis.modules.vis.SliceRenderer3D";
SliceRenderer3D::SliceRenderer3D(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
SliceRenderer3D::SliceRenderer3D(IVec2Property* viewportSizeProp)
: VisualizationProcessor(viewportSizeProp)
, p_sourceImageID("sourceImageID", "Input Image", "", DataNameProperty::READ)
, p_targetImageID("targetImageID", "Output Image", "", DataNameProperty::WRITE)
, p_camera("Camera", "Camera")
......@@ -108,7 +108,7 @@ namespace campvis {
_shader->activate();
_shader->setIgnoreUniformLocationError(true);
_shader->setUniform("_viewportSizeRCP", 1.f / tgt::vec2(_renderTargetSize.getValue()));
_shader->setUniform("_viewportSizeRCP", 1.f / tgt::vec2(_viewportSizeProperty->getValue()));
_shader->setUniform("_projectionMatrix", cam.getProjectionMatrix());
_shader->setUniform("_viewMatrix", cam.getViewMatrix());
......
......@@ -54,7 +54,7 @@ namespace campvis {
/**
* Constructs a new SliceRenderer3D Processor
**/
SliceRenderer3D(IVec2Property& canvasSize);
SliceRenderer3D(IVec2Property* viewportSizeProp);
/**
* Destructor
......
......@@ -42,8 +42,8 @@
namespace campvis {
const std::string VirtualMirrorCombine::loggerCat_ = "CAMPVis.modules.vis.VirtualMirrorCombine";
VirtualMirrorCombine::VirtualMirrorCombine(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
VirtualMirrorCombine::VirtualMirrorCombine(IVec2Property* viewportSizeProp)
: VisualizationProcessor(viewportSizeProp)
, p_normalImageID("normalImageID", "Normal DVR Input Image", "", DataNameProperty::READ)
, p_mirrorImageID("mirrorImageID", "Mirror DVR Input Image", "", DataNameProperty::READ)
, p_mirrorRenderID("mirrorRenderID", "Rendered Mirror Input Image", "", DataNameProperty::READ)
......
......@@ -52,7 +52,7 @@ namespace campvis {
/**
* Constructs a new VirtualMirrorCombine Processor
**/
VirtualMirrorCombine(IVec2Property& canvasSize);
VirtualMirrorCombine(IVec2Property* viewportSizeProp);
/**
* Destructor
......
......@@ -41,16 +41,16 @@
namespace campvis {
const std::string VolumeExplorer::loggerCat_ = "CAMPVis.modules.vis.VolumeExplorer";
VolumeExplorer::VolumeExplorer(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
VolumeExplorer::VolumeExplorer(IVec2Property* viewportSizeProp)
: VisualizationProcessor(viewportSizeProp)
, p_inputVolume("InputVolume", "Input Volume", "", DataNameProperty::READ, AbstractProcessor::INVALID_PROPERTIES)
, p_camera("Camera", "Camera")
, p_xSlice("XSlice", "Slice in YZ Plane", 0, 0, 0, INVALID_RESULT | SLICES_INVALID)
, p_ySlice("YSlice", "Slice in XZ Plane", 0, 0, 0, INVALID_RESULT | SLICES_INVALID)
, p_zSlice("ZSlice", "Slice in XY Plane", 0, 0, 0, INVALID_RESULT | SLICES_INVALID)
, p_outputImage("OutputImage", "Output Image", "ve.output", DataNameProperty::WRITE)
, _raycaster(canvasSize)
, _sliceExtractor(canvasSize)
, _raycaster(viewportSizeProp)
, _sliceExtractor(viewportSizeProp)
, p_sliceRenderSize("SliceRenderSize", "Slice Render Size", tgt::ivec2(32), tgt::ivec2(0), tgt::ivec2(10000), AbstractProcessor::VALID)
, p_volumeRenderSize("VolumeRenderSize", "Volume Render Size", tgt::ivec2(32), tgt::ivec2(0), tgt::ivec2(10000), AbstractProcessor::VALID)
, _xSliceHandler(&p_xSlice)
......@@ -78,8 +78,8 @@ namespace campvis {
p_ySlice.addSharedProperty(&_sliceExtractor.p_ySliceNumber);
p_zSlice.addSharedProperty(&_sliceExtractor.p_zSliceNumber);
p_sliceRenderSize.addSharedProperty(&_sliceExtractor._renderTargetSize);
p_volumeRenderSize.addSharedProperty(&_raycaster._renderTargetSize);
_sliceExtractor.setViewportSizeProperty(&p_sliceRenderSize);
_raycaster.setViewportSizeProperty(&p_volumeRenderSize);
addProperty(&p_sliceRenderSize);
addProperty(&p_volumeRenderSize);
......@@ -165,9 +165,9 @@ namespace campvis {
}
void VolumeExplorer::onPropertyChanged(const AbstractProperty* prop) {
if (prop == &_renderTargetSize) {
p_sliceRenderSize.setValue(tgt::ivec2(_renderTargetSize.getValue().y / 3, _renderTargetSize.getValue().y / 3));
p_volumeRenderSize.setValue(tgt::ivec2(_renderTargetSize.getValue().x - _renderTargetSize.getValue().y / 3, _renderTargetSize.getValue().y));
if (prop == _viewportSizeProperty) {
p_sliceRenderSize.setValue(tgt::ivec2(_viewportSizeProperty->getValue().y / 3, _viewportSizeProperty->getValue().y / 3));
p_volumeRenderSize.setValue(tgt::ivec2(_viewportSizeProperty->getValue().x - _viewportSizeProperty->getValue().y / 3, _viewportSizeProperty->getValue().y));
_trackballEH->setViewportSize(p_volumeRenderSize.getValue());
float ratio = static_cast<float>(p_volumeRenderSize.getValue().x) / static_cast<float>(p_volumeRenderSize.getValue().y);
......@@ -198,7 +198,7 @@ namespace campvis {
tgt::TextureUnit colorUnit, depthUnit;
_shader->activate();
tgt::vec2 rts(_renderTargetSize.getValue());
tgt::vec2 rts(_viewportSizeProperty->getValue());
const tgt::ivec2& vrs = p_volumeRenderSize.getValue();
const tgt::ivec2& srs = p_sliceRenderSize.getValue();
......@@ -207,7 +207,7 @@ namespace campvis {
if (vrImage != 0) {
vrImage->bind(_shader, colorUnit, depthUnit);
float ratio = static_cast<float>(p_volumeRenderSize.getValue().x) / static_cast<float>(_renderTargetSize.getValue().x);
float ratio = static_cast<float>(p_volumeRenderSize.getValue().x) / static_cast<float>(_viewportSizeProperty->getValue().x);
_shader->setUniform("_modelMatrix", tgt::mat4::createScale(tgt::vec3(vrs.x, vrs.y, .5f)));
_shader->setUniform("_viewMatrix", tgt::mat4::createTranslation(tgt::vec3(srs.x, 0.f, 0.f)));
_quad->render(GL_POLYGON);
......
......@@ -58,7 +58,7 @@ namespace campvis {
/**
* Constructs a new VolumeExplorer Processor
**/
VolumeExplorer(IVec2Property& canvasSize);
VolumeExplorer(IVec2Property* viewportSizeProp);
/**
* Destructor
......@@ -79,7 +79,7 @@ namespace campvis {
virtual const std::string getAuthor() const { return "Christian Schulte zu Berge <christian.szb@in.tum.de>"; };
/// \see AbstractProcessor::getProcessorState()
virtual const ProcessorState getProcessorState() const { return AbstractProcessor::EXPERIMENTAL; };
/// \see tgt::EventListener::onEvent()
virtual void onEvent(tgt::Event* e);
......
......@@ -40,14 +40,14 @@
namespace campvis {
const std::string VolumeRenderer::loggerCat_ = "CAMPVis.modules.vis.VolumeRenderer";
VolumeRenderer::VolumeRenderer(IVec2Property& canvasSize)
: VisualizationProcessor(canvasSize)
VolumeRenderer::VolumeRenderer(IVec2Property* viewportSizeProp)
: VisualizationProcessor(viewportSizeProp)
, p_inputVolume("InputVolume", "Input Volume", "", DataNameProperty::READ, AbstractProcessor::VALID)
, p_camera("Camera", "Camera", tgt::Camera(), AbstractProcessor::VALID)
, p_outputImage("OutputImage", "Output Image", "vr.output", DataNameProperty::WRITE, AbstractProcessor::VALID)
, _pgGenerator()
, _eepGenerator(canvasSize)
, _raycaster(canvasSize)
, _eepGenerator(_viewportSizeProperty)
, _raycaster(_viewportSizeProperty)
{
addProperty(&p_inputVolume);
addProperty(&p_camera);
......@@ -147,5 +147,12 @@ namespace campvis {
VisualizationProcessor::onPropertyChanged(prop);
}
void VolumeRenderer::setViewportSizeProperty(IVec2Property* viewportSizeProp) {
_eepGenerator.setViewportSizeProperty(viewportSizeProp);
_raycaster.setViewportSizeProperty(viewportSizeProp);
VisualizationProcessor::setViewportSizeProperty(viewportSizeProp);
}
}
......@@ -52,7 +52,7 @@ namespace campvis {
/**
* Constructs a new VolumeRenderer Processor
**/
VolumeRenderer(IVec2Property& canvasSize);
VolumeRenderer(IVec2Property* viewportSizeProp);
/**
* Destructor
......@@ -74,6 +74,9 @@ namespace campvis {
/// \see AbstractProcessor::getProcessorState()
virtual const ProcessorState getProcessorState() const { return AbstractProcessor::TESTING; };
/// \see VisualizationPipeline::setViewportSizeProperty()
virtual void setViewportSizeProperty(IVec2Property* viewportSizeProp);
virtual void process(DataContainer& data);
DataNameProperty p_inputVolume; ///< image ID for first input image
......
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