texture_generator.h
Go to the documentation of this file.00001
00016 #ifndef _TEXTURE_GENERATOR_H_
00017 #define _TEXTURE_GENERATOR_H_
00018
00019 #include <vector>
00020
00021 #include <Inventor/nodes/SoTexture2.h>
00022 #include <Inventor/nodes/SoFile.h>
00023 #include <Inventor/SbColor4f.h>
00024
00026 typedef std::vector<SoTexture2*> AlbumContainer;
00027
00035 class TextureGenerator
00036 {
00037 private:
00038
00040 static const int NC_RGBA = 4;
00041
00044 static const unsigned char SPACE_STAR_LIGHT_MAX_DEVIATION = 0x10;
00045
00046 public:
00047
00049 static const std::string PATH_TO_ALBUM_DIR;
00050
00052 static const std::string ALBUM_IMG_PREFIX;
00053
00055 static const std::string ALBUM_IMG_SUFFIX;
00056
00058 static const std::string PATH_TO_MODEL_DIR;
00059
00061 static const std::string MODEL_SUFFIX;
00062
00063 private:
00064
00065
00066 TextureGenerator();
00067 ~TextureGenerator();
00068 TextureGenerator(const TextureGenerator &);
00069 TextureGenerator & operator=(const TextureGenerator &);
00070
00088 static void setRGBAPixel(unsigned char* pixelBuffer,
00089 unsigned long bufSize, unsigned long position,
00090 unsigned char red, unsigned char green, unsigned char blue,
00091 unsigned char alpha);
00092
00105 static unsigned long cartesianToLinear(unsigned long width,
00106 unsigned long x, unsigned long y)
00107 {
00108 return x + y*width;
00109 }
00110
00121 static unsigned char colourFloatToUC(float colourValue);
00122
00123 public:
00124
00133 static SoTexture2* generateSpaceBackground(
00134 unsigned width, unsigned height, unsigned starCount);
00135
00141 static SoTexture2* generateEarthSurface();
00142
00148 static SoTexture2* generateMoonSurface();
00149
00155 static SoTexture2* generateWireWall();
00156
00170 static SoTexture2* generateTunnelWall(SbColor4f& startColour,
00171 SbColor4f& endColour, unsigned lengthHalf);
00172
00183 static AlbumContainer generateAlbum(const std::string& albumName);
00184
00194 static SoFile* generateModel(const std::string& modelName);
00195 };
00196
00197 #endif