xoreos  0.0.5
walkmesh.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_WALKMESH_H
26 #define GRAPHICS_AURORA_WALKMESH_H
27 
28 #include <vector>
29 
30 #include "glm/vec3.hpp"
31 
32 #include "src/common/types.h"
33 #include "src/common/scopedptr.h"
34 
36 
37 namespace Graphics {
38 
39 namespace Aurora {
40 
42 public:
43  Walkmesh();
44 
50  float getElevationAt(float x, float y, uint32 &faceIndex) const;
51 
52  bool testCollision(const glm::vec3 &orig, const glm::vec3 &dest) const;
53 
54  // .--- Rendering
55 
61  void highlightFace(uint32 index);
62 
63  void setInvisible(bool invisible);
64  void calculateDistance();
66 
67  // '---
68 protected:
69  std::vector<float> _vertices;
70  std::vector<uint32> _indices;
71  std::vector<bool> _faceWalkableMap;
72  std::vector<uint32> _indicesWalkable;
73  std::vector<uint32> _indicesNonWalkable;
75  bool _invisible;
76 
77  void refreshIndexGroups();
78 };
79 
80 } // End of namespace Aurora
81 
82 } // End of namespace Graphics
83 
84 #endif // GRAPHICS_AURORA_WALKMESH_H
bool testCollision(const glm::vec3 &orig, const glm::vec3 &dest) const
Definition: walkmesh.cpp:71
std::vector< uint32 > _indices
Definition: walkmesh.h:70
A simple scoped smart pointer template.
std::vector< bool > _faceWalkableMap
Definition: walkmesh.h:71
void setInvisible(bool invisible)
Definition: walkmesh.cpp:110
RenderPass
Definition: types.h:97
void render(Graphics::RenderPass pass)
Render the object.
Definition: walkmesh.cpp:117
Low-level type definitions to handle fixed width types portably.
std::vector< float > _vertices
Definition: walkmesh.h:69
void highlightFace(uint32 index)
Highlight face with specified index.
Definition: walkmesh.cpp:106
std::vector< uint32 > _indicesNonWalkable
Definition: walkmesh.h:73
An object that can be displayed by the graphics manager.
Definition: renderable.h:42
uint32_t uint32
Definition: types.h:204
std::vector< uint32 > _indicesWalkable
Definition: walkmesh.h:72
#define pass
Definition: fft.cpp:257
float getElevationAt(float x, float y, uint32 &faceIndex) const
Return elevation at given coordinates or FLT_MIN if can&#39;t walk there.
Definition: walkmesh.cpp:43
void calculateDistance()
Calculate the object&#39;s distance.
Definition: walkmesh.cpp:114
An object that can be displayed by the graphics manager.