Introduced osgVolume::Property, CompositePropery and TransferFunctionPropety classes

This commit is contained in:
Robert Osfield
2009-01-14 15:16:29 +00:00
parent c21eef7afb
commit d87ec7cb18
26 changed files with 625 additions and 111 deletions

View File

@@ -12,6 +12,7 @@ SET(LIB_PUBLIC_HEADERS
${HEADER_PATH}/FixedFunctionTechnique
${HEADER_PATH}/Layer
${HEADER_PATH}/Locator
${HEADER_PATH}/Property
${HEADER_PATH}/ShaderTechnique
${HEADER_PATH}/Version
${HEADER_PATH}/Volume
@@ -26,6 +27,7 @@ ADD_LIBRARY(${LIB_NAME}
FixedFunctionTechnique.cpp
Layer.cpp
Locator.cpp
Property.cpp
ShaderTechnique.cpp
Version.cpp
Volume.cpp

View File

@@ -1,4 +1,4 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or

View File

@@ -1,4 +1,4 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or

View File

@@ -0,0 +1,63 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#include <osgVolume/Property>
using namespace osgVolume;
Property::Property()
{
}
Property::Property(const Property& property,const osg::CopyOp& copyop):
osg::Object(property,copyop)
{
}
Property::~Property()
{
}
/////////////////////////////////////////////////////////////////////////////
//
// CompositeProperty
//
CompositeProperty::CompositeProperty()
{
}
CompositeProperty::CompositeProperty(const CompositeProperty& compositeProperty,const osg::CopyOp& copyop):
Property(compositeProperty,copyop)
{
}
void CompositeProperty::clear()
{
_properties.clear();
}
/////////////////////////////////////////////////////////////////////////////
//
// TransferFunctionProperty
//
TransferFunctionProperty::TransferFunctionProperty(osg::TransferFunction* tf):
_tf(tf)
{
}
TransferFunctionProperty::TransferFunctionProperty(const TransferFunctionProperty& tfp,const osg::CopyOp& copyop):
Property(tfp,copyop),
_tf(tfp._tf)
{
}

View File

@@ -63,22 +63,13 @@ void ShaderTechnique::init()
osg::Image* image_3d = 0;
osg::TransferFunction1D* tf = 0;
osgVolume::Locator* masterLocator = _volumeTile->getLocator();
for(unsigned int i = 0;
i < _volumeTile->getNumLayers();
++i)
image_3d = _volumeTile->getLayer()->getImage();
if (_volumeTile->getLayer() && !masterLocator)
{
if (_volumeTile->getLayer(i) && !masterLocator)
{
masterLocator = _volumeTile->getLayer(i)->getLocator();
osg::notify(osg::NOTICE)<<"assigning locator = "<<masterLocator<<std::endl;
}
if (_volumeTile->getLayer(i)->getImage())
{
osg::notify(osg::NOTICE)<<"assigning image = "<<std::endl;
image_3d = _volumeTile->getLayer(i)->getImage();
tf = dynamic_cast<osg::TransferFunction1D*>(_volumeTile->getLayer(i)->getTransferFunction());
}
masterLocator = _volumeTile->getLayer()->getLocator();
osg::notify(osg::NOTICE)<<"assigning locator = "<<masterLocator<<std::endl;
}
osg::Matrix matrix;

View File

@@ -1,4 +1,4 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or

View File

@@ -1,4 +1,4 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or

View File

@@ -1,4 +1,4 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or

View File

@@ -1,4 +1,4 @@
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2008 Robert Osfield
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
@@ -35,7 +35,7 @@ VolumeTile::VolumeTile(const VolumeTile& volumeTile,const osg::CopyOp& copyop):
_volume(0),
_dirty(false),
_hasBeenTraversal(false),
_layers(volumeTile._layers)
_layer(volumeTile._layer)
{
if (volumeTile.getVolumeTechnique()) ;
{
@@ -48,13 +48,6 @@ VolumeTile::~VolumeTile()
if (_volume) setVolume(0);
}
void VolumeTile::setLayer(unsigned int i, Layer* layer)
{
if (_layers.size() <= i) _layers.resize(i+1);
_layers[i] = layer;
}
void VolumeTile::setVolume(Volume* volume)
{
if (_volume == volume) return;
@@ -165,16 +158,7 @@ void VolumeTile::setDirty(bool dirty)
osg::BoundingSphere VolumeTile::computeBound() const
{
osg::BoundingSphere bs;
if (_layer.valid()) return _layer->computeBound();
for(Layers::const_iterator itr = _layers.begin();
itr != _layers.end();
++itr)
{
if (itr->valid()) bs.expandBy((*itr)->computeBound());
}
return bs;
return bs;
return osg::BoundingSphere();
}