ScummVM API documentation
te_pick_mesh2.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 TETRAEDGE_TE_TE_PICK_MESH2_H
23 #define TETRAEDGE_TE_TE_PICK_MESH2_H
24 
25 #include "common/array.h"
26 #include "tetraedge/te/te_3d_object2.h"
27 #include "tetraedge/te/te_vector2f32.h"
28 #include "tetraedge/te/te_vector3f32.h"
29 
30 namespace Tetraedge {
31 
32 class TePickMesh2 : public Te3DObject2 {
33 public:
34  TePickMesh2();
35 
36  void draw() override;
37 
38  bool intersect(const TeVector3f32 &v1, const TeVector3f32 &v2, TeVector3f32 &v3, float &fout, bool useLastHit, uint *triangleHitOut);
39  bool intersect2D(const TeVector2f32 &pt);
40  uint lastTriangleHit() const;
41 
42  bool pointInTriangle(const TeVector2f32 &p1, const TeVector2f32 &p2, const TeVector2f32 &p3, const TeVector2f32 &p4) const;
43 
44  void setLastTriangleHit(uint lastHit) { _lastTriangleHit = lastHit; }
45  void setNbTriangles(uint num);
46 
47  void setTriangle(uint num, const TeVector3f32 &v1, const TeVector3f32 &v2, const TeVector3f32 &v3);
48  void triangle(uint num, TeVector3f32 &v1out, TeVector3f32 &v2out, TeVector3f32 &v3out) const;
49 
50  TeVector3f32 slide(const TeVector3f32 &pos);
51 
52  static void serialize(Common::WriteStream &stream, const TePickMesh2 &mesh);
53  static void deserialize(Common::ReadStream &stream, TePickMesh2 &mesh);
54 
55  Common::Array<TeVector3f32> &verticies() { return _verticies; }
56  const Common::Array<TeVector3f32> &verticies() const { return _verticies; }
57 
58 protected:
59  Common::Array<TeVector3f32> _verticies;
60  uint _lastTriangleHit;
61 
62 };
63 
64 } // end namespace Tetraedge
65 
66 #endif // TETRAEDGE_TE_TE_PICK_MESH2_H
Definition: detection.h:27
Definition: stream.h:77
Definition: array.h:52
Definition: te_3d_object2.h:36
Definition: te_vector3f32.h:33
Definition: te_pick_mesh2.h:32
Definition: stream.h:385
Definition: te_vector2f32.h:32