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