openscenegraph
VolumeSettings
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGVOLUMESETTINGS
15#define OSGVOLUMESETTINGS 1
16
17#include <osg/Object>
18#include <osgVolume/Property>
19
20namespace osgVolume {
21
22class OSGVOLUME_EXPORT VolumeSettings : public Property
23{
24 public:
25
26 VolumeSettings();
27
28 /** Copy constructor using CopyOp to manage deep vs shallow copy.*/
29 VolumeSettings(const VolumeSettings&,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
30
31 META_Object(osgVolume, VolumeSettings);
32
33 virtual void accept(PropertyVisitor& pv);
34 virtual void traverse(PropertyVisitor& pv);
35
36 void setFilename(const std::string& str) { _filename = str; dirty(); }
37 const std::string& getFilename() const { return _filename; }
38
39 enum Technique
40 {
41 FixedFunction,
42 RayTraced,
43 MultiPass
44 };
45
46 void setTechnique(Technique technique) { _technique = technique; dirty(); }
47 Technique getTechnique() const { return _technique; }
48
49 enum ShadingModel
50 {
51 Standard,
52 Light,
53 Isosurface,
54 MaximumIntensityProjection
55 };
56
57 void setShadingModel(ShadingModel sm) { _shadingModel = sm; dirty(); }
58 ShadingModel getShadingModel() const { return _shadingModel; }
59
60 void setSampleRatio(float sr) { _sampleRatioProperty->setValue(sr); dirty(); }
61 float getSampleRatio() const { return _sampleRatioProperty->getValue(); }
62
63 void setSampleRatioWhenMoving(float sr) { _sampleRatioWhenMovingProperty->setValue(sr); dirty(); }
64 float getSampleRatioWhenMoving() const { return _sampleRatioWhenMovingProperty->getValue(); }
65
66 void setCutoff(float co);
67 float getCutoff() const { return _cutoffProperty->getValue(); }
68
69 void setTransparency(float t) { _transparencyProperty->setValue(t); dirty(); }
70 float getTransparency() const { return _transparencyProperty->getValue(); }
71
72
73 SampleRatioProperty* getSampleRatioProperty() { return _sampleRatioProperty.get(); }
74 const SampleRatioProperty* getSampleRatioProperty() const { return _sampleRatioProperty.get(); }
75
76 SampleRatioWhenMovingProperty* getSampleRatioWhenMovingProperty() { return _sampleRatioWhenMovingProperty.get(); }
77 const SampleRatioWhenMovingProperty* getSampleRatioWhenMovingProperty() const { return _sampleRatioWhenMovingProperty.get(); }
78
79 AlphaFuncProperty* getCutoffProperty() { return _cutoffProperty.get(); }
80 const AlphaFuncProperty* getCutoffProperty() const { return _cutoffProperty.get(); }
81
82 TransparencyProperty* getTransparencyProperty() { return _transparencyProperty.get(); }
83 const TransparencyProperty* getTransparencyProperty() const { return _transparencyProperty.get(); }
84
85 IsoSurfaceProperty* getIsoSurfaceProperty() { return _isoSurfaceProperty.get(); }
86 const IsoSurfaceProperty* getIsoSurfaceProperty() const { return _isoSurfaceProperty.get(); }
87
88protected:
89
90 virtual ~VolumeSettings() {}
91
92 std::string _filename;
93
94 Technique _technique;
95 ShadingModel _shadingModel;
96
97 osg::ref_ptr<SampleRatioProperty> _sampleRatioProperty;
98 osg::ref_ptr<SampleRatioWhenMovingProperty> _sampleRatioWhenMovingProperty;
99 osg::ref_ptr<AlphaFuncProperty> _cutoffProperty;
100 osg::ref_ptr<TransparencyProperty> _transparencyProperty;
101 osg::ref_ptr<IsoSurfaceProperty> _isoSurfaceProperty;
102};
103
104}
105
106#endif