CTexture.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include <ionCore.h>
5 #include <ionMath.h>
6 #include <ionGraphics.h>
7 
8 #include "Utilities.h"
9 
10 
11 namespace ion
12 {
13  namespace Graphics
14  {
15  namespace GL
16  {
17 
18  class CTexture : public virtual ITexture
19  {
20 
21  public:
22 
23  static u32 const InternalFormatMatrix[4][10];
24  static u32 const FormatMatrix[4][2];
25 
26  static string const InternalFormatStringMatrix[4][10];
27  static string const FormatStringMatrix[4];
28 
29 
30  void SetMinFilter(EFilter const MinFilter);
31  void SetMagFilter(EFilter const MagFilter);
33  void SetWrapMode(EWrapMode const WrapMode);
34  void SetAnisotropy(f32 const Anisotropy);
35 
41 
42  void ApplyParams();
43  virtual uint GetGLBindTextureTarget() const = 0;
44  virtual uint GetGLTextureBindingEnum() const = 0;
45 
46  uint Handle = 0;
47 
52 
56 
57  bool MipMaps = true;
58  bool IsInteger = false;
59 
60  };
61 
62  class CTexture2D : public ITexture2D, public CTexture
63  {
64 
65  public:
66 
67  void Upload(void const * const Data, vec2u const & Size, EFormatComponents const Components, EScalarType const Type);
68  void UploadSubRegion(void const * const Data, vec2u const & Offset, vec2u const & Size, EFormatComponents const Components, EScalarType const Type);
69 
70  void GetData(void * const Data, vec2u const & Size, EFormatComponents const Components, EScalarType const Type);
71 
82 
85 
87 
88 #pragma warning(suppress: 4250)
89  };
90 
91  class CTexture2DArray : public ITexture2DArray, public CTexture
92  {
93 
94  public:
95 
96  void Upload(void const * const Data, vec3u const & Size, EFormatComponents const Components, EScalarType const Type);
97  void UploadSubRegion(void const * const Data, vec3u const & Offset, vec3u const & Size, EFormatComponents const Components, EScalarType const Type);
98 
102  using CTexture::SetWrapMode;
107  using CTexture::GetWrapMode;
109 
112 
114 
115 #pragma warning(suppress: 4250)
116  };
117 
118  class CTexture3D : public ITexture3D, public CTexture
119  {
120 
121  public:
122 
123  void Upload(void const * const Data, vec3u const & Size, EFormatComponents const Components, EScalarType const Type);
124  void UploadSubRegion(void const * const Data, vec3u const & Offset, vec3u const & Size, EFormatComponents const Components, EScalarType const Type);
125 
129  using CTexture::SetWrapMode;
134  using CTexture::GetWrapMode;
136 
139 
141 
142 #pragma warning(suppress: 4250)
143  };
144 
145  class CTextureCubeMap : public ITextureCubeMap, public CTexture
146  {
147 
148  public:
149 
150  void Upload(EFace const Face, void const * const Data, vec2u const & Size, EFormatComponents const Components, EScalarType const Type);
151  void UploadSubRegion(EFace const Face, void const * const Data, vec2u const & Offset, vec2u const & Size, EFormatComponents const Components, EScalarType const Type);
152 
156  using CTexture::SetWrapMode;
161  using CTexture::GetWrapMode;
163 
166 
168 
169 #pragma warning(suppress: 4250)
170  };
171 
172  }
173  }
174 }
Definition: CTexture.h:18
EFilter GetMinFilter()
Definition: CTexture.cpp:91
Definition: CTexture.h:118
vec3u TextureSize
Definition: CTexture.h:140
uint Handle
Definition: CTexture.h:46
EFilter MinFilter
Definition: CTexture.h:48
Definition: ITexture.h:14
Definition: ITexture.h:117
EFilter MagFilter
Definition: CTexture.h:49
void SetAnisotropy(f32 const Anisotropy)
Definition: CTexture.cpp:85
EWrapMode
Definition: ITexture.h:28
Definition: ITexture.h:106
void SetWrapMode(EWrapMode const WrapMode)
Definition: CTexture.cpp:79
EFace
Definition: ITexture.h:133
virtual uint GetGLBindTextureTarget() const =0
virtual uint GetGLTextureBindingEnum() const =0
unsigned int uint
Definition: ionTypes.h:99
EFilter MipMapFilter
Definition: CTexture.h:50
Definition: CTexture.h:145
float f32
Definition: ionTypes.h:94
void SetMagFilter(EFilter const MagFilter)
Definition: CTexture.cpp:67
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
EFilter
Definition: ITexture.h:22
f32 GetAnisotropy()
Definition: CTexture.cpp:111
Definition: CTexture.h:62
Definition: ITexture.h:128
static u32 const FormatMatrix[4][2]
Definition: CTexture.h:24
static u32 const InternalFormatMatrix[4][10]
Definition: CTexture.h:23
EScalarType
Value types that exclude vector types.
Definition: Enums.h:33
vec3u TextureSize
Definition: CTexture.h:113
Definition: CTexture.h:91
bool IsInteger
Definition: CTexture.h:58
Uint32 u32
Definition: ionTypes.h:89
Definition: ITexture.h:93
EFilter GetMagFilter()
Definition: CTexture.cpp:96
EFormatComponents
Definition: ITexture.h:35
Lightweight wrapper for std::type_info that enables sorting (e.g. for use in a std::map) ...
Definition: ionClass.h:180
void ApplyParams()
Definition: CTexture.cpp:18
f32 Anisotropy
Definition: CTexture.h:55
void SetMipMapFilter(EFilter const MipMapFilter)
Definition: CTexture.cpp:73
EFilter GetMipMapFilter()
Definition: CTexture.cpp:101
vec2u TextureSize
Definition: CTexture.h:167
EWrapMode GetWrapMode()
Definition: CTexture.cpp:106
static string const InternalFormatStringMatrix[4][10]
Definition: CTexture.h:26
bool MipMaps
Definition: CTexture.h:57
static string const FormatStringMatrix[4]
Definition: CTexture.h:27
void SetMinFilter(EFilter const MinFilter)
Definition: CTexture.cpp:61
vec2u TextureSize
Definition: CTexture.h:86
EWrapMode WrapMode
Definition: CTexture.h:51