14 #ifndef OSGVOLUME_PROPERTY
15 #define OSGVOLUME_PROPERTY 1
17 #include <osg/TransferFunction>
18 #include <osg/Uniform>
19 #include <osg/AlphaFunc>
21 #include <osgGA/GUIEventHandler>
23 #include <osgVolume/Export>
29 class CompositeProperty;
31 class TransferFunctionProperty;
33 class IsoSurfaceProperty;
34 class MaximumIntensityProjectionProperty;
35 class LightingProperty;
36 class AlphaFuncProperty;
37 class SampleRatioProperty;
38 class SampleRatioWhenMovingProperty;
39 class SampleDensityProperty;
40 class SampleDensityWhenMovingProperty;
41 class TransparencyProperty;
42 class ExteriorTransparencyFactorProperty;
85 void dirty() { ++_modifiedCount; }
115 for(Properties::iterator itr = _properties.begin();
116 itr != _properties.end();
127 void setProperty(
unsigned int i,
Property* property) {
if (i>=_properties.size()) _properties.resize(i+1); _properties[i] = property; }
131 const Property*
getProperty(
unsigned int i)
const {
return i<_properties.size() ? _properties[i].get() : 0; }
135 void removeProperty(
unsigned int i) { _properties.erase(_properties.begin()+i); }
165 if (_activeProperty>=0 && static_cast<unsigned int>(_activeProperty)<=getNumProperties())
167 _properties[_activeProperty]->accept(pv);
235 virtual void setValue(
float v) { _uniform->set(v); dirty(); }
238 float getValue()
const {
float v; _uniform->get(v);
return v; }
285 virtual void setValue(
float v);
const osg::Uniform * getUniform() const
virtual ~AlphaFuncProperty()
virtual void setValue(float v)
osg::ref_ptr< ExteriorTransparencyFactorProperty > _exteriorTransparencyFactorProperty
virtual void accept(PropertyVisitor &pv)
virtual void accept(PropertyVisitor &pv)
void setKeyEventCycleBackward(int key)
Property * getProperty(unsigned int i)
const osg::TransferFunction * getTransferFunction() const
osg::ref_ptr< MaximumIntensityProjectionProperty > _mipProperty
osg::ref_ptr< TransparencyProperty > _transparencyProperty
void setModifiedCount(unsigned int c)
virtual void accept(PropertyVisitor &pv)
virtual ~ExteriorTransparencyFactorProperty()
unsigned int _modifiedCount
osg::ref_ptr< SampleDensityProperty > _sampleDensityProperty
virtual void accept(PropertyVisitor &pv)
virtual ~SampleDensityProperty()
virtual bool run(osg::Object *object, osg::Object *data)
osg::ref_ptr< SampleRatioWhenMovingProperty > _sampleRatioWhenMovingProperty
virtual ~PropertyVisitor()
virtual void accept(PropertyVisitor &pv)
virtual ~LightingProperty()
int getKeyEventCycleBackward() const
virtual ~SwitchProperty()
osg::ref_ptr< osg::AlphaFunc > _alphaFunc
void setKeyEventActivatesExteriorTransparencyFactorAdjustment(int key)
void setActiveProperty(int i)
virtual ~TransferFunctionProperty()
virtual ~SampleRatioProperty()
virtual void accept(PropertyVisitor &pv)
int getKeyEventActivatesAlphaFuncAdjustment() const
osg::ref_ptr< LightingProperty > _lightingProperty
#define META_Object(library, name)
virtual ~ScalarProperty()
bool _updateExteriorTransparencyFactor
virtual void accept(PropertyVisitor &pv)
const osg::AlphaFunc * getAlphaFunc() const
std::vector< osg::ref_ptr< Property > > Properties
virtual void accept(PropertyVisitor &pv)
int getKeyEventActivatesTransparencyAdjustment() const
virtual void accept(PropertyVisitor &pv)
virtual ~MaximumIntensityProjectionProperty()
virtual void traverse(PropertyVisitor &pv)
unsigned int getModifiedCount() const
virtual void apply(Property &)
osg::ref_ptr< SampleRatioProperty > _sampleRatioProperty
virtual void accept(PropertyVisitor &pv)
virtual ~IsoSurfaceProperty()
virtual void traverse(PropertyVisitor &pv)
virtual void accept(PropertyVisitor &pv)
osg::ref_ptr< TransferFunctionProperty > _tfProperty
virtual void traverse(PropertyVisitor &pv)
virtual ~CompositeProperty()
virtual void accept(PropertyVisitor &pv)
int _exteriorTransparencyFactorKey
bool _traverseOnlyActiveChildren
virtual void accept(PropertyVisitor &pv)
void setKeyEventActivatesAlphaFuncAdjustment(int key)
unsigned int getNumProperties() const
virtual ~SampleDensityWhenMovingProperty()
osg::ref_ptr< AlphaFuncProperty > _afProperty
void removeProperty(unsigned int i)
int getActiveProperty() const
osg::Uniform * getUniform()
void setProperty(unsigned int i, Property *property)
osg::TransferFunction * getTransferFunction()
virtual void accept(PropertyVisitor &pv)
virtual ~TransparencyProperty()
virtual void accept(PropertyVisitor &pv)
void addProperty(Property *property)
osg::ref_ptr< osg::TransferFunction > _tf
virtual bool run(osg::Object *object, osg::Object *data)
const Property * getProperty(unsigned int i) const
void setKeyEventActivatesSampleDensityAdjustment(int key)
virtual ~SampleRatioWhenMovingProperty()
void setKeyEventCycleForward(int key)
osg::ref_ptr< SampleDensityWhenMovingProperty > _sampleDensityWhenMovingProperty
int getKeyEventActivatesExteriorTransparencyFactorAdjustment() const
void setTransferFunction(osg::TransferFunction *tf)
osg::AlphaFunc * getAlphaFunc()
osg::ref_ptr< osg::Uniform > _uniform
osg::ref_ptr< IsoSurfaceProperty > _isoProperty
void setKeyEventActivatesTransparencyAdjustment(int key)
int getKeyEventCycleForward() const
bool _updateSampleDensity
int getKeyEventActivatesSampleDensityAdjustment() const