xoreos  0.0.5
cube.h
Go to the documentation of this file.
1 /* xoreos - A reimplementation of BioWare's Aurora engine
2  *
3  * xoreos is the legal property of its developers, whose names
4  * can be found in the AUTHORS file distributed with this source
5  * distribution.
6  *
7  * xoreos is free software; you can redistribute it and/or
8  * modify it under the terms of the GNU General Public License
9  * as published by the Free Software Foundation; either version 3
10  * of the License, or (at your option) any later version.
11  *
12  * xoreos is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with xoreos. If not, see <http://www.gnu.org/licenses/>.
19  */
20 
25 #ifndef GRAPHICS_AURORA_CUBE_H
26 #define GRAPHICS_AURORA_CUBE_H
27 
28 #include "glm/mat4x4.hpp"
29 
30 #include "src/graphics/types.h"
32 #include "src/graphics/object.h"
33 
35 
36 namespace Common {
37  class UString;
38  class SeekableReadStream;
39 }
40 
41 namespace Graphics {
42 
43 namespace Aurora {
44 
45 class Cube;
46 
48 class CubeSide : public Object {
49 public:
50  CubeSide(Cube &parent, int n);
51  ~CubeSide();
52 
53  void calculateDistance();
54  void render(RenderPass pass);
55 
56 private:
58  int _n;
59 
60  friend class Cube;
61 };
62 
64 class Cube : public GLContainer {
65 public:
66  Cube(const Common::UString &texture);
67  ~Cube();
68 
69 protected:
70  // GLContainer
71  void doRebuild();
72  void doDestroy();
73 
74 private:
76 
77  bool _firstTime;
78 
80  float _rotation;
81 
83 
85 
86  void applyTransformation(int n);
87  void applyTransformation(int n, glm::mat4 &m);
88  void setTexture();
89  void callList();
90 
91  void newFrame();
92  void reloadTextures();
93 
94  friend class CubeSide;
95 };
96 
97 } // End of namespace Aurora
98 
99 } // End of namespace Graphics
100 
101 #endif // GRAPHICS_AURORA_CUBE_H
TextureHandle _texture
Definition: cube.h:84
Definition: 2dafile.h:39
A class holding an UTF-8 string.
Definition: ustring.h:48
A "normal" renderable game object.
Basic graphics types.
A handle to an Aurora texture.
A cube side.
Definition: cube.h:48
A container of OpenGL elements.
CubeSide(Cube &parent, int n)
Definition: cube.cpp:50
void render(RenderPass pass)
Render the object.
Definition: cube.cpp:68
RenderPass
Definition: types.h:97
GLuint ListID
Definition: types.h:46
void calculateDistance()
Calculate the object&#39;s distance.
Definition: cube.cpp:60
uint32 _lastRotateTime
Definition: cube.h:79
void applyTransformation(int n)
Definition: cube.cpp:152
A renderable game object.
Definition: object.h:33
CubeSide * _sides[6]
Definition: cube.h:75
uint32_t uint32
Definition: types.h:204
A simple, rotating cube.
Definition: cube.h:64
Cube(const Common::UString &texture)
Definition: cube.cpp:82
A container of OpenGL elements.
Definition: glcontainer.h:35
#define pass
Definition: fft.cpp:257
A handle to a texture.
Definition: texturehandle.h:51