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 uint const InternalFormatMatrix[4][11];
24  static uint 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 SetBorderColor(color4f const & BorderColor);
35  void SetAnisotropy(float const Anisotropy);
36 
41  float GetAnisotropy();
42 
43  void GenerateMipMaps();
44 
45  void ApplyParams();
46  virtual uint GetGLBindTextureTarget() const = 0;
47  virtual uint GetGLTextureBindingEnum() const = 0;
48 
49  uint Handle = 0;
50 
56 
59  float Anisotropy = -1;
60 
61  bool MipMaps = true;
62  bool IsInteger = false;
63 
64  };
65 
66  class CTexture2D : public ITexture2D, public CTexture
67  {
68 
69  public:
70 
71  void Upload(void const * const Data, vec2i const & Size, EFormatComponents const Components, EScalarType const Type);
72  void UploadSubRegion(void const * const Data, vec2i const & Offset, vec2i const & Size, EFormatComponents const Components, EScalarType const Type);
73 
74  void GetData(void * const Data, vec2i const & Size, EFormatComponents const Components, EScalarType const Type);
75 
86 
89 
91 
92 #pragma warning(suppress: 4250)
93  };
94 
95  class CTexture2DArray : public ITexture2DArray, public CTexture
96  {
97 
98  public:
99 
100  void Upload(void const * const Data, vec3i const & Size, EFormatComponents const Components, EScalarType const Type);
101  void UploadSubRegion(void const * const Data, vec3i const & Offset, vec3i const & Size, EFormatComponents const Components, EScalarType const Type);
102 
106  using CTexture::SetWrapMode;
111  using CTexture::GetWrapMode;
113 
116 
118 
119 #pragma warning(suppress: 4250)
120  };
121 
122  class CTexture3D : public ITexture3D, public CTexture
123  {
124 
125  public:
126 
127  void Upload(void const * const Data, vec3i const & Size, EFormatComponents const Components, EScalarType const Type);
128  void UploadSubRegion(void const * const Data, vec3i const & Offset, vec3i const & Size, EFormatComponents const Components, EScalarType const Type);
129 
133  using CTexture::SetWrapMode;
138  using CTexture::GetWrapMode;
140 
143 
145 
146 #pragma warning(suppress: 4250)
147  };
148 
149  class CTextureCubeMap : public ITextureCubeMap, public CTexture
150  {
151 
152  public:
153 
154  void Upload(EFace const Face, void const * const Data, vec2i const & Size, EFormatComponents const Components, EScalarType const Type);
155  void UploadSubRegion(EFace const Face, void const * const Data, vec2i const & Offset, vec2i const & Size, EFormatComponents const Components, EScalarType const Type);
156 
160  using CTexture::SetWrapMode;
165  using CTexture::GetWrapMode;
167 
170 
172 
173 #pragma warning(suppress: 4250)
174  };
175 
176  }
177  }
178 }
Definition: CTexture.h:18
EFilter GetMinFilter()
Definition: CTexture.cpp:133
Definition: CTexture.h:122
uint Handle
Definition: CTexture.h:49
EFilter MinFilter
Definition: CTexture.h:51
void SetBorderColor(color4f const &BorderColor)
Definition: CTexture.cpp:121
Definition: ITexture.h:14
Definition: ITexture.h:125
EFilter MagFilter
Definition: CTexture.h:52
EWrapMode
Definition: ITexture.h:28
color4f BorderColor
Definition: CTexture.h:55
Definition: ITexture.h:114
void SetWrapMode(EWrapMode const WrapMode)
Definition: CTexture.cpp:115
EFace
Definition: ITexture.h:141
virtual uint GetGLBindTextureTarget() const =0
vec2i TextureSize
Definition: CTexture.h:171
virtual uint GetGLTextureBindingEnum() const =0
EFilter MipMapFilter
Definition: CTexture.h:53
Definition: CTexture.h:149
void SetMagFilter(EFilter const MagFilter)
Definition: CTexture.cpp:87
Definition: CCatmullRomAdvancedSplineInterpolator.h:7
EFilter
Definition: ITexture.h:22
Definition: CTexture.h:66
Definition: ITexture.h:136
unsigned int uint
Definition: ionTypes.h:42
EScalarType
Value types that exclude vector types.
Definition: Enums.h:33
Lightweight wrapper for std::type_info that enables sorting (e.g. for use in a std::map) ...
Definition: ionClass.h:20
vec3i TextureSize
Definition: CTexture.h:144
Definition: CTexture.h:95
bool IsInteger
Definition: CTexture.h:62
Definition: ITexture.h:101
EFilter GetMagFilter()
Definition: CTexture.cpp:138
static uint const InternalFormatMatrix[4][11]
Definition: CTexture.h:23
void GenerateMipMaps()
Definition: CTexture.cpp:158
EFormatComponents
Definition: ITexture.h:36
float Anisotropy
Definition: CTexture.h:59
void ApplyParams()
Definition: CTexture.cpp:18
vec2i TextureSize
Definition: CTexture.h:90
void SetAnisotropy(float const Anisotropy)
Definition: CTexture.cpp:127
void SetMipMapFilter(EFilter const MipMapFilter)
Definition: CTexture.cpp:101
EFilter GetMipMapFilter()
Definition: CTexture.cpp:143
float GetAnisotropy()
Definition: CTexture.cpp:153
EWrapMode GetWrapMode()
Definition: CTexture.cpp:148
static string const InternalFormatStringMatrix[4][10]
Definition: CTexture.h:26
bool MipMaps
Definition: CTexture.h:61
static string const FormatStringMatrix[4]
Definition: CTexture.h:27
void SetMinFilter(EFilter const MinFilter)
Definition: CTexture.cpp:73
vec3i TextureSize
Definition: CTexture.h:117
EWrapMode WrapMode
Definition: CTexture.h:54
static uint const FormatMatrix[4][2]
Definition: CTexture.h:24