Moved osgVolume::ImageUtils to osg::ImageUtils, updated wrappers, and started moving osgvolume example across to create osgVolume subgraphs

This commit is contained in:
Robert Osfield
2009-01-09 15:19:25 +00:00
parent 9b4c6e25ea
commit 458993fa88
13 changed files with 155 additions and 97 deletions

View File

@@ -11,14 +11,14 @@
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGVOLUME_IMAGEUTILS
#define OSGVOLUME_IMAGEUTILS 1
#ifndef OSG_IMAGEUTILS
#define OSG_IMAGEUTILS 1
#include <osgVolume/Export>
#include <osg/Export>
#include <osg/Image>
namespace osgVolume {
namespace osg {
template <typename T, class O>
void _readRow(unsigned int num, GLenum pixelFormat, const T* data,float scale, O& operation)
@@ -121,17 +121,17 @@ void modifyImage(osg::Image* image, const M& operation)
}
/** Compute the min max colour values in the image.*/
extern OSGVOLUME_EXPORT bool computeMinMax(const osg::Image* image, osg::Vec4& min, osg::Vec4& max);
extern OSG_EXPORT bool computeMinMax(const osg::Image* image, osg::Vec4& min, osg::Vec4& max);
/** Compute the min max colour values in the image.*/
extern OSGVOLUME_EXPORT bool offsetAndScaleImage(osg::Image* image, const osg::Vec4& offset, const osg::Vec4& scale);
extern OSG_EXPORT bool offsetAndScaleImage(osg::Image* image, const osg::Vec4& offset, const osg::Vec4& scale);
/** Compute source image to destination image.*/
extern OSGVOLUME_EXPORT bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int width, int height, int depth,
extern OSG_EXPORT bool copyImage(const osg::Image* srcImage, int src_s, int src_t, int src_r, int width, int height, int depth,
osg::Image* destImage, int dest_s, int dest_t, int dest_r, bool doRescale = false);
/** Compute the min max colour values in the image.*/
extern OSGVOLUME_EXPORT bool clearImageToColor(osg::Image* image, const osg::Vec4& colour);
extern OSG_EXPORT bool clearImageToColor(osg::Image* image, const osg::Vec4& colour);
}

View File

@@ -27,6 +27,8 @@ class OSGVOLUME_EXPORT Locator : public osg::Object
Locator() {}
Locator(const osg::Matrixd& transform) { setTransform(transform); }
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
Locator(const Locator& locator,const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY):
osg::Object(locator, copyop),

View File

@@ -19,6 +19,7 @@
#include <osgDB/ReaderWriter>
#include <osgVolume/Layer>
#include <osgVolume/VolumeTechnique>
namespace osgVolume {
@@ -109,14 +110,19 @@ class OSGVOLUME_EXPORT VolumeTile : public osg::Group
const TileID& getTileID() const { return _tileID; }
void setLocator(osg::RefMatrix* locator) { _locator = locator; }
osg::RefMatrix* getLocator() { return _locator.get(); }
const osg::RefMatrix* getLocator() const { return _locator.get(); }
void setLocator(Locator* locator) { _locator = locator; }
Locator* getLocator() { return _locator.get(); }
const Locator* getLocator() const { return _locator.get(); }
void setImage(unsigned int i, osg::Image* image);
osg::Image* getImage(unsigned int i) { return i<_images.size() ? _images[i].get() : 0; }
const osg::Image* getImage(unsigned int i) const { return i<_images.size() ? _images[i].get() : 0; }
void setLayer(unsigned int i, Layer* layer);
Layer* getLayer(unsigned int i) { return i<_layers.size() ? _layers[i].get() : 0; }
const Layer* getImage(unsigned int i) const { return i<_layers.size() ? _layers[i].get() : 0; }
void addLayer(Layer* layer) { if (layer) _layers.push_back(layer); }
unsigned int getNumLayers() { return _layers.size(); }
/** Set the VolumeTechnique*/
void setVolumeTechnique(VolumeTechnique* VolumeTechnique);
@@ -152,10 +158,10 @@ class OSGVOLUME_EXPORT VolumeTile : public osg::Group
osg::ref_ptr<VolumeTechnique> _volumeTechnique;
osg::ref_ptr<osg::RefMatrix> _locator;
osg::ref_ptr<Locator> _locator;
typedef std::vector< osg::ref_ptr<osg::Image> > Images;
Images _images;
typedef std::vector< osg::ref_ptr<Layer> > Layers;
Layers _layers;
};
}