Public Member Functions | Protected Member Functions | List of all members
SurgSim::Graphics::OsgTextureCubeMap Class Reference

OSG implementation of a Cube Map Texture. More...

#include <SurgSim/Graphics/OsgTextureCubeMap.h>

Inheritance diagram for SurgSim::Graphics::OsgTextureCubeMap:
SurgSim::Graphics::OsgTexture SurgSim::Graphics::Texture

Public Member Functions

 OsgTextureCubeMap ()
 Constructor. More...
 
virtual void setSize (int width, int height)
 Sets the size of the texture. More...
 
virtual void getSize (int *width, int *height) const
 Gets the size of the texture. More...
 
virtual bool loadImage (const std::string &filePath)
 Loads an image into the texture from a file. More...
 
virtual bool loadImageFaces (const std::string &negativeX, const std::string &positiveX, const std::string &negativeY, const std::string &positiveY, const std::string &negativeZ, const std::string &positiveZ)
 Loads images from files into the faces of the cube map. More...
 
osg::ref_ptr< osg::TextureCubeMap > getOsgTextureCubeMap () const
 Returns the osg::TextureCubeMap. More...
 
- Public Member Functions inherited from SurgSim::Graphics::OsgTexture
virtual void clearImage ()
 Removes the image from the texture. More...
 
osg::ref_ptr< osg::Texture > getOsgTexture () const
 Returns the osg::Texture1D. More...
 
- Public Member Functions inherited from SurgSim::Graphics::Texture
virtual ~Texture ()
 Destructor. More...
 

Protected Member Functions

osg::ref_ptr< osg::Image > copyImageBlock (const osg::Image &source, int column, int row, int width, int height)
 Makes a copy of an image block. More...
 
- Protected Member Functions inherited from SurgSim::Graphics::OsgTexture
 OsgTexture (osg::Texture *texture)
 Constructor. More...
 

Detailed Description

OSG implementation of a Cube Map Texture.

Wraps an osg::TextureCubeMap

Constructor & Destructor Documentation

OsgTextureCubeMap::OsgTextureCubeMap ( )

Constructor.

Postcondition
No image is loaded in the texture.

Member Function Documentation

osg::ref_ptr< osg::Image > OsgTextureCubeMap::copyImageBlock ( const osg::Image &  source,
int  column,
int  row,
int  width,
int  height 
)
protected

Makes a copy of an image block.

Parameters
sourceSource image to copy from
columnFirst column of block in the source image
rowFirst row of block in the source image
widthWidth of the block
heightHeight of the block
Returns
Copy of the image block
osg::ref_ptr<osg::TextureCubeMap> SurgSim::Graphics::OsgTextureCubeMap::getOsgTextureCubeMap ( ) const
inline

Returns the osg::TextureCubeMap.

void OsgTextureCubeMap::getSize ( int *  width,
int *  height 
) const
virtual

Gets the size of the texture.

Parameters
[out]widthWidth of the texture
[out]heightHeight of the texture
bool OsgTextureCubeMap::loadImage ( const std::string &  filePath)
virtual

Loads an image into the texture from a file.

Parameters
filePathPath to the image file
Returns
True if the image is successfully loaded, otherwise false
Note
The image should contain the cube map unwrapped such that each face is width/3 x height/4 and the corners for the faces are arranged as follows, with (0, 0) as the bottom-left corner and (width, height) as the top-right corner: (-Z): (width * 1/3, 0 ) to (width * 2/3, height * 1/4) (-Y): (width * 1/3, height * 1/4) to (width * 2/3, height * 1/2) (-X): (0, height * 1/2) to (width * 1/3, height * 3/4) (+Z): (width * 1/3, height * 1/2) to (width * 2/3, height * 3/4) (+X): (width * 2/3, height * 1/2) to (width, height * 3/4) (+Y): (width * 1/3, height * 3/4) to (width * 2/3, height )

Reimplemented from SurgSim::Graphics::OsgTexture.

bool OsgTextureCubeMap::loadImageFaces ( const std::string &  negativeX,
const std::string &  positiveX,
const std::string &  negativeY,
const std::string &  positiveY,
const std::string &  negativeZ,
const std::string &  positiveZ 
)
virtual

Loads images from files into the faces of the cube map.

Parameters
negativeXPath to the image for the (-X) face
positiveXPath to the image for the (+X) face
negativeYPath to the image for the (-Y) face
positiveYPath to the image for the (+Y) face
negativeZPath to the image for the (-Z) face
positiveZPath to the image for the (+Z) face
Returns
True if the image is successfully loaded, otherwise false
void OsgTextureCubeMap::setSize ( int  width,
int  height 
)
virtual

Sets the size of the texture.

Parameters
widthWidth of the texture
heightHeight of the texture
Note
Use this to setup a texture as a render target rather than loading from file.

The documentation for this class was generated from the following files: