ScummVM API documentation
floorface.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program 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 this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef STARK_RESOURCES_FLOOR_FACE_H
23 #define STARK_RESOURCES_FLOOR_FACE_H
24 
25 #include "common/array.h"
26 #include "common/str.h"
27 
28 #include "math/ray.h"
29 #include "math/vector3d.h"
30 
31 #include "engines/stark/resources/object.h"
32 
33 namespace Stark {
34 
35 namespace Formats {
36 class XRCReadStream;
37 }
38 
39 namespace Resources {
40 
41 class FloorEdge;
42 
46 class FloorFace : public Object {
47 public:
48  static const Type::ResourceType TYPE = Type::kFloorFace;
49 
50  FloorFace(Object *parent, byte subType, uint16 index, const Common::String &name);
51  virtual ~FloorFace();
52 
53  // Resource API
54  void onAllLoaded() override;
55 
57  bool isPointInside(const Math::Vector3d &point) const;
58 
60  void computePointHeight(Math::Vector3d &point) const;
61 
70  bool intersectRay(const Math::Ray &ray, Math::Vector3d &intersection) const;
71 
75  float distanceToRay(const Math::Ray &ray) const;
76 
78  float getDistanceFromCamera() const;
79 
81  int16 getVertexIndex(int32 index) const;
82 
84  void addEdge(FloorEdge *edge);
85 
87  Common::Array<FloorEdge *> getEdges() const;
88 
94  FloorEdge *findNearestEdge(const Math::Vector3d &point) const;
95 
97  Math::Vector3d getCenter() const;
98 
100  bool hasVertices() const;
101 
103  void enable(bool enable);
104  bool isEnabled() const;
105 
106 protected:
107  void readData(Formats::XRCReadStream *stream) override;
108  void printData() override;
109 
110  int16 _indices[3];
111  Math::Vector3d _vertices[3];
112 
113  Common::Array<FloorEdge *> _edges; // Owned by Floor
114 
115  float _distanceFromCamera;
116  float _unk2;
117 };
118 
119 } // End of namespace Resources
120 } // End of namespace Stark
121 
122 #endif // STARK_RESOURCES_FLOOR_FACE_H
Definition: str.h:59
Definition: array.h:52
Definition: floor.h:51
Definition: console.h:27
Definition: floorface.h:46
Definition: object.h:143
Definition: xrc.h:45