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

introducing AbstractProcessor::updateProperties(DataContainer&) which is...

introducing AbstractProcessor::updateProperties(DataContainer&) which is automatically called by AbstractPipeline when a processor invalidates its INVALID_PROPERTIES flag
parent 5bb124e2
......@@ -130,15 +130,6 @@ namespace campvis {
}
void VolumeExplorer::process(DataContainer& data) {
if (hasInvalidProperties()) {
DataContainer::ScopedTypedData<ImageData> img(data, p_inputVolume.getValue());
if (img != 0) {
// source DataHandle has changed
updateProperties(img.getDataHandle());
validate(AbstractProcessor::INVALID_PROPERTIES);
}
}
// launch sub-renderers if necessary
if (getInvalidationLevel() & VR_INVALID) {
_raycaster.process(data);
......@@ -249,22 +240,29 @@ namespace campvis {
}
}
void VolumeExplorer::updateProperties(DataHandle img) {
_sliceExtractor.p_transferFunction.getTF()->setImageHandle(img);
static_cast<TransferFunctionProperty*>(_raycaster.getProperty("TransferFunction"))->getTF()->setImageHandle(img);
void VolumeExplorer::updateProperties(DataContainer& dc) {
DataContainer::ScopedTypedData<ImageData> img(dc, p_inputVolume.getValue());
_sliceExtractor.p_transferFunction.getTF()->setImageHandle(img.getDataHandle());
static_cast<TransferFunctionProperty*>(_raycaster.getProperty("TransferFunction"))->getTF()->setImageHandle(img.getDataHandle());
const tgt::svec3& imgSize = static_cast<const ImageData*>(img.getData())->getSize();
const tgt::svec3& imgSize = img->getSize();
if (p_xSlice.getMaxValue() != imgSize.x - 1){
p_xSlice.setMaxValue(static_cast<int>(imgSize.x) - 1);
p_xSlice.setValue(static_cast<int>(imgSize.x) / 2);
}
if (p_ySlice.getMaxValue() != imgSize.y - 1){
p_ySlice.setMaxValue(static_cast<int>(imgSize.y) - 1);
p_ySlice.setValue(static_cast<int>(imgSize.y) / 2);
}
if (p_zSlice.getMaxValue() != imgSize.z - 1){
p_zSlice.setMaxValue(static_cast<int>(imgSize.z) - 1);
p_zSlice.setValue(static_cast<int>(imgSize.z) / 2);
}
_trackballEH->reinitializeCamera(static_cast<const ImageData*>(img.getData()));
_trackballEH->reinitializeCamera(img);
validate(AbstractProcessor::INVALID_PROPERTIES);
}
void VolumeExplorer::onEvent(tgt::Event* e) {
......
......@@ -116,8 +116,8 @@ namespace campvis {
void composeFinalRendering(DataContainer& data);
/// adapts the range of the p_xSliceNumber property to the image
void updateProperties(DataHandle img);
/// \see AbstractProcessor::updateProperties
void updateProperties(DataContainer& dc);
tgt::Shader* _shader; ///< Shader for slice rendering
FaceGeometry* _quad;
......
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