Skyscraper 2.0
wall.h
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Wall 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_WALL_H
25#define _SBS_WALL_H
26
27#include "triangle.h"
28#include "mesh.h"
29
30namespace SBS {
31
32class Polygon;
33class PolyMesh;
34
35class SBSIMPEXP Wall : public Object
36{
37 friend class MeshObject;
38
39public:
40
41 //functions
42 Wall(MeshObject* wrapper);
43 ~Wall();
44 Polygon* AddQuad(const std::string &name, const std::string &texture, const Vector3 &v1, const Vector3 &v2, const Vector3 &v3, const Vector3 &v4, Real tw, Real th, bool autosize);
45 Polygon* AddPolygon(const std::string &name, const std::string &texture, PolyArray &vertices, Real tw, Real th, bool autosize);
46 Polygon* AddPolygonSet(const std::string &name, const std::string &material, PolygonSet &vertices, Matrix3 &tex_matrix, Vector3 &tex_vector);
47 void DeletePolygons(bool recreate_collider = true);
48 void DeletePolygon(int index, bool recreate_colliders);
49 int GetPolygonCount();
50 Polygon* GetPolygon(int index);
51 int FindPolygon(const std::string &name);
52 //void GetGeometry(int index, PolygonSet &vertices, bool firstonly = false, bool convert = true, bool rescale = true, bool relative = true, bool reverse = false);
53 bool IntersectsWall(Vector3 start, Vector3 end, Vector3 &isect, bool convert = true);
54 void Move(const Vector3 &vector, Real speed = 1.0);
55 MeshObject* GetMesh();
56 void SetParentArray(std::vector<Wall*> &array);
57 Vector3 GetPoint(const Vector3 &start, const Vector3 &end);
58 Vector3 GetWallExtents(Real altitude, bool get_max);
59 void ChangeHeight(Real newheight);
60 unsigned int GetVertexCount();
61 unsigned int GetTriangleCount();
62 bool ReplaceTexture(const std::string &oldtexture, const std::string &newtexture);
63 bool ChangeTexture(const std::string &texture, bool matcheck = true);
64
65private:
66 //mesh wrapper
68
69 //polygon array
70 std::vector<Polygon*> polygons;
71
72 //pointer to parent array
73 std::vector<Wall*> *parent_array;
74};
75
76}
77
78#endif
std::vector< Wall * > * parent_array
Definition wall.h:73
std::vector< Polygon * > polygons
Definition wall.h:70
MeshObject * meshwrapper
Definition wall.h:67
Ogre::Matrix3 Matrix3
Definition globals.h:64
Ogre::Vector3 Vector3
Definition globals.h:58
Ogre::Real Real
Definition globals.h:57
#define SBSIMPEXP
Definition globals.h:53
std::vector< Vector3 > PolyArray
Definition sbs.h:118
std::vector< PolyArray > PolygonSet
Definition sbs.h:119