Neo  0.5.0
Developer Documentation
Texture.h
Go to the documentation of this file.
1 //========================================================================
2 // Copyright (c) 2003-2011 Anael Seghezzi <www.maratis3d.com>
3 //
4 // This software is provided 'as-is', without any express or implied
5 // warranty. In no event will the authors be held liable for any damages
6 // arising from the use of this software.
7 //
8 // Permission is granted to anyone to use this software for any purpose,
9 // including commercial applications, and to alter it and redistribute it
10 // freely, subject to the following restrictions:
11 //
12 // 1. The origin of this software must not be misrepresented; you must not
13 // claim that you wrote the original software. If you use this software
14 // in a product, an acknowledgment in the product documentation would
15 // be appreciated but is not required.
16 //
17 // 2. Altered source versions must be plainly marked as such, and must not
18 // be misrepresented as being the original software.
19 //
20 // 3. This notice may not be removed or altered from any source
21 // distribution.
22 //
23 //========================================================================
24 
25 
26 #ifndef __TEXTURE_H
27 #define __TEXTURE_H
28 
29 namespace Neo
30 {
31 class NEO_ENGINE_EXPORT Texture
32 {
33 public:
34 
35  // constructor
36  Texture(TextureRef * texRef):
37  m_texRef(texRef),
38  m_genMode(TEX_GEN_NONE),
39  m_texTranslate(0, 0),
40  m_texScale(1, 1),
41  m_texRotate(0)
42  {
43  m_wrapMode[0] = WRAP_REPEAT;
44  m_wrapMode[1] = WRAP_REPEAT;
45  }
46 
47  // copy constructor
48  Texture(const Texture & texture):
49  m_texRef(texture.m_texRef),
50  m_genMode(texture.m_genMode),
51  m_texTranslate(texture.m_texTranslate),
52  m_texScale(texture.m_texScale),
53  m_texRotate(texture.m_texRotate)
54  {
55  m_wrapMode[0] = texture.m_wrapMode[0];
56  m_wrapMode[1] = texture.m_wrapMode[1];
57  }
58 
59 private:
60 
61  // texture ref
62  TextureRef * m_texRef;
63 
64  // gen mode
65  TEX_GEN_MODES m_genMode;
66 
67  // wrap mode
68  WRAP_MODES m_wrapMode[2];
69 
70  // texture matrix
71  Vector2 m_texTranslate;
72  Vector2 m_texScale;
73  float m_texRotate;
74 
75 public:
76 
77  // texture ref
78  void setTextureRef(TextureRef * texRef){ m_texRef = texRef; }
79  TextureRef * getTextureRef(void){ return m_texRef; }
80 
81  // gen mode
82  void setGenMode(TEX_GEN_MODES genMode){ m_genMode = genMode; }
83  TEX_GEN_MODES getGenMode(void){ return m_genMode; }
84 
85  // wrap mode
86  void setUWrapMode(WRAP_MODES wrapMode){ m_wrapMode[0] = wrapMode; }
87  void setVWrapMode(WRAP_MODES wrapMode){ m_wrapMode[1] = wrapMode; }
88  WRAP_MODES getUWrapMode(void){ return m_wrapMode[0]; }
89  WRAP_MODES getVWrapMode(void){ return m_wrapMode[1]; }
90 
91  // texture matrix
92  inline void setTexTranslate(const Vector2 & texTranslate){ m_texTranslate = texTranslate; }
93  inline void setTexScale(const Vector2 & texScale){ m_texScale = texScale; }
94  inline void setTexRotate(float texRotate){ m_texRotate = texRotate; }
95 
96  inline Vector2 getTexTranslate(void) const { return m_texTranslate; }
97  inline Vector2 getTexScale(void) const { return m_texScale; }
98  inline float getTexRotate(void){ return m_texRotate; }
99 };
100 }
101 #endif
WRAP_MODES getVWrapMode(void)
Definition: Texture.h:89
Definition: Texture.h:31
float getTexRotate(void)
Definition: Texture.h:98
void setGenMode(TEX_GEN_MODES genMode)
Definition: Texture.h:82
Vector2 getTexTranslate(void) const
Definition: Texture.h:96
TextureRef * getTextureRef(void)
Definition: Texture.h:79
TEX_GEN_MODES getGenMode(void)
Definition: Texture.h:83
void setUWrapMode(WRAP_MODES wrapMode)
Definition: Texture.h:86
Definition: RenderingContext.h:96
Texture(TextureRef *texRef)
Definition: Texture.h:36
void setVWrapMode(WRAP_MODES wrapMode)
Definition: Texture.h:87
WRAP_MODES
Definition: RenderingContext.h:124
TEX_GEN_MODES
Definition: RenderingContext.h:94
void setTexTranslate(const Vector2 &texTranslate)
Definition: Texture.h:92
WRAP_MODES getUWrapMode(void)
Definition: Texture.h:88
Definition: Vector2.h:31
Vector2 getTexScale(void) const
Definition: Texture.h:97
Definition: RenderingContext.h:126
void setTexScale(const Vector2 &texScale)
Definition: Texture.h:93
void setTexRotate(float texRotate)
Definition: Texture.h:94
void setTextureRef(TextureRef *texRef)
Definition: Texture.h:78
Definition: TextureRef.h:32
Texture(const Texture &texture)
Definition: Texture.h:48
Definition: Color.h:29