Added support for using negative scale_x, scale_y and scale_z values in the <volume> tag to allow presentations to flip the imagery
This commit is contained in:
parent
d3cebab9a3
commit
d7cba048f5
@ -1750,10 +1750,12 @@ bool DraggerVolumeTileCallback::receive(const osgManipulator::MotionCommand& com
|
||||
}
|
||||
}
|
||||
|
||||
void SlideShowConstructor::addVolume(const std::string& filename, const PositionData& positionData, const VolumeData& volumeData)
|
||||
void SlideShowConstructor::addVolume(const std::string& filename, const PositionData& in_positionData, const VolumeData& volumeData)
|
||||
{
|
||||
// osg::Object::DataVariance defaultMatrixDataVariance = osg::Object::DYNAMIC; // STATIC
|
||||
|
||||
PositionData positionData(in_positionData);
|
||||
|
||||
std::string foundFile = filename;
|
||||
osg::ref_ptr<osg::Image> image;
|
||||
osg::ref_ptr<osgVolume::Volume> volume;
|
||||
@ -1821,6 +1823,30 @@ void SlideShowConstructor::addVolume(const std::string& filename, const Position
|
||||
|
||||
if (!image && !volume) return;
|
||||
|
||||
if (positionData.scale.x()<0.0)
|
||||
{
|
||||
image->flipHorizontal();
|
||||
positionData.scale.x() = fabs(positionData.scale.x());
|
||||
|
||||
OSG_INFO<<"addVolume(..) image->flipHorizontal();"<<std::endl;
|
||||
}
|
||||
|
||||
if (positionData.scale.y()<0.0)
|
||||
{
|
||||
image->flipVertical();
|
||||
positionData.scale.y() = fabs(positionData.scale.y());
|
||||
|
||||
OSG_INFO<<"addVolume(..) image->flipVertical();"<<std::endl;
|
||||
}
|
||||
|
||||
if (positionData.scale.z()<0.0)
|
||||
{
|
||||
image->flipDepth();
|
||||
positionData.scale.z() = fabs(positionData.scale.z());
|
||||
|
||||
OSG_INFO<<"addVolume(..) image->flipDepth();"<<std::endl;
|
||||
}
|
||||
|
||||
if (volume.valid())
|
||||
{
|
||||
if (!tile)
|
||||
|
Loading…
Reference in New Issue
Block a user