Revised LQ mode concept for visualization pipelines/processors:

Instead of having the LQ mode tied to the pipeline, each VisualizationProcessor has now a lqMode property effectively halfsampling the viewport size. The TrackballNavigationEventHandler was adapted to these changes and thus simplified.
parent 924c4449
......@@ -31,7 +31,7 @@
#include "tgt/assert.h"
#include "tgt/event/mouseevent.h"
#include "core/properties/cameraproperty.h"
#include "core/pipeline/visualizationpipeline.h"
#include "core/pipeline/visualizationprocessor.h"
namespace campvis {
......@@ -64,9 +64,8 @@ namespace campvis {
const std::string TrackballNavigationEventListener::loggerCat_ = "CAMPVis.core.eventhandler.TrackballNavigationEventListener";
TrackballNavigationEventListener::TrackballNavigationEventListener(VisualizationPipeline* parentPipeline, CameraProperty* cameraProperty, const tgt::ivec2& viewportSize)
TrackballNavigationEventListener::TrackballNavigationEventListener(CameraProperty* cameraProperty, const tgt::ivec2& viewportSize)
: tgt::EventListener()
, _parentPipeline(parentPipeline)
, _cameraProperty(cameraProperty)
, _cpnw(cameraProperty)
, _trackball(0)
......@@ -83,13 +82,13 @@ namespace campvis {
if (typeid(*e) == typeid(tgt::MouseEvent)) {
tgt::MouseEvent* me = static_cast<tgt::MouseEvent*>(e);
if (me->action() == tgt::MouseEvent::PRESSED) {
if (_parentPipeline)
_parentPipeline->enableLowQualityMode();
for (std::vector<VisualizationProcessor*>::iterator it = _lqModeProcessors.begin(); it != _lqModeProcessors.end(); ++it)
(*it)->p_lqMode.setValue(true);
_trackball->mousePressEvent(me);
}
else if (me->action() == tgt::MouseEvent::RELEASED) {
if (_parentPipeline)
_parentPipeline->disableLowQualityMode();
for (std::vector<VisualizationProcessor*>::iterator it = _lqModeProcessors.begin(); it != _lqModeProcessors.end(); ++it)
(*it)->p_lqMode.setValue(false);
_trackball->mouseReleaseEvent(me);
}
else if (me->action() == tgt::MouseEvent::MOTION)
......@@ -122,4 +121,18 @@ namespace campvis {
return _trackball->getSceneBounds();
}
void TrackballNavigationEventListener::addLqModeProcessor(VisualizationProcessor* vp) {
tgtAssert(vp != 0, "Pointer to processor must not be 0.");
tgtAssert(std::find(_lqModeProcessors.begin(), _lqModeProcessors.end(), vp) == _lqModeProcessors.end(), "Processor already in list of LQ mode processors.");
_lqModeProcessors.push_back(vp);
}
void TrackballNavigationEventListener::removeLqModeProcessor(VisualizationProcessor* vp) {
for (std::vector<VisualizationProcessor*>::iterator it = _lqModeProcessors.begin(); it != _lqModeProcessors.end(); ++it) {
if (*it == vp)
_lqModeProcessors.erase(it);
}
}
}
......@@ -35,20 +35,30 @@
#include "tgt/event/eventlistener.h"
#include "tgt/navigation/trackball.h"
#include <vector>
namespace campvis {
class CameraProperty;
class VisualizationPipeline;
class VisualizationProcessor;
/**
* Wrapper to adapt a CameraProperty to the tgt::Trackball interface.
*/
class CamPropNavigationWrapper : public tgt::IHasCamera {
public:
/**
* Constructor
* \param camProp The CameraProperty to wrap around.
*/
CamPropNavigationWrapper(CameraProperty* camProp);
/// Virtual Destructor
virtual ~CamPropNavigationWrapper();
/// \see tgt::IHasCamera::getCamera()
virtual tgt::Camera* getCamera();
/// \see tgt::IHasCamera::update()
virtual void update();
private:
......@@ -68,11 +78,10 @@ namespace campvis {
public:
/**
* Creates a TrackballNavigationEventListener.
* \param parentPipeline Parent pipeline of this event handler, must not be 0.
* \param cameraProperty The CameraProperty to apply the navigation to.
* \param viewportSize Initial viewport size
*/
TrackballNavigationEventListener(VisualizationPipeline* parentPipeline, CameraProperty* cameraProperty, const tgt::ivec2& viewportSize);
TrackballNavigationEventListener(CameraProperty* cameraProperty, const tgt::ivec2& viewportSize);
/**
* Virtual Destructor
......@@ -115,13 +124,30 @@ namespace campvis {
*/
const tgt::Bounds& getSceneBounds() const;
/**
* Adds \a vp to the list of LQ mode processors.
* During interaction, TrackballNavigationEventListener will set the LQ mode flag of all
* LQ mode processors.
* \param vp VisualizationProcessor to add to the list of LQ mode processors.
*/
void addLqModeProcessor(VisualizationProcessor* vp);
/**
* Removes \a vp from the list of LQ mode processors.
* \param vp VisualizationProcessor to remove from the list of LQ mode processors.
*/
void removeLqModeProcessor(VisualizationProcessor* vp);
protected:
VisualizationPipeline* _parentPipeline; ///< The parent VisualizationPipeline
CameraProperty* _cameraProperty; ///< The CameraProperty to apply the navigation to
CamPropNavigationWrapper _cpnw; ///< The CamPropNavigationWrapper used to adapt to the tgt::Trackball interface
tgt::Trackball* _trackball; ///< The tgt::Trackball for the navigation logic
tgt::Bounds _sceneBounds; ///< The extent of the scene (in world coordinates)
/// List of processors for which to enable LQ mode during interaction
std::vector<VisualizationProcessor*> _lqModeProcessors;
static const std::string loggerCat_;
};
......
......@@ -106,7 +106,7 @@ namespace campvis {
_shader->setIgnoreUniformLocationError(true);
decorateRenderProlog(data, _shader);
_shader->setUniform("_viewportSizeRCP", 1.f / tgt::vec2(_viewportSizeProperty->getValue()));
_shader->setUniform("_viewportSizeRCP", 1.f / tgt::vec2(getEffectiveViewportSize()));
_shader->setUniform("_jitterEntryPoints", p_jitterEntryPoints.getValue());
_shader->setUniform("_jitterStepSizeMultiplier", p_jitterStepSizeMultiplier.getValue());
......
......@@ -63,10 +63,8 @@ namespace campvis {
: AbstractPipeline()
, tgt::EventHandler()
, tgt::EventListener()
, _lqMode(false)
, _ignoreCanvasSizeUpdate(false)
, _canvasSize("CanvasSize", "Canvas Size", tgt::ivec2(128, 128), tgt::ivec2(1, 1), tgt::ivec2(4096, 4096))
, _effectiveRenderTargetSize("EffectiveRenderTargetSize", "Render Target Size", tgt::ivec2(128, 128), tgt::ivec2(1, 1), tgt::ivec2(4096, 4096))
, _renderTargetID("renderTargetID", "Render Target ID", "VisualizationPipeline.renderTarget", DataNameProperty::READ)
, _canvas(0)
{
......@@ -110,8 +108,6 @@ namespace campvis {
if (_canvasSize.getValue() != size && !_ignoreCanvasSizeUpdate) {
_canvasSize.setValue(size);
}
updateEffectiveRenderTargetSize();
}
void VisualizationPipeline::onDataContainerDataAdded(const std::string& name, const DataHandle& dh) {
......@@ -150,23 +146,6 @@ namespace campvis {
AbstractPipeline::onPropertyChanged(prop);
}
void VisualizationPipeline::enableLowQualityMode() {
_lqMode = true;
updateEffectiveRenderTargetSize();
}
void VisualizationPipeline::disableLowQualityMode() {
_lqMode = false;
updateEffectiveRenderTargetSize();
}
void VisualizationPipeline::updateEffectiveRenderTargetSize() {
if (_lqMode)
_effectiveRenderTargetSize.setValue(_canvasSize.getValue() / 2);
else
_effectiveRenderTargetSize.setValue(_canvasSize.getValue());
}
void VisualizationPipeline::onProcessorInvalidated(AbstractProcessor* processor) {
if (_canvas == 0)
return;
......
......@@ -109,7 +109,7 @@ namespace campvis {
/**
* Returns the viewport size of the target canvas
* \return _effectiveRenderTargetSize
* \return _canvasSize
*/
const tgt::ivec2& getRenderTargetSize() const;
......@@ -119,20 +119,6 @@ namespace campvis {
*/
const std::string& getRenderTargetID() const;
/**
* Enables low quality mode, which effectively reduces the render target size by factor 4.
* \note Do not forget to call disableLowQualityMode().
* \sa disableLowQualityMode()
*/
void enableLowQualityMode();
/**
* Disables low quality mode, which effectively resets the render target size to its original value;
* \note Do not forget to call disableLowQualityMode().
* \sa disableLowQualityMode()
*/
void disableLowQualityMode();
/**
* Executes \a processor and afterwards checks the OpenGL state to be valid.
* \note Only call from with a valid OpenGL context
......@@ -174,18 +160,11 @@ namespace campvis {
*/
void lockGLContextAndExecuteProcessor(AbstractProcessor* processor);
/**
* Updates the _effectiveRenderTargetSize property considering LQ mode.
*/
void updateEffectiveRenderTargetSize();
tbb::concurrent_hash_map<AbstractProcessor*, bool> _isVisProcessorMap;
IVec2Property _canvasSize; ///< original canvas size
bool _lqMode; ///< Flag whether low quality mode is enables
bool _ignoreCanvasSizeUpdate;
IVec2Property _effectiveRenderTargetSize; ///< actual size of the render targets (considering LQ mode)
DataNameProperty _renderTargetID; ///< ID of the render target image to be rendered to the canvas
tgt::GLCanvas* _canvas; ///< Canvas hosting the OpenGL context for this pipeline.
......
......@@ -40,10 +40,13 @@ namespace campvis {
VisualizationProcessor::VisualizationProcessor(IVec2Property* viewportSizeProp)
: AbstractProcessor()
, p_lqMode("LqMode", "Low Quality Mode", false)
, _fbo(0)
, _viewportSizeProperty(viewportSizeProp)
{
tgtAssert(_viewportSizeProperty != 0, "Pointer must not be 0!");
addProperty(&p_lqMode);
}
VisualizationProcessor::~VisualizationProcessor() {
......@@ -152,8 +155,12 @@ namespace campvis {
createAndAttachTexture(internalFormat, attachment);
}
tgt::ivec2 VisualizationProcessor::getEffectiveViewportSize() const {
return (p_lqMode.getValue() ? _viewportSizeProperty->getValue() / 2 : _viewportSizeProperty->getValue());
}
tgt::ivec3 VisualizationProcessor::getRenderTargetSize() const {
return tgt::ivec3(_viewportSizeProperty->getValue(), 1);
return tgt::ivec3(getEffectiveViewportSize(), 1);
}
void VisualizationProcessor::createAndAttachColorTexture() {
......
......@@ -64,7 +64,7 @@ namespace campvis {
tgtAssert(_fbo != 0, "FBO must not be 0.");
_fbo->activate();
const tgt::ivec2& windowSize = vp->_viewportSizeProperty->getValue();
const tgt::ivec2& windowSize = vp->getEffectiveViewportSize();
glViewport(0, 0, static_cast<GLsizei>(windowSize.x), static_cast<GLsizei>(windowSize.y));
}
......@@ -114,6 +114,9 @@ namespace campvis {
*/
virtual void setViewportSizeProperty(IVec2Property* viewportSizeProp);
BoolProperty p_lqMode; ///< Flag whether to enable LQ mode (halfsamples effective viewport size)
protected:
/**
......@@ -143,15 +146,21 @@ namespace campvis {
*/
void createAndAttachDepthTexture();
/**
* Returns the effective viewport size considering LQ mode.
* \return lqMode ? _viewportSize/2 : _viewportSize
*/
tgt::ivec2 getEffectiveViewportSize() const;
/**
* Returns the current viewport size as ivec3.
* \return tgt::ivec3(_viewportSizeProperty->getValue(), 1)
* \return tgt::ivec3(getEffectiveViewportSize(), 1)
*/
tgt::ivec3 getRenderTargetSize() const;
tgt::FramebufferObject* _fbo; ///< The FBO used by this VisualizationProcessor
IVec2Property* _viewportSizeProperty; ///< Pointer to the property defining the viewport size.
IVec2Property* _viewportSizeProperty; ///< Pointer to the property defining the viewport (canvas) size.
static const std::string loggerCat_;
};
......
......@@ -46,16 +46,16 @@ namespace campvis {
, _confidenceGenerator()
, _gvg()
, _lhh()
, _usFusion1(&_effectiveRenderTargetSize)
, _usFusion2(&_effectiveRenderTargetSize)
, _usFusion3(&_effectiveRenderTargetSize)
, _usFusion4(&_effectiveRenderTargetSize)
, _usFusion1(&_canvasSize)
, _usFusion2(&_canvasSize)
, _usFusion3(&_canvasSize)
, _usFusion4(&_canvasSize)
, _usBlurFilter()
, _quadView(&_effectiveRenderTargetSize)
, _quadView(&_canvasSize)
, _usDenoiseilter()
, _usProxy()
, _usEEP(&_effectiveRenderTargetSize)
, _usDVR(&_effectiveRenderTargetSize)
, _usEEP(&_canvasSize)
, _usDVR(&_canvasSize)
, _wheelHandler(&_usFusion1.p_sliceNumber)
, _tfWindowingHandler(&_usFusion1.p_transferFunction)
, _trackballEH(0)
......@@ -79,7 +79,7 @@ namespace campvis {
addEventListenerToBack(&_wheelHandler);
//addEventHandler(&_tfWindowingHandler);
_trackballEH = new TrackballNavigationEventListener(this, &_camera, _canvasSize.getValue());
_trackballEH = new TrackballNavigationEventListener(&_camera, _canvasSize.getValue());
addEventListenerToBack(_trackballEH);
}
......@@ -194,12 +194,12 @@ namespace campvis {
_renderTargetID.setValue("quadview.output");
_trackballEH->setViewportSize(_effectiveRenderTargetSize.getValue());
_effectiveRenderTargetSize.s_changed.connect<AdvancedUsVis>(this, &AdvancedUsVis::onRenderTargetSizeChanged);
_trackballEH->setViewportSize(_canvasSize.getValue());
_canvasSize.s_changed.connect<AdvancedUsVis>(this, &AdvancedUsVis::onRenderTargetSizeChanged);
}
void AdvancedUsVis::deinit() {
_effectiveRenderTargetSize.s_changed.disconnect(this);
_canvasSize.s_changed.disconnect(this);
VisualizationPipeline::deinit();
}
......@@ -241,7 +241,7 @@ namespace campvis {
void AdvancedUsVis::onRenderTargetSizeChanged(const AbstractProperty* prop) {
_trackballEH->setViewportSize(_canvasSize.getValue());
float ratio = static_cast<float>(_effectiveRenderTargetSize.getValue().x) / static_cast<float>(_effectiveRenderTargetSize.getValue().y);
float ratio = static_cast<float>(_canvasSize.getValue().x) / static_cast<float>(_canvasSize.getValue().y);
_camera.setWindowRatio(ratio);
}
......
......@@ -52,10 +52,10 @@ namespace campvis {
CmBatchGeneration::CmBatchGeneration()
: VisualizationPipeline()
, _usReader(&_effectiveRenderTargetSize)
, _usReader(&_canvasSize)
, _confidenceGenerator()
, _usBlurFilter()
, _usFusion(&_effectiveRenderTargetSize)
, _usFusion(&_canvasSize)
, p_autoExecution("AutoExecution", "Automatic Execution", false)
, p_sourcePath("SourcePath", "Source Files Path", "")
, p_targetPathColor("TargetPathColor", "Target Path Color Files", "")
......
......@@ -46,19 +46,22 @@ namespace campvis {
, _imageReader()
, _flowReader()
, _vtkReader()
, _vr(&_effectiveRenderTargetSize)
, _sr(&_effectiveRenderTargetSize)
, _src(&_effectiveRenderTargetSize)
, _gr(&_effectiveRenderTargetSize)
, _vr(&_canvasSize)
, _sr(&_canvasSize)
, _src(&_canvasSize)
, _gr(&_canvasSize)
, _sft()
, _sfr(&_effectiveRenderTargetSize)
, _compositor(&_effectiveRenderTargetSize)
, _sfr(&_canvasSize)
, _compositor(&_canvasSize)
, _trackballEH(0)
{
addProperty(&_camera);
addProperty(&_boundsData);
_trackballEH = new TrackballNavigationEventListener(this, &_camera, _canvasSize.getValue());
_trackballEH = new TrackballNavigationEventListener(&_camera, _canvasSize.getValue());
_trackballEH->addLqModeProcessor(&_vr);
_trackballEH->addLqModeProcessor(&_src);
_trackballEH->addLqModeProcessor(&_sfr);
addEventListenerToBack(_trackballEH);
addProcessor(&_imageReader);
......@@ -142,12 +145,12 @@ namespace campvis {
_sfr.p_renderTargetID.connect(static_cast<DataNameProperty*>(_vr.getProperty("GeometryImageId")));
_sfr.p_renderTargetID.connect(&_compositor.p_firstImageId);
_trackballEH->setViewportSize(_effectiveRenderTargetSize.getValue());
_effectiveRenderTargetSize.s_changed.connect<Columbia1>(this, &Columbia1::onRenderTargetSizeChanged);
_trackballEH->setViewportSize(_canvasSize.getValue());
_canvasSize.s_changed.connect<Columbia1>(this, &Columbia1::onRenderTargetSizeChanged);
}
void Columbia1::deinit() {
_effectiveRenderTargetSize.s_changed.disconnect(this);
_canvasSize.s_changed.disconnect(this);
VisualizationPipeline::deinit();
}
......@@ -157,7 +160,7 @@ namespace campvis {
void Columbia1::onRenderTargetSizeChanged(const AbstractProperty* prop) {
_trackballEH->setViewportSize(_canvasSize.getValue());
float ratio = static_cast<float>(_effectiveRenderTargetSize.getValue().x) / static_cast<float>(_effectiveRenderTargetSize.getValue().y);
float ratio = static_cast<float>(_canvasSize.getValue().x) / static_cast<float>(_canvasSize.getValue().y);
_camera.setWindowRatio(ratio);
}
......
......@@ -99,8 +99,8 @@ namespace campvis {
_shader->activate();
_shader->setIgnoreUniformLocationError(true);
_shader->setUniform("_viewportSize", _viewportSizeProperty->getValue());
_shader->setUniform("_viewportSizeRCP", 1.f / tgt::vec2(_viewportSizeProperty->getValue()));
_shader->setUniform("_viewportSize", getEffectiveViewportSize());
_shader->setUniform("_viewportSizeRCP", 1.f / tgt::vec2(getEffectiveViewportSize()));
_shader->setIgnoreUniformLocationError(false);
tgt::TextureUnit texUnit;
......
......@@ -45,13 +45,14 @@ namespace campvis {
, _camera("camera", "Camera")
, _imageReader()
, _pgGenerator()
, _eepGenerator(&_effectiveRenderTargetSize)
, _clRaycaster(&_effectiveRenderTargetSize)
, _eepGenerator(&_canvasSize)
, _clRaycaster(&_canvasSize)
, _trackballEH(0)
{
addProperty(&_camera);
_trackballEH = new TrackballNavigationEventListener(this, &_camera, _canvasSize.getValue());
_trackballEH = new TrackballNavigationEventListener(&_camera, _canvasSize.getValue());
_trackballEH->addLqModeProcessor(&_clRaycaster);
addEventListenerToBack(_trackballEH);
addProcessor(&_imageReader);
......@@ -94,12 +95,12 @@ namespace campvis {
_eepGenerator.p_entryImageID.connect(&_clRaycaster._entryImageID);
_eepGenerator.p_exitImageID.connect(&_clRaycaster._exitImageID);
_trackballEH->setViewportSize(_effectiveRenderTargetSize.getValue());
_effectiveRenderTargetSize.s_changed.connect<OpenCLPipeline>(this, &OpenCLPipeline::onRenderTargetSizeChanged);
_trackballEH->setViewportSize(_canvasSize.getValue());
_canvasSize.s_changed.connect<OpenCLPipeline>(this, &OpenCLPipeline::onRenderTargetSizeChanged);
}
void OpenCLPipeline::deinit() {
_effectiveRenderTargetSize.s_changed.disconnect(this);
_canvasSize.s_changed.disconnect(this);
VisualizationPipeline::deinit();
}
......@@ -109,7 +110,7 @@ namespace campvis {
void OpenCLPipeline::onRenderTargetSizeChanged(const AbstractProperty* prop) {
_trackballEH->setViewportSize(_canvasSize.getValue());
float ratio = static_cast<float>(_effectiveRenderTargetSize.getValue().x) / static_cast<float>(_effectiveRenderTargetSize.getValue().y);
float ratio = static_cast<float>(_canvasSize.getValue().x) / static_cast<float>(_canvasSize.getValue().y);
_camera.setWindowRatio(ratio);
}
......
......@@ -45,7 +45,7 @@ namespace campvis {
addProperty(&p_camera);
_trackballEH = new TrackballNavigationEventListener(this, &p_camera, _canvasSize.getValue());
_trackballEH = new TrackballNavigationEventListener(&p_camera, _canvasSize.getValue());
addEventListenerToBack(_trackballEH);
}
......@@ -64,12 +64,12 @@ namespace campvis {
_renderer.p_targetImageID.setValue("us.frame.output");
_renderTargetID.setValue(_renderer.p_targetImageID.getValue());
_trackballEH->setViewportSize(_effectiveRenderTargetSize.getValue());
_effectiveRenderTargetSize.s_changed.connect<UsCompounding>(this, &UsCompounding::onRenderTargetSizeChanged);
_trackballEH->setViewportSize(_canvasSize.getValue());
_canvasSize.s_changed.connect<UsCompounding>(this, &UsCompounding::onRenderTargetSizeChanged);
}
void UsCompounding::deinit() {
_effectiveRenderTargetSize.s_changed.disconnect(this);
_canvasSize.s_changed.disconnect(this);
VisualizationPipeline::deinit();
}
......@@ -79,7 +79,7 @@ namespace campvis {
void UsCompounding::onRenderTargetSizeChanged(const AbstractProperty* prop) {
_trackballEH->setViewportSize(_canvasSize.getValue());
float ratio = static_cast<float>(_effectiveRenderTargetSize.getValue().x) / static_cast<float>(_effectiveRenderTargetSize.getValue().y);
float ratio = static_cast<float>(_canvasSize.getValue().x) / static_cast<float>(_canvasSize.getValue().y);
p_camera.setWindowRatio(ratio);
}
......
......@@ -173,7 +173,7 @@ namespace campvis {
glEnable(GL_DEPTH_TEST);
_shader->activate();
_shader->setIgnoreUniformLocationError(true);
_shader->setUniform("_viewportSizeRCP", 1.f / tgt::vec2(_viewportSizeProperty->getValue()));
_shader->setUniform("_viewportSizeRCP", 1.f / tgt::vec2(getEffectiveViewportSize()));
_shader->setUniform("_projectionMatrix", cam.getProjectionMatrix());
_shader->setUniform("_viewMatrix", cam.getViewMatrix());
......
......@@ -45,18 +45,21 @@ namespace campvis {
, _imageReader()
, _pgGenerator()
, _vmgGenerator()
, _vmRenderer(&_effectiveRenderTargetSize)
, _eepGenerator(&_effectiveRenderTargetSize)
, _vmEepGenerator(&_effectiveRenderTargetSize)
, _dvrNormal(&_effectiveRenderTargetSize)
, _dvrVM(&_effectiveRenderTargetSize)
, _depthDarkening(&_effectiveRenderTargetSize)
, _combine(&_effectiveRenderTargetSize)
, _vmRenderer(&_canvasSize)
, _eepGenerator(&_canvasSize)
, _vmEepGenerator(&_canvasSize)
, _dvrNormal(&_canvasSize)
, _dvrVM(&_canvasSize)
, _depthDarkening(&_canvasSize)
, _combine(&_canvasSize)
, _trackballEH(0)
{
addProperty(&_camera);
_trackballEH = new TrackballNavigationEventListener(this, &_camera, _canvasSize.getValue());
_trackballEH = new TrackballNavigationEventListener(&_camera, _canvasSize.getValue());
_trackballEH->addLqModeProcessor(&_dvrNormal);
_trackballEH->addLqModeProcessor(&_dvrVM);
_trackballEH->addLqModeProcessor(&_depthDarkening);
addEventListenerToBack(_trackballEH);
addProcessor(&_imageReader);
......@@ -141,13 +144,13 @@ namespace campvis {
_dvrNormal.p_targetImageID.connect(&_depthDarkening.p_inputImage);
_depthDarkening.p_outputImage.connect(&_combine.p_normalImageID);
_trackballEH->setViewportSize(_effectiveRenderTargetSize.getValue());
_effectiveRenderTargetSize.s_changed.connect<DVRVis>(this, &DVRVis::onRenderTargetSizeChanged);
_trackballEH->setViewportSize(_canvasSize.getValue());
_canvasSize.s_changed.connect<DVRVis>(this, &DVRVis::onRenderTargetSizeChanged);
}
void DVRVis::deinit() {
_effectiveRenderTargetSize.s_changed.disconnect(this);
_canvasSize.s_changed.disconnect(this);
VisualizationPipeline::deinit();
}
......@@ -157,7 +160,7 @@ namespace campvis {
void DVRVis::onRenderTargetSizeChanged(const AbstractProperty* prop) {
_trackballEH->setViewportSize(_canvasSize.getValue());
float ratio = static_cast<float>(_effectiveRenderTargetSize.getValue().x) / static_cast<float>(_effectiveRenderTargetSize.getValue().y);
float ratio = static_cast<float>(_canvasSize.getValue().x) / static_cast<float>(_canvasSize.getValue().y);
_camera.setWindowRatio(ratio);
}
......
......@@ -40,19 +40,19 @@ namespace campvis {
IxpvDemo::IxpvDemo()
: VisualizationPipeline()
, _xrayReader(&_effectiveRenderTargetSize)
, _xrayReader(&_canvasSize)
, _ctReader()
, _ctProxy()
, _ctFullEEP(&_effectiveRenderTargetSize)
, _ctClippedEEP(&_effectiveRenderTargetSize)
, _ctDVR(&_effectiveRenderTargetSize)
, _ctFullDRR(&_effectiveRenderTargetSize)
, _ctClippedDRR(&_effectiveRenderTargetSize)
, _ctFullEEP(&_canvasSize)
, _ctClippedEEP(&_canvasSize)
, _ctDVR(&_canvasSize)
, _ctFullDRR(&_canvasSize)
, _ctClippedDRR(&_canvasSize)
, _usReader()
, _usSliceRenderer(&_effectiveRenderTargetSize)
, _compositor(&_effectiveRenderTargetSize)
, _compositor2(&_effectiveRenderTargetSize)
, _ixpvCompositor(&_effectiveRenderTargetSize)
, _usSliceRenderer(&_canvasSize)
, _compositor(&_canvasSize)
, _compositor2(&_canvasSize)
, _ixpvCompositor(&_canvasSize)
, _camera("camera", "Camera")