14 #ifndef OSGVOLUME_LAYER
15 #define OSGVOLUME_LAYER 1
18 #include <osg/TransferFunction>
20 #include <osgVolume/Locator>
21 #include <osgVolume/Property>
68 virtual void setFileName(
const std::string& filename) { _filename = filename; }
71 virtual const std::string&
getFileName()
const {
return _filename; }
109 void addProperty(
Property* property);
154 void setFileName(
const std::string& filename) { _filename = filename;
if (_image.valid()) _image->setFileName(filename); }
155 virtual const std::string&
getFileName()
const {
return _image.get() ? _image->getFileName() : _filename; }
180 void rescaleToZeroToOneRange();
183 void translateMinToZero();
185 virtual bool requiresUpdateTraversal()
const;
189 virtual void dirty();
190 virtual void setModifiedCount(
unsigned int value);
191 virtual unsigned int getModifiedCount()
const;
216 void setFileName(
unsigned int i,
const std::string& filename) {
if (i>=_layers.size()) _layers.resize(i+1); _layers[i].filename = filename;
if (_layers[i].layer.valid()) _layers[i].layer->setFileName(filename); }
217 const std::string&
getFileName(
unsigned int i)
const {
return _layers[i].layer.valid() ? _layers[i].layer->getFileName() : _layers[i].filename; }
219 void setLayer(
unsigned int i,
Layer* layer) {
if (i>=_layers.size()) _layers.resize(i+1); _layers[i].layer = layer; }
220 Layer*
getLayer(
unsigned int i) {
return i<_layers.size() ? _layers[i].layer.get() : 0; }
221 const Layer*
getLayer(
unsigned int i)
const {
return i<_layers.size() ? _layers[i].layer.get() : 0; }
225 void removeLayer(
unsigned int i) { _layers.erase(_layers.begin()+i); }
229 bool requiresUpdateTraversal()
const;
242 filename(cnl.filename),
251 if (&cnl==
this)
return *
this;
osg::ref_ptr< Locator > _locator
virtual osg::Image * getImage()
virtual const std::string & getFileName() const
void setLocator(Locator *locator)
virtual void setModifiedCount(unsigned int)
OSG_EXPORT bool computeMinMax(const osg::Image *image, osg::Vec4 &min, osg::Vec4 &max)
osg::RefMatrix * getMatrix()
OSGVOLUME_EXPORT osg::Image * applyTransferFunction(osg::Image *image, osg::TransferFunction1D *transferFunction)
void setLayer(unsigned int i, Layer *layer)
virtual void update(osg::NodeVisitor &)
void setProperty(Property *property)
NameLayer(const std::string &fn, Layer *l)
void addLayer(Layer *layer)
osg::Texture::FilterMode getMinFilter() const
void removeLayer(unsigned int i)
osg::Texture::FilterMode getMagFilter() const
void setTexelScale(const osg::Vec4 &scale)
const osg::Vec4 & getTexelOffset() const
Layer * getLayer(unsigned int i)
NameLayer(const NameLayer &cnl)
osg::ref_ptr< osg::RefMatrix > _matrix
const Locator * getLocator() const
virtual unsigned int getModifiedCount() const
#define META_Object(library, name)
void setDefaultValue(const osg::Vec4 &value)
void setTexelOffset(const osg::Vec4 &offset)
virtual const osg::Image * getImage() const
void setMagFilter(osg::Texture::FilterMode filter)
virtual ~CompositeLayer()
OSGVOLUME_EXPORT osg::Image * createNormalMapTexture(osg::Image *image_3d)
OSG_EXPORT bool offsetAndScaleImage(osg::Image *image, const osg::Vec4 &offset, const osg::Vec4 &scale)
osg::ref_ptr< Property > _property
virtual const std::string & getFileName() const
virtual bool requiresUpdateTraversal() const
const osg::Vec4 & getTexelScale() const
void setTexelOffset(const osg::Vec4 &offset)
virtual void setFileName(const std::string &filename)
std::vector< NameLayer > Layers
virtual osg::Image * getImage()
unsigned int getNumLayers() const
virtual const osg::Image * getImage() const
void setFileName(const std::string &filename)
const Layer * getLayer(unsigned int i) const
void setTexelScale(const osg::Vec4 &scale)
osg::Texture::FilterMode _minFilter
const osg::RefMatrix * getMatrix() const
const osg::Vec4 & getTexelOffset() const
const Property * getProperty() const
void setFileName(unsigned int i, const std::string &filename)
osg::ref_ptr< osg::Image > _image
const std::string & getFileName(unsigned int i) const
const osg::Vec4 & getDefaultValue() const
osg::ref_ptr< Layer > layer
void setMatrix(osg::RefMatrix *matrix)
osg::Texture::FilterMode _magFilter
const osg::Vec4 & getTexelScale() const
void setMinFilter(osg::Texture::FilterMode filter)