Skyscraper 2.0
utility.h
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Utility Object
3 The Skyscraper Project - Version 2.0
4 Copyright (C)2004-2024 Ryan Thoryk
5 https://www.skyscrapersim.net
6 https://sourceforge.net/projects/skyscraper/
7 Contact - ryan@skyscrapersim.net
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*/
23
24#ifndef _SBS_UTILITY_H
25#define _SBS_UTILITY_H
26
27namespace SBS {
28
30{
31public:
32 Utility(Object *parent);
33 ~Utility();
34 Vector2 GetExtents(PolyArray &varray, int coord, bool flip_z = false);
35 void Cut(Wall *wall, Vector3 start, Vector3 end, bool cutwalls, bool cutfloors, int checkwallnumber = 0, bool reset_check = true);
36 void GetDoorwayExtents(MeshObject *mesh, int checknumber, PolyArray &polygon);
37 Vector3 GetPolygonDirection(PolyArray &polygon);
38 Vector2 GetEndPoint(const Vector2 &StartPoint, Real angle, Real distance);
39 Plane ComputePlane(PolyArray &vertices, bool flip_normal = true);
40 void SplitWithPlane(int axis, PolyArray &orig, PolyArray &poly1, PolyArray &poly2, Real value);
41 Vector3 ComputeNormal(PolyArray &vertices, Real &D);
42 void ResetDoorwayWalls();
43 Wall* AddDoorwayWalls(MeshObject* mesh, const std::string &wallname, const std::string &texture, Real tw, Real th);
44
45private:
46
47 //Cut function work polygons
48 PolyArray temppoly, temppoly2, temppoly3, temppoly4, temppoly5, worker;
50
52
53 //doorway data
54 bool wall1a, wall1b, wall2a, wall2b;
55 Vector2 wall_extents_x, wall_extents_z, wall_extents_y;
56};
57
58}
59
60#endif
PolyArray newpoly
Definition utility.h:51
PolyArray temppoly
Definition utility.h:48
bool wall1a
Definition utility.h:54
Vector2 wall_extents_x
Definition utility.h:55
PolygonSet newpolys
Definition utility.h:49
Ogre::Vector3 Vector3
Definition globals.h:58
Ogre::Real Real
Definition globals.h:57
Ogre::Plane Plane
Definition globals.h:65
Ogre::Vector2 Vector2
Definition globals.h:59
#define SBSIMPEXP
Definition globals.h:53
std::vector< Vector3 > PolyArray
Definition sbs.h:118
std::vector< PolyArray > PolygonSet
Definition sbs.h:119