Pyrogenesis  trunk
MiniMap.h
Go to the documentation of this file.
1 /* Copyright (C) 2017 Wildfire Games.
2  * This file is part of 0 A.D.
3  *
4  * 0 A.D. is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * 0 A.D. is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef INCLUDED_MINIMAP
19 #define INCLUDED_MINIMAP
20 
21 #include "gui/GUI.h"
22 #include "renderer/VertexArray.h"
23 
24 
25 class CCamera;
26 class CTerrain;
27 
28 class CMiniMap : public IGUIObject
29 {
31 public:
32  CMiniMap();
33  virtual ~CMiniMap();
34 protected:
35  virtual void Draw();
36 
37  /**
38  * @see IGUIObject#HandleMessage()
39  */
40  virtual void HandleMessage(SGUIMessage& Message);
41 
42  /**
43  * @see IGUIObject#MouseOver()
44  */
45  virtual bool MouseOver();
46 
47  // create the minimap textures
48  void CreateTextures();
49 
50  // rebuild the terrain texture map
51  void RebuildTerrainTexture();
52 
53  // destroy and free any memory and textures
54  void Destroy();
55 
56  void SetCameraPos();
57 
58  void FireWorldClickEvent(int button, int clicks);
59 
60  // the terrain we are mini-mapping
62 
63  const CCamera* m_Camera;
64 
65  //Whether or not the mouse is currently down
66  bool m_Clicking;
67 
68  // minimap texture handles
70 
71  // texture data
73 
74  // whether we need to regenerate the terrain texture
76 
78 
79  // map size
81 
82  // texture size
83  GLsizei m_TextureSize;
84 
85  // 1.f if map is circular or 1.414f if square (to shrink it inside the circle)
86  float m_MapScale;
87 
88  // maximal water height to allow the passage of a unit (for underwater shallows).
90 
92 
93  void DrawTexture(CShaderProgramPtr shader, float coordMax, float angle, float x, float y, float x2, float y2, float z);
94 
95  void DrawViewRect(CMatrix3D transform);
96 
97  void GetMouseWorldCoordinates(float& x, float& z);
98 
99  float GetAngle();
100 
105 
107 
112 };
113 
114 #endif // INCLUDED_MINIMAP
GLuint m_TerrainTexture
Definition: MiniMap.h:69
Definition: MiniMap.h:28
virtual ~CMiniMap()
Definition: MiniMap.cpp:137
float GetAngle()
Definition: MiniMap.cpp:231
void Destroy()
Calls Destroy on all children, and deallocates all memory.
Definition: MiniMap.cpp:698
void DrawTexture(CShaderProgramPtr shader, float coordMax, float angle, float x, float y, float x2, float y2, float z)
Definition: MiniMap.cpp:337
void RebuildTerrainTexture()
Definition: MiniMap.cpp:635
const CTerrain * m_Terrain
Definition: MiniMap.h:61
Definition: Terrain.h:51
bool m_Clicking
Definition: MiniMap.h:66
VertexArray::Attribute m_AttributePos
Definition: MiniMap.h:103
Base settings, all objects possess these settings in their m_BaseSettings Instructions can be found i...
Definition: IGUIObject.h:117
virtual void HandleMessage(SGUIMessage &Message)
Definition: MiniMap.cpp:142
ssize_t m_Height
Definition: MiniMap.h:77
A VertexArray that is specialised to handle 16-bit array indices.
Definition: VertexArray.h:214
u32 * m_TerrainData
Definition: MiniMap.h:72
Definition: Matrix3D.h:33
CMiniMap()
Definition: MiniMap.cpp:65
float m_ShallowPassageHeight
Definition: MiniMap.h:89
float m_WaterHeight
Definition: MiniMap.h:91
uint32_t u32
Definition: types.h:39
VertexArray::Attribute m_AttributeColor
Definition: MiniMap.h:104
Definition: VertexArray.h:135
double m_PingDuration
Definition: MiniMap.h:108
bool m_TerrainDirty
Definition: MiniMap.h:75
void GetMouseWorldCoordinates(float &x, float &z)
Definition: MiniMap.cpp:205
GLsizei m_TextureSize
Definition: MiniMap.h:83
Definition: Camera.h:39
virtual bool MouseOver()
Definition: MiniMap.cpp:190
Definition: VertexArray.h:132
ssize_t m_MapSize
Definition: MiniMap.h:80
double m_NextBlinkTime
Definition: MiniMap.h:110
VertexIndexArray m_IndexArray
Definition: MiniMap.h:101
intptr_t ssize_t
Definition: wposix_types.h:82
float m_MapScale
Definition: MiniMap.h:86
void FireWorldClickEvent(int button, int clicks)
Definition: MiniMap.cpp:237
void DrawViewRect(CMatrix3D transform)
Definition: MiniMap.cpp:254
void CreateTextures()
Definition: MiniMap.cpp:608
ssize_t m_Width
Definition: MiniMap.h:77
VertexArray m_VertexArray
Definition: MiniMap.h:102
Message send to IGUIObject::HandleMessage() in order to give life to Objects manually with a derived ...
Definition: GUIbase.h:91
bool m_BlinkState
Definition: MiniMap.h:111
void SetCameraPos()
Definition: MiniMap.cpp:221
size_t m_EntitiesDrawn
Definition: MiniMap.h:106
const CCamera * m_Camera
Definition: MiniMap.h:63
virtual void Draw()
Draws the object.
Definition: MiniMap.cpp:376
#define GUI_OBJECT(obj)
Definition: GUIbase.h:48
std::shared_ptr< CShaderProgram > CShaderProgramPtr
Definition: ShaderProgramPtr.h:25
double m_HalfBlinkDuration
Definition: MiniMap.h:109