2014-07-03 00:26:18 +08:00
|
|
|
/* -*-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.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef OSGVOLUMESETTINGS
|
|
|
|
#define OSGVOLUMESETTINGS 1
|
|
|
|
|
|
|
|
#include <osg/Object>
|
2014-07-03 18:01:46 +08:00
|
|
|
#include <osgVolume/Property>
|
2014-07-03 00:26:18 +08:00
|
|
|
|
|
|
|
namespace osgVolume {
|
|
|
|
|
2014-07-03 18:01:46 +08:00
|
|
|
class OSGVOLUME_EXPORT VolumeSettings : public Property
|
2014-07-03 00:26:18 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
|
|
|
VolumeSettings();
|
|
|
|
|
|
|
|
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
|
|
|
|
VolumeSettings(const VolumeSettings&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
|
|
|
|
|
|
|
|
META_Object(osgVolume, VolumeSettings);
|
|
|
|
|
2014-07-03 18:01:46 +08:00
|
|
|
virtual void accept(PropertyVisitor& pv);
|
2014-07-05 00:45:05 +08:00
|
|
|
virtual void traverse(PropertyVisitor& pv);
|
2014-07-03 18:01:46 +08:00
|
|
|
|
2014-08-26 00:56:47 +08:00
|
|
|
void setFilename(const std::string& str) { _filename = str; dirty(); }
|
2014-07-24 00:36:17 +08:00
|
|
|
const std::string& getFilename() const { return _filename; }
|
|
|
|
|
2014-07-03 00:26:18 +08:00
|
|
|
enum Technique
|
|
|
|
{
|
|
|
|
FixedFunction,
|
|
|
|
RayTraced,
|
|
|
|
MultiPass
|
|
|
|
};
|
|
|
|
|
2014-08-26 00:56:47 +08:00
|
|
|
void setTechnique(Technique technique) { _technique = technique; dirty(); }
|
2014-07-03 00:26:18 +08:00
|
|
|
Technique getTechnique() const { return _technique; }
|
|
|
|
|
|
|
|
enum ShadingModel
|
|
|
|
{
|
|
|
|
Standard,
|
|
|
|
Light,
|
|
|
|
Isosurface,
|
|
|
|
MaximumIntensityProjection
|
|
|
|
};
|
|
|
|
|
2014-08-26 00:56:47 +08:00
|
|
|
void setShadingModel(ShadingModel sm) { _shadingModel = sm; dirty(); }
|
2014-07-03 00:26:18 +08:00
|
|
|
ShadingModel getShadingModel() const { return _shadingModel; }
|
|
|
|
|
2014-08-26 00:56:47 +08:00
|
|
|
void setSampleRatio(float sr) { _sampleRatioProperty->setValue(sr); dirty(); }
|
2014-07-03 18:01:46 +08:00
|
|
|
float getSampleRatio() const { return _sampleRatioProperty->getValue(); }
|
2014-07-03 00:26:18 +08:00
|
|
|
|
2014-08-26 00:56:47 +08:00
|
|
|
void setSampleRatioWhenMoving(float sr) { _sampleRatioWhenMovingProperty->setValue(sr); dirty(); }
|
2014-07-03 18:01:46 +08:00
|
|
|
float getSampleRatioWhenMoving() const { return _sampleRatioWhenMovingProperty->getValue(); }
|
2014-09-03 23:54:47 +08:00
|
|
|
|
|
|
|
void setCutoff(float co);
|
|
|
|
float getCutoff() const { return _cutoffProperty->getValue(); }
|
|
|
|
|
|
|
|
void setTransparency(float t) { _transparencyProperty->setValue(t); dirty(); }
|
|
|
|
float getTransparency() const { return _transparencyProperty->getValue(); }
|
|
|
|
|
|
|
|
|
|
|
|
SampleRatioProperty* getSampleRatioProperty() { return _sampleRatioProperty.get(); }
|
|
|
|
const SampleRatioProperty* getSampleRatioProperty() const { return _sampleRatioProperty.get(); }
|
|
|
|
|
2014-08-26 00:56:47 +08:00
|
|
|
SampleRatioWhenMovingProperty* getSampleRatioWhenMovingProperty() { return _sampleRatioWhenMovingProperty.get(); }
|
|
|
|
const SampleRatioWhenMovingProperty* getSampleRatioWhenMovingProperty() const { return _sampleRatioWhenMovingProperty.get(); }
|
2014-07-03 00:26:18 +08:00
|
|
|
|
2014-08-26 00:56:47 +08:00
|
|
|
AlphaFuncProperty* getCutoffProperty() { return _cutoffProperty.get(); }
|
|
|
|
const AlphaFuncProperty* getCutoffProperty() const { return _cutoffProperty.get(); }
|
2014-07-03 00:26:18 +08:00
|
|
|
|
2014-08-26 00:56:47 +08:00
|
|
|
TransparencyProperty* getTransparencyProperty() { return _transparencyProperty.get(); }
|
|
|
|
const TransparencyProperty* getTransparencyProperty() const { return _transparencyProperty.get(); }
|
2014-07-03 00:26:18 +08:00
|
|
|
|
2014-09-03 23:54:47 +08:00
|
|
|
IsoSurfaceProperty* getIsoSurfaceProperty() { return _isoSurfaceProperty.get(); }
|
|
|
|
const IsoSurfaceProperty* getIsoSurfaceProperty() const { return _isoSurfaceProperty.get(); }
|
|
|
|
|
|
|
|
protected:
|
2014-07-03 00:26:18 +08:00
|
|
|
|
|
|
|
virtual ~VolumeSettings() {}
|
|
|
|
|
2014-07-24 00:36:17 +08:00
|
|
|
std::string _filename;
|
|
|
|
|
2014-07-03 00:26:18 +08:00
|
|
|
Technique _technique;
|
|
|
|
ShadingModel _shadingModel;
|
|
|
|
|
2014-07-03 18:01:46 +08:00
|
|
|
osg::ref_ptr<SampleRatioProperty> _sampleRatioProperty;
|
|
|
|
osg::ref_ptr<SampleRatioWhenMovingProperty> _sampleRatioWhenMovingProperty;
|
|
|
|
osg::ref_ptr<AlphaFuncProperty> _cutoffProperty;
|
|
|
|
osg::ref_ptr<TransparencyProperty> _transparencyProperty;
|
2014-09-03 23:54:47 +08:00
|
|
|
osg::ref_ptr<IsoSurfaceProperty> _isoSurfaceProperty;
|
2014-07-03 00:26:18 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|