xoreos  0.0.5
trigger.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 ENGINES_AURORA_TRIGGER_H
26 #define ENGINES_AURORA_TRIGGER_H
27 
28 #include <vector>
29 
30 #include "glm/vec3.hpp"
31 
32 #include "src/common/boundingbox.h"
33 
35 
36 namespace Engines {
37 
38 class Trigger : public Graphics::Renderable {
39 public:
40  Trigger();
41 
42  void setVisible(bool visible);
43  bool contains(float x, float y) const;
44 
45  // .--- Renderable
46  void calculateDistance();
48  // '---
49 protected:
50  std::vector<glm::vec3> _geometry;
51  bool _visible;
52 
53  void prepare();
54 private:
55  typedef struct {
56  float m;
57  bool isVert;
58  } SlopeData;
59 
60  bool _prepared;
62  std::vector<SlopeData> _sides;
63 
64  bool isRayIntersect(float x, float y,
65  float x1, float y1,
66  float x2, float y2,
67  float m, bool isVert) const;
68 };
69 
70 } // End of namespace Engines
71 
72 #endif // ENGINES_AURORA_TRIGGER_H
bool isRayIntersect(float x, float y, float x1, float y1, float x2, float y2, float m, bool isVert) const
Definition: trigger.cpp:162
A bounding box around 3D points.
Definition: boundingbox.h:33
bool _prepared
Definition: trigger.h:60
RenderPass
Definition: types.h:97
std::vector< SlopeData > _sides
Definition: trigger.h:62
A bounding box.
Common::BoundingBox _boundingbox
Definition: trigger.h:61
An object that can be displayed by the graphics manager.
Definition: renderable.h:42
void render(Graphics::RenderPass pass)
Render the object.
Definition: trigger.cpp:91
void setVisible(bool visible)
Definition: trigger.cpp:43
std::vector< glm::vec3 > _geometry
Definition: trigger.h:50
#define pass
Definition: fft.cpp:257
An object that can be displayed by the graphics manager.
void calculateDistance()
Calculate the object&#39;s distance.
Definition: trigger.cpp:87
bool contains(float x, float y) const
Definition: trigger.cpp:51