Added support s/getImage(uint i) and getNumImages().

This commit is contained in:
Robert Osfield
2004-07-27 10:11:45 +00:00
parent a4f93740d1
commit bb5576bef8
14 changed files with 91 additions and 35 deletions

View File

@@ -19,7 +19,7 @@
#include <osg/Export>
#define USE_REF_MUTEX 1
// #define USE_REF_MUTEX 1
namespace osg {

View File

@@ -315,6 +315,20 @@ class SG_EXPORT Texture : public osg::StateAttribute
void setShadowAmbient(float shadow_ambient) { _shadow_ambient = shadow_ambient; }
float getShadowAmbient() { return _shadow_ambient; }
/** Set the texture image for specified face. */
virtual void setImage(unsigned int face, Image* image) = 0;
/** Get the texture image for specified face. */
virtual Image* getImage(unsigned int face) = 0;
/** Get the const texture image for specified face. */
virtual const Image* getImage(unsigned int face) const = 0;
/** Get the number of images that can be assigned to the Texture. */
virtual unsigned int getNumImages() const = 0;
/** Texture is pure virtual base class, apply must be overriden. */
virtual void apply(State& state) const = 0;

View File

@@ -58,6 +58,19 @@ class SG_EXPORT Texture1D : public Texture
}
/** Set the texture image, ignoring face. as there is only one image*/
virtual void setImage(unsigned int, Image* image) { setImage(image); }
/** Get the texture image, ignoring face value as there is only one image. */
virtual Image* getImage(unsigned int) { return _image.get(); }
/** Get the const texture image , ignoring face value as there is only one image. */
virtual const Image* getImage(unsigned int) const { return _image.get(); }
/** Get the number of images that can be assigned to the Texture. */
virtual unsigned int getNumImages() const { return 1; }
/** Set the texture width and height. If width or height are zero then
* the repsective size value is calculated from the source image sizes. */
inline void setTextureSize(int width) const

View File

@@ -57,6 +57,20 @@ class SG_EXPORT Texture2D : public Texture
return _modifiedTag[contextID];
}
/** Set the texture image, ignoring face. as there is only one image*/
virtual void setImage(unsigned int, Image* image) { setImage(image); }
/** Get the texture image, ignoring face value as there is only one image. */
virtual Image* getImage(unsigned int) { return _image.get(); }
/** Get the const texture image , ignoring face value as there is only one image. */
virtual const Image* getImage(unsigned int) const { return _image.get(); }
/** Get the number of images that can be assigned to the Texture. */
virtual unsigned int getNumImages() const { return 1; }
/** Set the texture width and height. If width or height are zero then
* the repsective size value is calculated from the source image sizes. */
inline void setTextureSize(int width, int height) const

View File

@@ -55,6 +55,19 @@ class SG_EXPORT Texture3D : public Texture
return _modifiedTag[contextID];
}
/** Set the texture image, ignoring face. as there is only one image*/
virtual void setImage(unsigned int, Image* image) { setImage(image); }
/** Get the texture image, ignoring face value as there is only one image. */
virtual Image* getImage(unsigned int) { return _image.get(); }
/** Get the const texture image , ignoring face value as there is only one image. */
virtual const Image* getImage(unsigned int) const { return _image.get(); }
/** Get the number of images that can be assigned to the Texture. */
virtual unsigned int getNumImages() const { return 1; }
/** Set the texture width and height. If width or height are zero then
* the repsective size value is calculated from the source image sizes. */
inline void setTextureSize(int width, int height, int depth) const

View File

@@ -54,15 +54,18 @@ class SG_EXPORT TextureCubeMap : public Texture
};
/** Set the texture image for specified face. */
void setImage(Face, Image* image);
virtual void setImage(unsigned int face, Image* image);
/** Get the texture image for specified face. */
Image* getImage(Face);
virtual Image* getImage(unsigned int face);
/** Get the const texture image for specified face. */
const Image* getImage(Face) const;
virtual const Image* getImage(unsigned int face) const;
inline unsigned int& getModifiedTag(Face face,unsigned int contextID) const
/** Get the number of images that can be assigned to the Texture. */
virtual unsigned int getNumImages() const { return 6; }
inline unsigned int& getModifiedTag(unsigned int face,unsigned int contextID) const
{
// get the modified tag for the current contextID.
return _modifiedTag[face][contextID];

View File

@@ -65,6 +65,20 @@ class SG_EXPORT TextureRectangle : public Texture
return _modifiedTag[contextID];
}
/** Set the texture image, ignoring face. as there is only one image*/
virtual void setImage(unsigned int, Image* image) { setImage(image); }
/** Get the texture image, ignoring face value as there is only one image. */
virtual Image* getImage(unsigned int) { return _image.get(); }
/** Get the const texture image , ignoring face value as there is only one image. */
virtual const Image* getImage(unsigned int) const { return _image.get(); }
/** Get the number of images that can be assigned to the Texture. */
virtual unsigned int getNumImages() const { return 1; }
/** Set the texture width and height. If width or height are zero then
* the repsective size value is calculated from the source image sizes. */
inline void setTextureSize(int width, int height) const