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 c9a5d18b authored by schultezub's avatar schultezub
Browse files

introduced low quality mode to VisualizationPipeline (e.g. to be used during user-interaction)

git-svn-id: https://camplinux.in.tum.de/svn/campvis/trunk@353 bb408c1c-ae56-11e1-83d9-df6b3e0c105e
parent b1e97719
......@@ -31,6 +31,7 @@
#include "tgt/assert.h"
#include "tgt/event/mouseevent.h"
#include "core/properties/cameraproperty.h"
#include "core/pipeline/visualizationpipeline.h"
namespace campvis {
......@@ -63,8 +64,9 @@ namespace campvis {
const std::string TrackballNavigationEventHandler::loggerCat_ = "CAMPVis.core.eventhandler.TrackballNavigationEventHandler";
TrackballNavigationEventHandler::TrackballNavigationEventHandler(CameraProperty* cameraProperty, const tgt::ivec2& viewportSize)
TrackballNavigationEventHandler::TrackballNavigationEventHandler(VisualizationPipeline* parentPipeline, CameraProperty* cameraProperty, const tgt::ivec2& viewportSize)
: AbstractEventHandler()
, _parentPipeline(parentPipeline)
, _cameraProperty(cameraProperty)
, _cpnw(cameraProperty)
, _trackball(0)
......@@ -98,10 +100,14 @@ namespace campvis {
void TrackballNavigationEventHandler::execute(tgt::Event* e) {
if (typeid(*e) == typeid(tgt::MouseEvent)) {
tgt::MouseEvent* me = static_cast<tgt::MouseEvent*>(e);
if (me->action() == tgt::MouseEvent::PRESSED)
if (me->action() == tgt::MouseEvent::PRESSED) {
_parentPipeline->enableLowQualityMode();
_trackball->mousePressEvent(me);
else if (me->action() == tgt::MouseEvent::RELEASED)
}
else if (me->action() == tgt::MouseEvent::RELEASED) {
_parentPipeline->disableLowQualityMode();
_trackball->mouseReleaseEvent(me);
}
else if (me->action() == tgt::MouseEvent::MOTION)
_trackball->mouseMoveEvent(me);
else if (me->action() == tgt::MouseEvent::WHEEL)
......
......@@ -37,6 +37,7 @@
namespace campvis {
class CameraProperty;
class VisualizationPipeline;
/**
* Wrapper to adapt a CameraProperty to the tgt::Trackball interface.
......@@ -67,8 +68,11 @@ namespace campvis {
public:
/**
* Creates a TrackballNavigationEventHandler.
* \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
*/
TrackballNavigationEventHandler(CameraProperty* cameraProperty, const tgt::ivec2& viewportSize);
TrackballNavigationEventHandler(VisualizationPipeline* parentPipeline, CameraProperty* cameraProperty, const tgt::ivec2& viewportSize);
/**
* Virtual Destructor
......@@ -116,10 +120,11 @@ namespace campvis {
void setSceneBounds(const tgt::Bounds& bounds);
protected:
CameraProperty* _cameraProperty;
CamPropNavigationWrapper _cpnw;
tgt::Trackball* _trackball;
tgt::Bounds _sceneBounds;
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)
static const std::string loggerCat_;
};
......
......@@ -41,7 +41,8 @@ namespace campvis {
VisualizationPipeline::VisualizationPipeline()
: AbstractPipeline()
, tgt::EventListener()
, _renderTargetSize("canvasSize", "Canvas Size", tgt::ivec2(128, 128))
, _lqMode(false)
, _effectiveRenderTargetSize("canvasSize", "Canvas Size", tgt::ivec2(128, 128))
, _renderTargetID("renderTargetID", "Render Target ID", "VisualizationPipeline.renderTarget")
, _canvas(0)
{
......@@ -76,7 +77,12 @@ namespace campvis {
}
const tgt::ivec2& VisualizationPipeline::getRenderTargetSize() const {
return _renderTargetSize.getValue();
return _renderTargetSize;
}
void VisualizationPipeline::setRenderTargetSize(const tgt::ivec2& size) {
_renderTargetSize = size;
updateEffectiveRenderTargetSize();
}
void VisualizationPipeline::onDataContainerDataAdded(const std::string& name, const DataHandle& dh) {
......@@ -89,10 +95,6 @@ namespace campvis {
return _renderTargetID.getValue();
}
void VisualizationPipeline::setRenderTargetSize(const tgt::ivec2& size) {
_renderTargetSize.setValue(size);
}
void VisualizationPipeline::lockGLContextAndExecuteProcessor(AbstractProcessor* processor) {
tgtAssert(_canvas != 0, "Set a valid canvas before calling this method!");
GLJobProc.enqueueJob(
......@@ -117,4 +119,21 @@ namespace campvis {
_eventHandlers.push_back(eventHandler);
}
void VisualizationPipeline::enableLowQualityMode() {
_lqMode = true;
updateEffectiveRenderTargetSize();
}
void VisualizationPipeline::disableLowQualityMode() {
_lqMode = false;
updateEffectiveRenderTargetSize();
}
void VisualizationPipeline::updateEffectiveRenderTargetSize() {
if (_lqMode)
_effectiveRenderTargetSize.setValue(_renderTargetSize / 2);
else
_effectiveRenderTargetSize.setValue(_renderTargetSize);
}
}
......@@ -104,7 +104,7 @@ namespace campvis {
/**
* Returns the viewport size of the target canvas
* \return _renderTargetSize
* \return _effectiveRenderTargetSize
*/
const tgt::ivec2& getRenderTargetSize() const;
......@@ -120,6 +120,20 @@ namespace campvis {
*/
void addEventHandler(AbstractEventHandler* eventHandler);
/**
* 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();
/// Signal emitted when the pipeline's render target has changed
sigslot::signal0<> s_renderTargetChanged;
......@@ -146,8 +160,17 @@ namespace campvis {
*/
void lockGLContextAndExecuteProcessor(AbstractProcessor* processor);
GenericProperty<tgt::ivec2> _renderTargetSize; ///< Viewport size of target canvas
StringProperty _renderTargetID; ///< ID of the render target image to be rendered to the canvas
/**
* Updates the _effectiveRenderTargetSize property considering LQ mode.
*/
void updateEffectiveRenderTargetSize();
tgt::ivec2 _renderTargetSize; ///< original render target size
bool _lqMode; ///< Flag whether low quality mode is enables
GenericProperty<tgt::ivec2> _effectiveRenderTargetSize; ///< actual size of the render targets (considering LQ mode)
StringProperty _renderTargetID; ///< ID of the render target image to be rendered to the canvas
std::vector<AbstractEventHandler*> _eventHandlers; ///< List of registered event handlers for the pipeline
tgt::GLCanvas* _canvas; ///< Canvas hosting the OpenGL context for this pipeline.
......
......@@ -44,18 +44,18 @@ namespace campvis {
, _imageReader()
, _pgGenerator()
, _vmgGenerator()
, _vmRenderer(_renderTargetSize)
, _eepGenerator(_renderTargetSize)
, _vmEepGenerator(_renderTargetSize)
, _dvrNormal(_renderTargetSize)
, _dvrVM(_renderTargetSize)
, _depthDarkening(_renderTargetSize)
, _combine(_renderTargetSize)
, _vmRenderer(_effectiveRenderTargetSize)
, _eepGenerator(_effectiveRenderTargetSize)
, _vmEepGenerator(_effectiveRenderTargetSize)
, _dvrNormal(_effectiveRenderTargetSize)
, _dvrVM(_effectiveRenderTargetSize)
, _depthDarkening(_effectiveRenderTargetSize)
, _combine(_effectiveRenderTargetSize)
, _trackballEH(0)
{
addProperty(&_camera);
_trackballEH = new TrackballNavigationEventHandler(&_camera, _renderTargetSize.getValue());
_trackballEH = new TrackballNavigationEventHandler(this, &_camera, _renderTargetSize);
_eventHandlers.push_back(_trackballEH);
addProcessor(&_imageReader);
......@@ -150,8 +150,8 @@ namespace campvis {
_depthDarkening.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_combine.s_invalidated.connect<DVRVis>(this, &DVRVis::onProcessorInvalidated);
_trackballEH->setViewportSize(_renderTargetSize.getValue());
_renderTargetSize.s_changed.connect<DVRVis>(this, &DVRVis::onRenderTargetSizeChanged);
_trackballEH->setViewportSize(_effectiveRenderTargetSize.getValue());
_effectiveRenderTargetSize.s_changed.connect<DVRVis>(this, &DVRVis::onRenderTargetSizeChanged);
}
void DVRVis::execute() {
......@@ -225,8 +225,8 @@ namespace campvis {
}
void DVRVis::onRenderTargetSizeChanged(const AbstractProperty* prop) {
_trackballEH->setViewportSize(_renderTargetSize.getValue());
float ratio = static_cast<float>(_renderTargetSize.getValue().x) / static_cast<float>(_renderTargetSize.getValue().y);
_trackballEH->setViewportSize(_renderTargetSize);
float ratio = static_cast<float>(_effectiveRenderTargetSize.getValue().x) / static_cast<float>(_effectiveRenderTargetSize.getValue().y);
_camera.setWindowRatio(ratio);
}
......
......@@ -39,7 +39,7 @@ namespace campvis {
, _imageReader()
, _gvg()
, _lhh()
, _sliceExtractor(_renderTargetSize)
, _sliceExtractor(_effectiveRenderTargetSize)
, _wheelHandler(&_sliceExtractor.p_sliceNumber)
{
addProcessor(&_imageReader);
......
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