Added TextureUnit entry to osg::TransferFunction and osgTerrain::Layer

This commit is contained in:
Robert Osfield
2008-02-20 12:34:13 +00:00
parent c1a1f742c3
commit 6516bf4910
10 changed files with 136 additions and 63 deletions

View File

@@ -31,6 +31,13 @@ class OSG_EXPORT TransferFunction : public osg::Referenced
TransferFunction();
/** Set the texture unit to assign layer to if required.
* Negative values signifies that no texture unit has been assigned. */
void setTextureUnit(int textureUnit) { _textureUnit = textureUnit; }
/** Get the texture unit to assign layer to if required.*/
int getTextureUnit() const { return _textureUnit; }
osg::Image* getImage() { return _image.get(); }
const osg::Image* getImage() const { return _image.get(); }
@@ -45,7 +52,9 @@ class OSG_EXPORT TransferFunction : public osg::Referenced
virtual ~TransferFunction();
typedef std::vector<osg::Vec4> Colors;
Colors _colors;
int _textureUnit;
Colors _colors;
osg::ref_ptr<osg::Image> _image;
osg::ref_ptr<osg::Texture> _texture;
osg::ref_ptr<osg::Shader> _shader;

View File

@@ -36,9 +36,20 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object
META_Object(osgTerrain, Layer);
/** Set the file name of the data associated with this layer. */
virtual void setFileName(const std::string& filename) { _filename = filename; }
/** Get the file name of the layer. */
virtual const std::string& getFileName() const { return _filename; }
/** Set the texture unit to assign layer to if required.
* Negative values signifies that no texture unit has been assigned. */
void setTextureUnit(int textureUnit) { _textureUnit = textureUnit; }
/** Get the texture unit to assign layer to if required.*/
int getTextureUnit() const { return _textureUnit; }
void setLocator(Locator* locator) { _locator = locator; }
Locator* getLocator() { return _locator.get(); }
const Locator* getLocator() const { return _locator.get(); }
@@ -167,6 +178,7 @@ class OSGTERRAIN_EXPORT Layer : public osg::Object
virtual ~Layer();
std::string _filename;
int _textureUnit;
osg::ref_ptr<Locator> _locator;
unsigned int _minLevel;
unsigned int _maxLevel;