V-Gears 0
Free Final Fantasy VII engine.
Walkmesh.h
Go to the documentation of this file.
1/*
2 * Copyright (C) 2022 The V-Gears Team
3 *
4 * This file is part of V-Gears
5 *
6 * V-Gears is free software: you can redistribute it and/or modify it under
7 * terms of the GNU General Public License as published by the Free Software
8 * Foundation, version 3.0 (GPLv3) of the License.
9 *
10 * V-Gears is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#pragma once
17
18#include <Ogre.h>
19#include <vector>
20
25
29 WalkmeshTriangle(): a(0, 0, 0), b(0, 0, 0), c(0, 0, 0), locked(false){
30 access_side[0] = -1;
31 access_side[1] = -1;
32 access_side[2] = -1;
33 }
34
38 Ogre::Vector3 a;
39
43 Ogre::Vector3 b;
44
48 Ogre::Vector3 c;
49
54
58 bool locked;
59};
60
61namespace VGears{
62 typedef Ogre::SharedPtr<class WalkmeshFile> WalkmeshFilePtr;
63}
64
69
70 public:
71
75 Walkmesh();
76
80 virtual ~Walkmesh();
81
85 void UpdateDebug();
86
90 void Clear();
91
97 void AddTriangle(const WalkmeshTriangle& triangle);
98
107 int GetAccessSide(unsigned int triangle_id, unsigned char side) const;
108
115 const Ogre::Vector3& GetA(unsigned int triangle_id) const;
116
123 const Ogre::Vector3& GetB(unsigned int triangle_id) const;
124
131 const Ogre::Vector3& GetC(unsigned int triangle_id) const;
132
138 int GetNumberOfTriangles() const;
139
146 void LockWalkmesh(unsigned int triangle_id, bool lock);
147
154 bool IsLocked(unsigned int triangle_id) const;
155
161 virtual void load(const VGears::WalkmeshFilePtr &walkmesh);
162
163 private:
164
168 std::vector<WalkmeshTriangle> triangles_;
169};
170
A walkmesh.
Definition: Walkmesh.h:68
void AddTriangle(const WalkmeshTriangle &triangle)
Adds a triangle to the walkmesh.
Definition: Walkmesh.cpp:55
bool IsLocked(unsigned int triangle_id) const
Checks if a triangle is locked.
Definition: Walkmesh.cpp:103
Walkmesh()
Constructor.
Definition: Walkmesh.cpp:26
void UpdateDebug()
Updates the walkmesh with debug information.
Definition: Walkmesh.cpp:31
const Ogre::Vector3 & GetB(unsigned int triangle_id) const
Retrieves the second side of a triangle.
Definition: Walkmesh.cpp:77
virtual ~Walkmesh()
Destructor.
Definition: Walkmesh.cpp:28
void LockWalkmesh(unsigned int triangle_id, bool lock)
Locks or unlocks a triangle.
Definition: Walkmesh.cpp:95
int GetAccessSide(unsigned int triangle_id, unsigned char side) const
Checks which other triangle is accessed from one side of a triangle.
Definition: Walkmesh.cpp:57
void Clear()
Deletes all the triangles in the walkmesh.
Definition: Walkmesh.cpp:53
const Ogre::Vector3 & GetC(unsigned int triangle_id) const
Retrieves the third side of a triangle.
Definition: Walkmesh.cpp:85
int GetNumberOfTriangles() const
Counts the triangles in the walkmesh.
Definition: Walkmesh.cpp:93
const Ogre::Vector3 & GetA(unsigned int triangle_id) const
Retrieves the first side of a triangle.
Definition: Walkmesh.cpp:69
virtual void load(const VGears::WalkmeshFilePtr &walkmesh)
Loads a walkmesh from a file.
Definition: Walkmesh.cpp:111
std::vector< WalkmeshTriangle > triangles_
The list of triangles.
Definition: Walkmesh.h:168
Definition: FF7NameLookup.h:24
Ogre::SharedPtr< class WalkmeshFile > WalkmeshFilePtr
Definition: Walkmesh.h:62
A triangle of a walkmesh.
Definition: Walkmesh.h:24
WalkmeshTriangle()
Constructor.
Definition: Walkmesh.h:29
Ogre::Vector3 b
A side of the triangle.
Definition: Walkmesh.h:43
Ogre::Vector3 c
A side of the triangle.
Definition: Walkmesh.h:48
Ogre::Vector3 a
A side of the triangle.
Definition: Walkmesh.h:38
int access_side[3]
Definition: Walkmesh.h:53
bool locked
Indicates if the triangle is locked (if it's walkable).
Definition: Walkmesh.h:58