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

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

#include <OsgTextureCubeMap.h>

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

Public Member Functions

 OsgTextureCubeMap ()
 Constructor. More...
 
void setSize (int width, int height) override
 Sets the size of the texture, which is the same for each face of the cube. More...
 
void getSize (int *width, int *height) const override
 Gets the size of the texture, which is the same for each face of the cube. More...
 
bool loadImage (const std::string &filePath) override
 Loads an image into the texture from a file. More...
 
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) override
 Loads images from files into the faces of the cube map. More...
 
osg::ref_ptr< osg::TextureCubeMap > getOsgTextureCubeMap () const
 Returns the osg::TextureCubeMap.
 
- Public Member Functions inherited from SurgSim::Graphics::OsgTexture
virtual void clearImage ()
 Removes the image from the texture.
 
osg::ref_ptr< osg::Texture > getOsgTexture () const
 Returns the osg::Texture1D.
 
- Public Member Functions inherited from SurgSim::Graphics::Texture
virtual ~Texture ()
 Destructor.
 
void setIsPointSprite (bool value)
 Set point sprite flag on/off.
 
bool isPointSprite () const
 Get point sprite flag state.
 

Protected Member Functions

osg::ref_ptr< osg::Image > copyImageBlock (const osg::Image &source, size_t startColumn, size_t startRow, size_t width, size_t 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::OsgTextureCubeMap ( )

Constructor.

Postcondition
No image is loaded in the texture.

Member Function Documentation

§ copyImageBlock()

osg::ref_ptr< osg::Image > OsgTextureCubeMap::copyImageBlock ( const osg::Image &  source,
size_t  startColumn,
size_t  startRow,
size_t  width,
size_t  height 
)
protected

Makes a copy of an image block.

Parameters
sourceSource image to copy from
startColumnFirst column of block in the source image
startRowFirst row of block in the source image
widthWidth of the block
heightHeight of the block
Returns
Copy of the image block

§ getSize()

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

Gets the size of the texture, which is the same for each face of the cube.

Parameters
[out]widthWidth of the texture
[out]heightHeight of the texture

Implements SurgSim::Graphics::TextureCubeMap.

§ loadImage()

bool OsgTextureCubeMap::loadImage ( const std::string &  filePath)
overridevirtual

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.

§ loadImageFaces()

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 
)
overridevirtual

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

Implements SurgSim::Graphics::TextureCubeMap.

§ setSize()

void OsgTextureCubeMap::setSize ( int  width,
int  height 
)
overridevirtual

Sets the size of the texture, which is the same for each face of the cube.

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.

Implements SurgSim::Graphics::TextureCubeMap.


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