aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/libraries/irrlicht-1.8/include/SMaterialLayer.h
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-01-13 19:47:58 +1000
committerDavid Walter Seikel2014-01-13 19:47:58 +1000
commitf9158592e1478b2013afc7041d9ed041cf2d2f4a (patch)
treeb16e389d7988700e21b4c9741044cefa536dcbae /libraries/irrlicht-1.8/include/SMaterialLayer.h
parentLibraries readme updated with change markers and more of the Irrlicht changes. (diff)
downloadSledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.zip
SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.gz
SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.bz2
SledjHamr-f9158592e1478b2013afc7041d9ed041cf2d2f4a.tar.xz
Update Irrlicht to 1.8.1. Include actual change markers this time. lol
Diffstat (limited to 'libraries/irrlicht-1.8/include/SMaterialLayer.h')
-rw-r--r--libraries/irrlicht-1.8/include/SMaterialLayer.h228
1 files changed, 0 insertions, 228 deletions
diff --git a/libraries/irrlicht-1.8/include/SMaterialLayer.h b/libraries/irrlicht-1.8/include/SMaterialLayer.h
deleted file mode 100644
index 30e8cd9..0000000
--- a/libraries/irrlicht-1.8/include/SMaterialLayer.h
+++ /dev/null
@@ -1,228 +0,0 @@
1// Copyright (C) 2002-2012 Nikolaus Gebhardt
2// This file is part of the "Irrlicht Engine".
3// For conditions of distribution and use, see copyright notice in irrlicht.h
4
5#ifndef __S_MATERIAL_LAYER_H_INCLUDED__
6#define __S_MATERIAL_LAYER_H_INCLUDED__
7
8#include "matrix4.h"
9#include "irrAllocator.h"
10
11namespace irr
12{
13namespace video
14{
15 class ITexture;
16
17 //! Texture coord clamp mode outside [0.0, 1.0]
18 enum E_TEXTURE_CLAMP
19 {
20 //! Texture repeats
21 ETC_REPEAT = 0,
22 //! Texture is clamped to the last pixel
23 ETC_CLAMP,
24 //! Texture is clamped to the edge pixel
25 ETC_CLAMP_TO_EDGE,
26 //! Texture is clamped to the border pixel (if exists)
27 ETC_CLAMP_TO_BORDER,
28 //! Texture is alternatingly mirrored (0..1..0..1..0..)
29 ETC_MIRROR,
30 //! Texture is mirrored once and then clamped (0..1..0)
31 ETC_MIRROR_CLAMP,
32 //! Texture is mirrored once and then clamped to edge
33 ETC_MIRROR_CLAMP_TO_EDGE,
34 //! Texture is mirrored once and then clamped to border
35 ETC_MIRROR_CLAMP_TO_BORDER
36 };
37 static const char* const aTextureClampNames[] = {
38 "texture_clamp_repeat",
39 "texture_clamp_clamp",
40 "texture_clamp_clamp_to_edge",
41 "texture_clamp_clamp_to_border",
42 "texture_clamp_mirror",
43 "texture_clamp_mirror_clamp",
44 "texture_clamp_mirror_clamp_to_edge",
45 "texture_clamp_mirror_clamp_to_border", 0};
46
47 //! Struct for holding material parameters which exist per texture layer
48 class SMaterialLayer
49 {
50 public:
51 //! Default constructor
52 SMaterialLayer()
53 : Texture(0),
54 TextureWrapU(ETC_REPEAT),
55 TextureWrapV(ETC_REPEAT),
56 BilinearFilter(true),
57 TrilinearFilter(false),
58 AnisotropicFilter(0),
59 LODBias(0),
60 TextureMatrix(0)
61 {}
62
63 //! Copy constructor
64 /** \param other Material layer to copy from. */
65 SMaterialLayer(const SMaterialLayer& other)
66 {
67 // This pointer is checked during assignment
68 TextureMatrix = 0;
69 *this = other;
70 }
71
72 //! Destructor
73 ~SMaterialLayer()
74 {
75 MatrixAllocator.destruct(TextureMatrix);
76 MatrixAllocator.deallocate(TextureMatrix);
77 }
78
79 //! Assignment operator
80 /** \param other Material layer to copy from.
81 \return This material layer, updated. */
82 SMaterialLayer& operator=(const SMaterialLayer& other)
83 {
84 // Check for self-assignment!
85 if (this == &other)
86 return *this;
87
88 Texture = other.Texture;
89 if (TextureMatrix)
90 {
91 if (other.TextureMatrix)
92 *TextureMatrix = *other.TextureMatrix;
93 else
94 {
95 MatrixAllocator.destruct(TextureMatrix);
96 MatrixAllocator.deallocate(TextureMatrix);
97 TextureMatrix = 0;
98 }
99 }
100 else
101 {
102 if (other.TextureMatrix)
103 {
104 TextureMatrix = MatrixAllocator.allocate(1);
105 MatrixAllocator.construct(TextureMatrix,*other.TextureMatrix);
106 }
107 else
108 TextureMatrix = 0;
109 }
110 TextureWrapU = other.TextureWrapU;
111 TextureWrapV = other.TextureWrapV;
112 BilinearFilter = other.BilinearFilter;
113 TrilinearFilter = other.TrilinearFilter;
114 AnisotropicFilter = other.AnisotropicFilter;
115 LODBias = other.LODBias;
116
117 return *this;
118 }
119
120 //! Gets the texture transformation matrix
121 /** \return Texture matrix of this layer. */
122 core::matrix4& getTextureMatrix()
123 {
124 if (!TextureMatrix)
125 {
126 TextureMatrix = MatrixAllocator.allocate(1);
127 MatrixAllocator.construct(TextureMatrix,core::IdentityMatrix);
128 }
129 return *TextureMatrix;
130 }
131
132 //! Gets the immutable texture transformation matrix
133 /** \return Texture matrix of this layer. */
134 const core::matrix4& getTextureMatrix() const
135 {
136 if (TextureMatrix)
137 return *TextureMatrix;
138 else
139 return core::IdentityMatrix;
140 }
141
142 //! Sets the texture transformation matrix to mat
143 /** \param mat New texture matrix for this layer. */
144 void setTextureMatrix(const core::matrix4& mat)
145 {
146 if (!TextureMatrix)
147 {
148 TextureMatrix = MatrixAllocator.allocate(1);
149 MatrixAllocator.construct(TextureMatrix,mat);
150 }
151 else
152 *TextureMatrix = mat;
153 }
154
155 //! Inequality operator
156 /** \param b Layer to compare to.
157 \return True if layers are different, else false. */
158 inline bool operator!=(const SMaterialLayer& b) const
159 {
160 bool different =
161 Texture != b.Texture ||
162 TextureWrapU != b.TextureWrapU ||
163 TextureWrapV != b.TextureWrapV ||
164 BilinearFilter != b.BilinearFilter ||
165 TrilinearFilter != b.TrilinearFilter ||
166 AnisotropicFilter != b.AnisotropicFilter ||
167 LODBias != b.LODBias;
168 if (different)
169 return true;
170 else
171 different |= (TextureMatrix != b.TextureMatrix) &&
172 TextureMatrix && b.TextureMatrix &&
173 (*TextureMatrix != *(b.TextureMatrix));
174 return different;
175 }
176
177 //! Equality operator
178 /** \param b Layer to compare to.
179 \return True if layers are equal, else false. */
180 inline bool operator==(const SMaterialLayer& b) const
181 { return !(b!=*this); }
182
183 //! Texture
184 ITexture* Texture;
185
186 //! Texture Clamp Mode
187 /** Values are taken from E_TEXTURE_CLAMP. */
188 u8 TextureWrapU:4;
189 u8 TextureWrapV:4;
190
191 //! Is bilinear filtering enabled? Default: true
192 bool BilinearFilter:1;
193
194 //! Is trilinear filtering enabled? Default: false
195 /** If the trilinear filter flag is enabled,
196 the bilinear filtering flag is ignored. */
197 bool TrilinearFilter:1;
198
199 //! Is anisotropic filtering enabled? Default: 0, disabled
200 /** In Irrlicht you can use anisotropic texture filtering
201 in conjunction with bilinear or trilinear texture
202 filtering to improve rendering results. Primitives
203 will look less blurry with this flag switched on. The number gives
204 the maximal anisotropy degree, and is often in the range 2-16.
205 Value 1 is equivalent to 0, but should be avoided. */
206 u8 AnisotropicFilter;
207
208 //! Bias for the mipmap choosing decision.
209 /** This value can make the textures more or less blurry than with the
210 default value of 0. The value (divided by 8.f) is added to the mipmap level
211 chosen initially, and thus takes a smaller mipmap for a region
212 if the value is positive. */
213 s8 LODBias;
214
215 private:
216 friend class SMaterial;
217 irr::core::irrAllocator<irr::core::matrix4> MatrixAllocator;
218
219 //! Texture Matrix
220 /** Do not access this element directly as the internal
221 ressource management has to cope with Null pointers etc. */
222 core::matrix4* TextureMatrix;
223 };
224
225} // end namespace video
226} // end namespace irr
227
228#endif // __S_MATERIAL_LAYER_H_INCLUDED__