OpenSceneGraph/include/osg/TextureCubeMap

71 lines
2.1 KiB
Plaintext
Raw Normal View History

//C++ header - Open Scene Graph - Copyright (C) 1998-2001 Robert Osfield
//Distributed under the terms of the GNU Library General Public License (LGPL)
//as published by the Free Software Foundation.
// -*-c++-*-
#ifndef OSG_TEXTURECUBEMAP
#define OSG_TEXTURECUBEMAP 1
#include <osg/Texture>
#ifndef GL_TEXTURE_CUBE_MAP
#define GL_TEXTURE_CUBE_MAP 0x8513
#endif
namespace osg {
/** TextureCubeMap state class which encapsulates OpenGl texture cubemap functionality.*/
class SG_EXPORT TextureCubeMap : public Texture
{
public :
TextureCubeMap();
/** Copy constructor using CopyOp to manage deep vs shallow copy.*/
TextureCubeMap(const TextureCubeMap& cm,const CopyOp& copyop=CopyOp::SHALLOW_COPY):
Texture(cm,copyop) {}
META_StateAttribute(osg, TextureCubeMap,(Type)(TEXTURE_0+_textureUnit));
/** return -1 if *this < *rhs, 0 if *this==*rhs, 1 if *this>*rhs.*/
virtual int compare(const StateAttribute& rhs) const;
enum Face {
POSITIVE_X=0,
NEGATIVE_X=1,
POSITIVE_Y=2,
NEGATIVE_Y=3,
POSITIVE_Z=4,
NEGATIVE_Z=5
};
/** Set the texture image for specified face. */
void setImage(const Face, Image* image);
/** Get the texture image for specified face. */
Image* getImage(const Face);
/** Get the const texture image for specified face. */
const Image* getImage(const Face) const;
/** On first apply (unless already compiled), create the minmapped
* texture and bind it, subsequent apply will simple bind to texture.*/
virtual void apply(State& state) const;
protected :
virtual ~TextureCubeMap();
bool imagesValid() const;
void setImage(Image*) {} // prevent call to Texture::setImage(Image* image)
Image* getImage() { return _image.get(); } // prevent call to Texture::setImage(Image* image)
const Image* getImage() const { return _image.get(); } // prevent call to Texture::setImage(Image* image)
mutable ref_ptr<Image> _images[6];
};
}
#endif