Added osg::TextureCubeMap. submission from Brede Johansen.
This commit is contained in:
64
include/osg/TextureCubeMap
Normal file
64
include/osg/TextureCubeMap
Normal file
@@ -0,0 +1,64 @@
|
||||
//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>
|
||||
|
||||
|
||||
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(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. */
|
||||
void setImage( const Face, Image* image);
|
||||
|
||||
/** 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;
|
||||
|
||||
/** Method which does the creation of the texture itself, and
|
||||
* does not set or use texture binding. */
|
||||
virtual void applyImmediateMode(State& state) const;
|
||||
virtual void applyFaceImmediateMode(GLenum facetarget, Image* image, State& state) const;
|
||||
|
||||
protected :
|
||||
|
||||
virtual ~TextureCubeMap();
|
||||
bool imagesValid() const;
|
||||
void setImage(Image* image) {} // prevent call to Texture::setImage(Image* image)
|
||||
|
||||
mutable ref_ptr<Image> _images[6];
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user