#include <texture_generator.h>
Static Public Member Functions | |
static SoTexture2 * | generateSpaceBackground (unsigned width, unsigned height, unsigned starCount) |
Static method for generation of a space background texture. | |
static SoTexture2 * | generateEarthSurface () |
Static method for generation of an Earth surface texture. | |
static SoTexture2 * | generateMoonSurface () |
Static method for generation of a Moon surface texture. | |
static SoTexture2 * | generateWireWall () |
Static method for generation of a network wall texture. | |
static SoTexture2 * | generateTunnelWall (SbColor4f &startColour, SbColor4f &endColour, unsigned lengthHalf) |
Static method for generation of tunnel wall texture. | |
static AlbumContainer | generateAlbum (const std::string &albumName) |
Static method for loading of album images. | |
static SoFile * | generateModel (const std::string &modelName) |
Static method for loading of models. | |
Static Public Attributes | |
static const std::string | PATH_TO_ALBUM_DIR |
Path to the user album directory. | |
static const std::string | ALBUM_IMG_PREFIX |
Prefix of user album images. | |
static const std::string | ALBUM_IMG_SUFFIX |
Suffix of user album images. | |
static const std::string | PATH_TO_MODEL_DIR |
Path to the user model directory. | |
static const std::string | MODEL_SUFFIX |
Suffix of user models. | |
Private Member Functions | |
TextureGenerator () | |
~TextureGenerator () | |
TextureGenerator (const TextureGenerator &) | |
TextureGenerator & | operator= (const TextureGenerator &) |
Static Private Member Functions | |
static void | setRGBAPixel (unsigned char *pixelBuffer, unsigned long bufSize, unsigned long position, unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha) |
A static helper method for setting a pixel of an RGBA pixel buffer to desired colour. | |
static unsigned long | cartesianToLinear (unsigned long width, unsigned long x, unsigned long y) |
A static helper method for conversion of Cartesian coordinates to linear coordinates into a buffer. | |
static unsigned char | colourFloatToUC (float colourValue) |
A static helper method for conversion of float representation of colour components to unsigned char. | |
Static Private Attributes | |
static const int | NC_RGBA = 4 |
Number of components for an RGBA pixel. | |
static const unsigned char | SPACE_STAR_LIGHT_MAX_DEVIATION = 0x10 |
Comprises several class methods for generation of various textures.
Uses "library class" (aka "static helper") design pattern.
TextureGenerator::TextureGenerator | ( | ) | [private] |
TextureGenerator::~TextureGenerator | ( | ) | [private] |
TextureGenerator::TextureGenerator | ( | const TextureGenerator & | ) | [private] |
TextureGenerator& TextureGenerator::operator= | ( | const TextureGenerator & | ) | [private] |
static void TextureGenerator::setRGBAPixel | ( | unsigned char * | pixelBuffer, | |
unsigned long | bufSize, | |||
unsigned long | position, | |||
unsigned char | red, | |||
unsigned char | green, | |||
unsigned char | blue, | |||
unsigned char | alpha | |||
) | [static, private] |
A static helper method for setting a pixel of an RGBA pixel buffer to desired colour.
A static helper method that sets a pixel at given position (determined as a linear position) in an RGBA pixel buffer to desired colour.
[in] | pixelBuffer | Pointer to the start of the pixel buffer |
[in] | bufSize | Size of the buffer to enable control for out-of-bounds access |
[in] | position | Linear position of the pixel in the pixel buffer |
[in] | red | Red component of the colour |
[in] | green | Green component of the colour |
[in] | blue | Blue component of the colour |
[in] | alpha | Alpha component of the colour |
static unsigned long TextureGenerator::cartesianToLinear | ( | unsigned long | width, | |
unsigned long | x, | |||
unsigned long | y | |||
) | [inline, static, private] |
A static helper method for conversion of Cartesian coordinates to linear coordinates into a buffer.
A static helper method that converts Cartesian coordinates to linear coordinates into a buffer. The width of the buffer needs to be known.
[in] | width | Width of the buffer |
[in] | x | X-coordinate into the buffer |
[in] | y | Y-coordinate into the buffer |
static unsigned char TextureGenerator::colourFloatToUC | ( | float | colourValue | ) | [static, private] |
A static helper method for conversion of float representation of colour components to unsigned char.
A static helper method that converts float colour components <0.0; 1.0> to their unsigned char representation <0; 255>.
[in] | colourValue | The float value of the colour component |
static SoTexture2* TextureGenerator::generateSpaceBackground | ( | unsigned | width, | |
unsigned | height, | |||
unsigned | starCount | |||
) | [static] |
Static method for generation of a space background texture.
[in] | width | The width of the texture |
[in] | height | The height of the texture |
[in] | starCount | The number of stars in the texture |
static SoTexture2* TextureGenerator::generateEarthSurface | ( | ) | [static] |
Static method for generation of an Earth surface texture.
static SoTexture2* TextureGenerator::generateMoonSurface | ( | ) | [static] |
Static method for generation of a Moon surface texture.
static SoTexture2* TextureGenerator::generateWireWall | ( | ) | [static] |
Static method for generation of a network wall texture.
static SoTexture2* TextureGenerator::generateTunnelWall | ( | SbColor4f & | startColour, | |
SbColor4f & | endColour, | |||
unsigned | lengthHalf | |||
) | [static] |
Static method for generation of tunnel wall texture.
This method generates a texture for the tunnel wall used in TunnelPlayBoxGraphics. The method accepts two colours -> the texture will be generated as a gradient of colours between these two. The size of the texture will be length x 1 px.
[in] | startColour | The start colour of the tunnel wall |
[in] | endColour | The end colour of the tunnel wall |
[in] | lengthHalf | Half the length of the texture |
static AlbumContainer TextureGenerator::generateAlbum | ( | const std::string & | albumName | ) | [static] |
Static method for loading of album images.
This static method loads images from album of given name and returns them as textures in a container.
[in] | albumName | The name of the album (the name of the album directory in the filesystem needs to be the same) |
static SoFile* TextureGenerator::generateModel | ( | const std::string & | modelName | ) | [static] |
Static method for loading of models.
This static method loads a model of given name
[in] | modelName | The name of the model (the name of the model file in the filesystem needs to be the same) |
const int TextureGenerator::NC_RGBA = 4 [static, private] |
Number of components for an RGBA pixel.
const unsigned char TextureGenerator::SPACE_STAR_LIGHT_MAX_DEVIATION = 0x10 [static, private] |
Maximum deviation of every colour component of a star light in the space background from 0xFF
const std::string TextureGenerator::PATH_TO_ALBUM_DIR [static] |
Path to the user album directory.
const std::string TextureGenerator::ALBUM_IMG_PREFIX [static] |
Prefix of user album images.
const std::string TextureGenerator::ALBUM_IMG_SUFFIX [static] |
Suffix of user album images.
const std::string TextureGenerator::PATH_TO_MODEL_DIR [static] |
Path to the user model directory.
const std::string TextureGenerator::MODEL_SUFFIX [static] |
Suffix of user models.