Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials
SMaterialLayer.h
Go to the documentation of this file.
1 // Copyright (C) 2002-2010 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 
11 namespace irr
12 {
13 namespace video
14 {
15  class ITexture;
16 
19  {
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 
49  {
50  public:
53  : Texture(0),
56  BilinearFilter(true),
57  TrilinearFilter(false),
59  LODBias(0),
60  TextureMatrix(0)
61  {}
62 
64 
66  {
67  // This pointer is checked during assignment
68  TextureMatrix = 0;
69  *this = other;
70  }
71 
74  {
75  MatrixAllocator.destruct(TextureMatrix);
76  MatrixAllocator.deallocate(TextureMatrix);
77  }
78 
80 
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;
115  LODBias = other.LODBias;
116 
117  return *this;
118  }
119 
121 
123  {
124  if (!TextureMatrix)
125  {
126  TextureMatrix = MatrixAllocator.allocate(1);
127  MatrixAllocator.construct(TextureMatrix,core::IdentityMatrix);
128  }
129  return *TextureMatrix;
130  }
131 
133 
135  {
136  if (TextureMatrix)
137  return *TextureMatrix;
138  else
139  return core::IdentityMatrix;
140  }
141 
143 
145  {
146  if (!TextureMatrix)
147  {
148  TextureMatrix = MatrixAllocator.allocate(1);
149  MatrixAllocator.construct(TextureMatrix,mat);
150  }
151  else
152  *TextureMatrix = mat;
153  }
154 
156 
158  inline bool operator!=(const SMaterialLayer& b) const
159  {
160  bool different =
161  Texture != b.Texture ||
162  TextureWrapU != b.TextureWrapU ||
163  TextureWrapV != b.TextureWrapV ||
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 
178 
180  inline bool operator==(const SMaterialLayer& b) const
181  { return !(b!=*this); }
182 
185 
187 
190 
193 
195 
198 
200 
207 
209 
214 
215  private:
216  friend class SMaterial;
218 
220 
222  core::matrix4* TextureMatrix;
223  };
224 
225 } // end namespace video
226 } // end namespace irr
227 
228 #endif // __S_MATERIAL_LAYER_H_INCLUDED__

The Irrlicht Engine
The Irrlicht Engine Documentation © 2003-2010 by Nikolaus Gebhardt. Generated on Fri Mar 21 2014 04:40:17 by Doxygen (1.8.1.2)