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

Added onDataContainerDataAdded overload to AbstractPipeline to set pipeline...

Added onDataContainerDataAdded overload to AbstractPipeline to set pipeline dirty when the render target image has changed. Rendering of multiple canvases at the same time still broken though.

refs #641
parent fef9f926
...@@ -64,6 +64,8 @@ namespace campvis { ...@@ -64,6 +64,8 @@ namespace campvis {
} }
void AbstractPipeline::init() { void AbstractPipeline::init() {
_data->s_dataAdded.connect(this, &AbstractPipeline::onDataContainerDataAdded);
initAllProperties(); initAllProperties();
// initialize all processors: // initialize all processors:
...@@ -81,6 +83,8 @@ namespace campvis { ...@@ -81,6 +83,8 @@ namespace campvis {
} }
void AbstractPipeline::deinit() { void AbstractPipeline::deinit() {
_data->s_dataAdded.disconnect(this);
// use trigger signal to enforce blocking call // use trigger signal to enforce blocking call
s_deinit.triggerSignal(); s_deinit.triggerSignal();
...@@ -276,6 +280,10 @@ namespace campvis { ...@@ -276,6 +280,10 @@ namespace campvis {
return _processors[index]; return _processors[index];
} }
void AbstractPipeline::onDataContainerDataAdded(std::string name, DataHandle dh) {
if (name == _renderTargetID.getValue())
setPipelineDirty();
}
void AbstractPipeline::forceExecuteProcessor(AbstractProcessor* processor) { void AbstractPipeline::forceExecuteProcessor(AbstractProcessor* processor) {
bool enabledState = processor->getEnabled(); bool enabledState = processor->getEnabled();
...@@ -287,5 +295,4 @@ namespace campvis { ...@@ -287,5 +295,4 @@ namespace campvis {
} }
} }
...@@ -231,6 +231,14 @@ namespace campvis { ...@@ -231,6 +231,14 @@ namespace campvis {
*/ */
void executeProcessorAndCheckOpenGLState(AbstractProcessor* processor); void executeProcessorAndCheckOpenGLState(AbstractProcessor* processor);
/**
* Gets called when the data collection of this pipeline has changed and thus has notified its observers.
* If \a name equals the name of the renderTarget, setPipelineDirty will be called.
* \param name Name of the added data.
* \param dh DataHandle to the newly added data.
*/
virtual void onDataContainerDataAdded(std::string name, DataHandle dh);
/** /**
* Slot getting called when one of the observed properties changed and notifies its observers. * Slot getting called when one of the observed properties changed and notifies its observers.
* The default behaviour is just to set the invalidation level to invalid. * The default behaviour is just to set the invalidation level to invalid.
......
// ================================================================================================ // ================================================================================================
// //
// This file is part of the CAMPVis Software Framework. // This file is part of the CAMPVis Software Framework.
// //
// If not explicitly stated otherwise: Copyright (C) 2012-2014, all rights reserved, // If not explicitly stated otherwise: Copyright (C) 2012-2014, all rights reserved,
// Christian Schulte zu Berge <christian.szb@in.tum.de> // Christian Schulte zu Berge <christian.szb@in.tum.de>
// Chair for Computer Aided Medical Procedures // Chair for Computer Aided Medical Procedures
// Technische Universitaet Muenchen // Technische Universitaet Muenchen
// Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany // Boltzmannstr. 3, 85748 Garching b. Muenchen, Germany
// //
// For a full list of authors and contributors, please refer to the file "AUTHORS.txt". // For a full list of authors and contributors, please refer to the file "AUTHORS.txt".
// //
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file // Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file
// except in compliance with the License. You may obtain a copy of the License at // except in compliance with the License. You may obtain a copy of the License at
// //
// http://www.apache.org/licenses/LICENSE-2.0 // http://www.apache.org/licenses/LICENSE-2.0
// //
// Unless required by applicable law or agreed to in writing, software distributed under the // Unless required by applicable law or agreed to in writing, software distributed under the
// License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, // License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
// either express or implied. See the License for the specific language governing permissions // either express or implied. See the License for the specific language governing permissions
// and limitations under the License. // and limitations under the License.
// //
// ================================================================================================ // ================================================================================================
#include "autoevaluationpipeline.h" #include "autoevaluationpipeline.h"
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
namespace campvis { namespace campvis {
const std::string AutoEvaluationPipeline::loggerCat_ = "CAMPVis.core.datastructures.AutoEvaluationPipeline"; const std::string AutoEvaluationPipeline::loggerCat_ = "CAMPVis.core.datastructures.AutoEvaluationPipeline";
AutoEvaluationPipeline::AutoEvaluationPipeline(DataContainer* dc) AutoEvaluationPipeline::AutoEvaluationPipeline(DataContainer* dc)
: AbstractPipeline(dc) : AbstractPipeline(dc)
{ {
} }
...@@ -44,16 +44,13 @@ namespace campvis { ...@@ -44,16 +44,13 @@ namespace campvis {
void AutoEvaluationPipeline::init() { void AutoEvaluationPipeline::init() {
AbstractPipeline::init(); AbstractPipeline::init();
_data->s_dataAdded.connect(this, &AutoEvaluationPipeline::onDataContainerDataAdded);
} }
void AutoEvaluationPipeline::deinit() { void AutoEvaluationPipeline::deinit() {
_data->s_dataAdded.disconnect(this);
for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) { for (std::vector<AbstractProcessor*>::iterator it = _processors.begin(); it != _processors.end(); ++it) {
(*it)->s_invalidated.disconnect(this); (*it)->s_invalidated.disconnect(this);
} }
AbstractPipeline::deinit(); AbstractPipeline::deinit();
} }
...@@ -73,7 +70,7 @@ namespace campvis { ...@@ -73,7 +70,7 @@ namespace campvis {
} }
void AutoEvaluationPipeline::executePipeline() { void AutoEvaluationPipeline::executePipeline() {
// execute each processor once // execute each processor once
// (AbstractProcessor::process() takes care of executing only invalid processors) // (AbstractProcessor::process() takes care of executing only invalid processors)
for (size_t i = 0; i < _processors.size(); ++i) { for (size_t i = 0; i < _processors.size(); ++i) {
executeProcessorAndCheckOpenGLState(_processors[i]); executeProcessorAndCheckOpenGLState(_processors[i]);
...@@ -129,6 +126,8 @@ namespace campvis { ...@@ -129,6 +126,8 @@ namespace campvis {
void AutoEvaluationPipeline::onDataContainerDataAdded(std::string name, DataHandle dh) { void AutoEvaluationPipeline::onDataContainerDataAdded(std::string name, DataHandle dh) {
{ {
AbstractPipeline::onDataContainerDataAdded(name, dh);
// acquire read lock // acquire read lock
tbb::spin_rw_mutex::scoped_lock lock(_pmMutex, false); tbb::spin_rw_mutex::scoped_lock lock(_pmMutex, false);
......
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