SurgSim::Graphics::OsgTextureCubeMap Class Reference

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

`#include <SurgSim/Graphics/OsgTextureCubeMap.h>`

Inheritance diagram for SurgSim::Graphics::OsgTextureCubeMap:

## 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. 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
| Texture ()
virtual | ~Texture ()
| Destructor. More...
void | setIsPointSprite (bool value)
| Set point sprite flag on/off. More...
bool | isPointSprite () const
| Get point sprite flag state. More...

## 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

  source | Source image to copy from
  startColumn | First column of block in the source image
  startRow | First row of block in the source image
  width | Width of the block
  height | Height of the block

Returns
  Copy of the image block

## getOsgTextureCubeMap()

osg::ref_ptr< osg::TextureCubeMap > SurgSim::Graphics::OsgTextureCubeMap::getOsgTextureCubeMap | ( |  | ) | const

Returns the osg::TextureCubeMap.

## getSize()

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

override virtual

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

Parameters

  [out] | width | Width of the texture
  [out] | height | Height of the texture

Implements SurgSim::Graphics::TextureCubeMap.

## loadImage()

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

override virtual

Loads an image into the texture from a file.

Parameters

  filePath | Path 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
| ) |  |

override virtual

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

Parameters

  negativeX | Path to the image for the (-X) face
  positiveX | Path to the image for the (+X) face
  negativeY | Path to the image for the (-Y) face
  positiveY | Path to the image for the (+Y) face
  negativeZ | Path to the image for the (-Z) face
  positiveZ | Path 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
| ) |  |

override virtual

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

Parameters

  width | Width of the texture
  height | Height 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:

- SurgSim/Graphics/OsgTextureCubeMap.h
- SurgSim/Graphics/OsgTextureCubeMap.cpp