Skyscraper 2.0
SBS::Polygon Class Reference

#include <polygon.h>

Inheritance diagram for SBS::Polygon:
Collaboration diagram for SBS::Polygon:

Classes

struct  Geometry
 

Public Types

typedef std::vector< std::vector< Geometry > > GeometrySet
 

Public Member Functions

 Polygon (Object *parent, const std::string &name, MeshObject *meshwrapper, GeometrySet &geometry, std::vector< Triangle > &triangles, Matrix3 &tex_matrix, Vector3 &tex_vector, const std::string &material, Plane &plane)
 
 ~Polygon ()
 
void GetTextureMapping (Matrix3 &t_matrix, Vector3 &t_vector)
 
bool IntersectSegment (const Vector3 &start, const Vector3 &end, Vector3 &isect, Real *pr, Vector3 &normal)
 
bool IntersectRay (const Vector3 &start, const Vector3 &end)
 
bool IntersectSegmentPlane (const Vector3 &start, const Vector3 &end, Vector3 &isect, Real *pr, Vector3 &normal)
 
void Move (const Vector3 &vector, Real speed=1.0)
 
Plane GetAbsolutePlane ()
 
Vector2 GetExtents (int coord)
 
void ChangeHeight (Real newheight)
 
bool ReplaceTexture (const std::string &oldtexture, const std::string &newtexture)
 
bool ChangeTexture (const std::string &texture, bool matcheck=true)
 
Vector3 GetVertex (int index)
 
- Public Member Functions inherited from SBS::ObjectBase
 ObjectBase (Object *parent)
 
virtual ~ObjectBase ()
 
ObjectGetParent ()
 
SBSGetRoot ()
 
void SetName (const std::string &name)
 
const std::string & GetName ()
 
std::string GetNameBase ()
 
virtual void Report (const std::string &message)
 
virtual bool ReportError (const std::string &message)
 

Public Attributes

MeshObjectmesh
 
GeometrySet geometry
 
int vertex_count
 
std::vector< Triangletriangles
 
Plane plane
 
Matrix3 t_matrix
 
Vector3 t_vector
 
std::string material
 
size_t size
 

Additional Inherited Members

- Protected Attributes inherited from SBS::ObjectBase
SBSsbs
 

Detailed Description

Definition at line 34 of file polygon.h.

Member Typedef Documentation

◆ GeometrySet

typedef std::vector<std::vector<Geometry> > SBS::Polygon::GeometrySet

Definition at line 44 of file polygon.h.

Constructor & Destructor Documentation

◆ Polygon()

SBS::Polygon::Polygon ( Object * parent,
const std::string & name,
MeshObject * meshwrapper,
GeometrySet & geometry,
std::vector< Triangle > & triangles,
Matrix3 & tex_matrix,
Vector3 & tex_vector,
const std::string & material,
Plane & plane )

◆ ~Polygon()

SBS::Polygon::~Polygon ( )

Member Function Documentation

◆ ChangeHeight()

void SBS::Polygon::ChangeHeight ( Real newheight)

◆ ChangeTexture()

bool SBS::Polygon::ChangeTexture ( const std::string & texture,
bool matcheck = true )

◆ GetAbsolutePlane()

Plane SBS::Polygon::GetAbsolutePlane ( )

Definition at line 99 of file polygon.cpp.

References SBS::Object::GetPosition(), mesh, plane, SBS::ObjectBase::sbs, and SBS::SBS::ToRemote().

Referenced by IntersectRay(), and IntersectSegmentPlane().

Here is the call graph for this function:

◆ GetExtents()

Vector2 SBS::Polygon::GetExtents ( int coord)

Definition at line 106 of file polygon.cpp.

References geometry, SBS::Utility::GetExtents(), SBS::SBS::GetUtility(), and SBS::ObjectBase::sbs.

Referenced by ChangeHeight().

Here is the call graph for this function:

◆ GetTextureMapping()

void SBS::Polygon::GetTextureMapping ( Matrix3 & t_matrix,
Vector3 & t_vector )

Definition at line 74 of file polygon.cpp.

References t_matrix, and t_vector.

Referenced by SBS::Utility::Cut().

◆ GetVertex()

Vector3 SBS::Polygon::GetVertex ( int index)

Definition at line 205 of file polygon.cpp.

References geometry.

Referenced by SBS::MeshObject::HitBeam().

◆ IntersectRay()

bool SBS::Polygon::IntersectRay ( const Vector3 & start,
const Vector3 & end )

Intersect object-space ray with this polygon. This function is similar to IntersectSegment except that it doesn't keep the length of the ray in account. It just tests if the ray intersects with the interior of the polygon. Note that this function also does back-face culling.

Definition at line 385 of file texmap.cpp.

References geometry, GetAbsolutePlane(), SBS::Object::GetPosition(), mesh, plane, SBS::ObjectBase::sbs, SMALL_EPSILON, SBS::SBS::ToLocal(), and SBS::SBS::ToRemote().

Referenced by IntersectSegment().

Here is the call graph for this function:

◆ IntersectSegment()

bool SBS::Polygon::IntersectSegment ( const Vector3 & start,
const Vector3 & end,
Vector3 & isect,
Real * pr,
Vector3 & normal )

Intersect object-space segment with this polygon. Return true if it intersects and the intersection point in world coordinates.

Definition at line 440 of file texmap.cpp.

References IntersectRay(), and IntersectSegmentPlane().

Referenced by SBS::PolyMesh::FindWallIntersect().

Here is the call graph for this function:

◆ IntersectSegmentPlane()

bool SBS::Polygon::IntersectSegmentPlane ( const Vector3 & start,
const Vector3 & end,
Vector3 & isect,
Real * pr,
Vector3 & normal )

Intersect object-space segment with the plane of this polygon. Return true if it intersects and the intersection point in world coordinates.

Definition at line 457 of file texmap.cpp.

References GetAbsolutePlane(), plane, and SMALL_EPSILON.

Referenced by IntersectSegment().

Here is the call graph for this function:

◆ Move()

void SBS::Polygon::Move ( const Vector3 & vector,
Real speed = 1.0 )

◆ ReplaceTexture()

bool SBS::Polygon::ReplaceTexture ( const std::string & oldtexture,
const std::string & newtexture )

Member Data Documentation

◆ geometry

◆ material

◆ mesh

MeshObject* SBS::Polygon::mesh

◆ plane

Plane SBS::Polygon::plane

Definition at line 50 of file polygon.h.

Referenced by GetAbsolutePlane(), IntersectRay(), IntersectSegmentPlane(), and Polygon().

◆ size

size_t SBS::Polygon::size

Definition at line 58 of file polygon.h.

Referenced by SBS::MeshObject::GetSize(), and Polygon().

◆ t_matrix

Matrix3 SBS::Polygon::t_matrix

Definition at line 53 of file polygon.h.

Referenced by GetTextureMapping(), and Polygon().

◆ t_vector

Vector3 SBS::Polygon::t_vector

Definition at line 54 of file polygon.h.

Referenced by GetTextureMapping(), and Polygon().

◆ triangles

◆ vertex_count

int SBS::Polygon::vertex_count

Definition at line 48 of file polygon.h.

Referenced by Polygon(), and SBS::DynamicMesh::Mesh::Prepare().


The documentation for this class was generated from the following files: