GlobeEngine
Image.h
Go to the documentation of this file.
1 
9 #ifndef GlobeEngine_Image_h
10 #define GlobeEngine_Image_h
11 
12 #include "OpenGL_Includes.h"
13 #include <string>
14 #include <vmmlib/vector.hpp>
15 
16 namespace ge {
17 
19  vmml::Vector2i size;
20  int sampleFormat; //1:uint 2:int 3:float
23  };
24 
25 
26  class Image
27  {
28 
29  public:
30  Image();
31  ~Image();
32  void clear();
33  void create();
34  void load(std::string _filename, bool _remoteAccess = false);
35  void loadWithProperties(std::string _filename, vmml::Vector2i _extent, short _bitsPerPixel, bool _remoteAccess = false);
36  bool isValid();
37  size_t getBitsPerPixel();
38 
39  private:
40  void clampToZerof(double _minValue);
41  void clampToZeros(unsigned short _minValue);
42 
43 
44  public:
45 
46  //__declspec(align(16)) union {
47  union {
48  float* alpha;
49  unsigned short* alpha16;
50  unsigned char* alpha8;
51  unsigned char* rgba;
52  unsigned char* rgb;
53  void* raw;
54  } data;
55 
57  GLenum pixel_format;
58  GLenum data_type;
59 
60  size_t width;
61  size_t height;
62 
63  bool valid;
64  private:
65  void loadImageWithFreeImage(std::string _filename);
66  void loadBinaryHeightImage(std::string _filename, vmml::Vector2i _extent, short _bitsPerPixel);
67  size_t bitsPerPixel;
68  //size_t bytesPerRow;
69  };
70 }
71 
72 #endif
GLenum data_type
Definition: Image.h:58
float * alpha
Definition: Image.h:48
Definition: Image.h:26
~Image()
Definition: Image.cpp:37
size_t height
Definition: Image.h:61
unsigned short * alpha16
Definition: Image.h:49
GLenum pixel_format
Definition: Image.h:57
vmml::Vector2i size
Definition: Image.h:19
bool valid
Definition: Image.h:63
unsigned char * rgba
Definition: Image.h:51
void clear()
Definition: Image.cpp:43
Definition: Image.h:18
size_t width
Definition: Image.h:60
int sampleFormat
Definition: Image.h:20
size_t getBitsPerPixel()
Definition: Image.cpp:410
unsigned char * rgb
Definition: Image.h:52
void load(std::string _filename, bool _remoteAccess=false)
Definition: Image.cpp:60
unsigned char * alpha8
Definition: Image.h:50
void create()
Definition: Image.cpp:55
int samplePerPixel
Definition: Image.h:22
Definition: AvalancheTrainingSimulationEngine.h:28
Image()
Definition: Image.cpp:32
bool isValid()
Definition: Image.cpp:414
union ge::Image::@1 data
void * raw
Definition: Image.h:53
int bitPerSample
Definition: Image.h:21
void loadWithProperties(std::string _filename, vmml::Vector2i _extent, short _bitsPerPixel, bool _remoteAccess=false)
Definition: Image.cpp:89
GLint internal_format
Definition: Image.h:56