Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008 #ifndef __SP_IMAGELOADER_TGA_H__
00009 #define __SP_IMAGELOADER_TGA_H__
00010
00011
00012 #include "Base/spStandard.hpp"
00013
00014 #ifdef SP_COMPILE_WITH_TEXLOADER_TGA
00015
00016
00017 #include "FileFormats/Image/spImageFormatInterfaces.hpp"
00018
00019
00020 namespace sp
00021 {
00022 namespace video
00023 {
00024
00025
00026 class SP_EXPORT ImageLoaderTGA : public ImageLoader
00027 {
00028
00029 public:
00030
00031 ImageLoaderTGA(io::File* File);
00032 ~ImageLoaderTGA();
00033
00034 SImageDataRead* loadImageData();
00035
00036 private:
00037
00038
00039
00040 enum ETGAImageTypes
00041 {
00042 TGA_IMGDATA_NONE = 0,
00043
00044 TGA_IMGDATA_INDEXED = 1,
00045 TGA_IMGDATA_RGB = 2,
00046 TGA_IMGDATA_MONOCHROM = 3,
00047
00048 TGA_IMGDATA_INDEXED_COMPRESSED = 9,
00049 TGA_IMGDATA_RGB_COMPRESSED = 10,
00050 TGA_IMGDATA_MONOCHROM_COMPRESSED = 11,
00051 };
00052
00053
00054
00055 #if defined(_MSC_VER)
00056 # pragma pack(push, packing)
00057 # pragma pack(1)
00058 # define SP_PACK_STRUCT
00059 #elif defined(__GNUC__)
00060 # define SP_PACK_STRUCT __attribute__((packed))
00061 #else
00062 # define SP_PACK_STRUCT
00063 #endif
00064
00065 struct SHeaderTGA
00066 {
00067 u8 IDSize;
00068 u8 ColorMapType;
00069 u8 ImageType;
00070
00071 u16 ColorMapStart;
00072 u16 ColorMapSize;
00073 u8 ColorMapBits;
00074
00075 u16 OriginX;
00076 u16 OriginY;
00077 u16 ImageWidth;
00078 u16 ImageHeight;
00079
00080 u8 bpp;
00081 u8 ImageDescriptor;
00082 }
00083 SP_PACK_STRUCT;
00084
00085 #ifdef _MSC_VER
00086 # pragma pack(pop, packing)
00087 #endif
00088
00089 #undef SP_PACK_STRUCT
00090
00091
00092
00093 bool loadUncompressedTGA(SImageDataRead* texture);
00094 bool loadCompressedTGA(SImageDataRead* texture);
00095
00096
00097
00098 SHeaderTGA MainHeader_;
00099
00100 };
00101
00102
00103 }
00104
00105 }
00106
00107
00108 #endif
00109
00110 #endif
00111
00112
00113
00114