Skyscraper 2.0
SBS::MeshObject Class Reference

#include <mesh.h>

Inheritance diagram for SBS::MeshObject:
Collaboration diagram for SBS::MeshObject:

Public Member Functions

 MeshObject (Object *parent, const std::string &name, DynamicMesh *wrapper=0, const std::string &filename="", const std::string &meshname="", Real max_render_distance=0, Real scale_multiplier=1, bool create_collider=true, bool dynamic_buffers=false)
 
virtual ~MeshObject ()
 
void Enabled (bool value)
 
void EnableCollider (bool value)
 
bool IsEnabled ()
 
Wall * CreateWallObject (const std::string &name)
 
Wall * GetWallByName (std::string name)
 
void Prepare (bool force=false)
 
void EnableDebugView (bool value)
 
void CreateColliderFromModel (int &vertex_count, Vector3 *&vertices, int &index_count, unsigned long *&indices)
 
void CreateBoxCollider ()
 
void DeleteWalls ()
 
void DeleteWalls (Object *parent)
 
Vector3 GetPoint (const std::string &wallname, const Vector3 &start, const Vector3 &end)
 
Vector3 GetWallExtents (const std::string &name, Real altitude, bool get_max)
 
void OnMove (bool parent)
 
void OnRotate (bool parent)
 
bool IsVisible (Ogre::Camera *camera)
 
bool IsPhysical ()
 
Vector3 GetOffset ()
 
void Cut (Vector3 start, Vector3 end, bool cutwalls, bool cutfloors, int checkwallnumber=0, bool reset_check=true)
 
void CutOutsideBounds (Vector3 start, Vector3 end, bool cutwalls, bool cutfloors)
 
bool UsingDynamicBuffers ()
 
void GetBounds ()
 
void ChangeHeight (Real newheight)
 
void EnableShadows (bool value)
 
PolyMesh * GetPolyMesh ()
 
bool IsPrepared ()
 
void ResetPrepare ()
 
bool ReplaceTexture (const std::string &oldtexture, const std::string &newtexture)
 
bool ChangeTexture (const std::string &texture, bool matcheck=true)
 
Vector2 GetExtents (int coord, bool flip_z=false)
 
Real GetHeight ()
 
Real HitBeam (const Vector3 &origin, const Vector3 &direction, Real max_distance)
 
void CreateCollider ()
 
void DeleteCollider ()
 
Wall * FindPolygon (const std::string &name, int &index)
 
bool InBoundingBox (const Vector3 &pos, bool check_y)
 
DynamicMesh * GetDynamicMesh ()
 
void GetMeshInformation (const Ogre::Mesh *const mesh, int &vertex_count, Vector3 *&vertices, int &index_count, unsigned long *&indices, Ogre::AxisAlignedBox &extents)
 
unsigned int GetVertexCount ()
 
unsigned int GetTriangleCount (const std::string &material, bool total)
 
bool LoadFromMesh (const std::string &meshname)
 
void SetMaterial (const std::string &material)
 
void EnablePhysics (bool value, Real restitution=0, Real friction=0, Real mass=0)
 
size_t GetSize ()
 
- Public Member Functions inherited from SBS::Object
 Object (Object *parent)
 
virtual ~Object ()
 
void SetValues (const std::string &type, const std::string &name, bool is_permanent, bool is_movable=true)
 
bool IsPermanent ()
 
bool IsMovable ()
 
const std::string & GetType ()
 
int GetNumber ()
 
void AddChild (Object *object)
 
Object * GetChild (int index)
 
int GetChildrenCount ()
 
void RemoveChild (Object *object)
 
SceneNode * GetSceneNode ()
 
void ShowBoundingBox (bool value)
 
virtual void Move (const Vector3 &vector, Real speed=1.0, bool force=false)
 
virtual void Move (Real X, Real Y, Real Z, Real speed=1.0, bool force=false)
 
virtual void SetPosition (const Vector3 &position, bool relative=false, bool force=false)
 
virtual void SetPosition (Real X, Real Y, Real Z, bool relative=false, bool force=false)
 
virtual void SetPositionY (Real value, bool force=false)
 
virtual Vector3 GetPosition (bool relative=false)
 
virtual void Rotate (const Vector3 &vector, Real speed=1.0)
 
virtual void Rotate (Real X, Real Y, Real Z, Real speed=1.0)
 
virtual void SetRotation (const Vector3 &rotation)
 
virtual void SetRotation (Real X, Real Y, Real Z)
 
virtual Vector3 GetRotation ()
 
Quaternion GetOrientation (bool relative=false)
 
void SetOrientation (const Quaternion &q, bool relative=false)
 
virtual void OnClick (Vector3 &position, bool shift, bool ctrl, bool alt, bool right)
 
virtual void OnUnclick (bool right)
 
virtual void OnHit ()
 
void NotifyMove (bool parent=false)
 
void NotifyRotate (bool parent=false)
 
virtual void ResetState ()
 
void ChangeParent (Object *new_parent)
 
bool IsGlobal ()
 
void Init (bool children=true)
 
virtual void OnInit ()
 
virtual void Loop ()
 
void RegisterLoop (Object *object)
 
void UnregisterLoop (Object *object)
 
std::string GetNameBase ()
 
template<typename T >
bool IsType ()
 
template<typename T >
T * ConvertTo ()
 
- Public Member Functions inherited from SBS::ObjectBase
 ObjectBase (Object *parent)
 
virtual ~ObjectBase ()
 
Object * GetParent ()
 
SBS * GetRoot ()
 
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

std::string name
 
bool create_collider
 
bool tricollider
 
bool remove_on_disable
 
DynamicMesh * MeshWrapper
 
std::vector< Wall * > Walls
 
SceneNode * collider_node
 
Ogre::AxisAlignedBox * Bounds
 
OgreBulletDynamics::RigidBody * mBody
 
OgreBulletCollisions::CollisionShape * mShape
 
std::string Filename
 
std::string Meshname
 
bool model_loaded
 
- Public Attributes inherited from SBS::Object
std::string command
 
std::string command_processed
 
std::string context
 
int linenum
 
std::string includefile
 
bool parent_deleting
 

Private Member Functions

bool LoadFromFile (const std::string &filename)
 
bool LoadColliderModel (Ogre::MeshPtr &collidermesh)
 

Private Attributes

bool enabled
 
bool is_physical
 
Real restitution
 
Real friction
 
Real mass
 
bool prepared
 
bool wrapper_selfcreate
 
PolyMesh * polymesh
 
Ogre::MeshPtr collidermesh
 
size_t size
 

Additional Inherited Members

- Protected Member Functions inherited from SBS::Object
void EnableLoop (bool value)
 
void LoopChildren ()
 
bool SelfDestruct ()
 
- Protected Attributes inherited from SBS::ObjectBase
SBS * sbs
 

Detailed Description

Definition at line 43 of file mesh.h.

Constructor & Destructor Documentation

◆ MeshObject()

SBS::MeshObject::MeshObject ( Object * parent,
const std::string & name,
DynamicMesh * wrapper = 0,
const std::string & filename = "",
const std::string & meshname = "",
Real max_render_distance = 0,
Real scale_multiplier = 1,
bool create_collider = true,
bool dynamic_buffers = false )

◆ ~MeshObject()

SBS::MeshObject::~MeshObject ( )
virtual

Member Function Documentation

◆ ChangeHeight()

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

Definition at line 652 of file mesh.cpp.

References SBS_PROFILE, and Walls.

Referenced by SBS::Elevator::MoveObjects().

◆ ChangeTexture()

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

◆ CreateBoxCollider()

◆ CreateCollider()

◆ CreateColliderFromModel()

void SBS::MeshObject::CreateColliderFromModel ( int & vertex_count,
Vector3 *& vertices,
int & index_count,
unsigned long *& indices )

◆ CreateWallObject()

◆ Cut()

void SBS::MeshObject::Cut ( Vector3 start,
Vector3 end,
bool cutwalls,
bool cutfloors,
int checkwallnumber = 0,
bool reset_check = true )

Definition at line 509 of file mesh.cpp.

References SBS::Utility::Cut(), SBS::SBS::GetUtility(), SBS::ObjectBase::sbs, and Walls.

Referenced by CutOutsideBounds(), and Skyscraper::ScriptProcessor::CommandsSection::Run().

Here is the call graph for this function:

◆ CutOutsideBounds()

void SBS::MeshObject::CutOutsideBounds ( Vector3 start,
Vector3 end,
bool cutwalls,
bool cutfloors )

Definition at line 522 of file mesh.cpp.

References Cut().

Here is the call graph for this function:

◆ DeleteCollider()

void SBS::MeshObject::DeleteCollider ( )

◆ DeleteWalls() [1/2]

void SBS::MeshObject::DeleteWalls ( )

Definition at line 370 of file mesh.cpp.

References SBS::Wall::DeletePolygons(), SBS::SBS::FastDelete, SBS::Object::parent_deleting, SBS::ObjectBase::sbs, and Walls.

Referenced by SBS::Floor::~Floor(), and ~MeshObject().

Here is the call graph for this function:

◆ DeleteWalls() [2/2]

void SBS::MeshObject::DeleteWalls ( Object * parent)

Definition at line 389 of file mesh.cpp.

References SBS::Wall::DeletePolygons(), SBS::ObjectBase::GetParent(), SBS::Object::parent_deleting, and Walls.

Here is the call graph for this function:

◆ EnableCollider()

void SBS::MeshObject::EnableCollider ( bool value)

Definition at line 179 of file mesh.cpp.

References SBS::SBS::camera, SBS::Camera::IsActive(), mBody, remove_on_disable, SBS::Camera::ResetCollisions(), SBS::ObjectBase::sbs, and SBS_PROFILE.

Referenced by Enabled().

Here is the call graph for this function:

◆ Enabled()

◆ EnableDebugView()

void SBS::MeshObject::EnableDebugView ( bool value)

Definition at line 278 of file mesh.cpp.

References SBS::DynamicMesh::EnableDebugView(), and MeshWrapper.

Here is the call graph for this function:

◆ EnablePhysics()

void SBS::MeshObject::EnablePhysics ( bool value,
Real restitution = 0,
Real friction = 0,
Real mass = 0 )

◆ EnableShadows()

void SBS::MeshObject::EnableShadows ( bool value)

Definition at line 667 of file mesh.cpp.

References SBS::DynamicMesh::EnableShadows(), and MeshWrapper.

Here is the call graph for this function:

◆ FindPolygon()

Wall * SBS::MeshObject::FindPolygon ( const std::string & name,
int & index )

Definition at line 995 of file mesh.cpp.

References SBS::Wall::FindPolygon(), name, and Walls.

Here is the call graph for this function:

◆ GetBounds()

void SBS::MeshObject::GetBounds ( )

Definition at line 149 of file mesh.cpp.

References Bounds, SBS::DynamicMesh::GetBounds(), and MeshWrapper.

Referenced by SBS::Vehicle::CreateChassis(), and EnablePhysics().

Here is the call graph for this function:

◆ GetDynamicMesh()

DynamicMesh * SBS::MeshObject::GetDynamicMesh ( )

Definition at line 1041 of file mesh.cpp.

References MeshWrapper.

Referenced by SBS::Polygon::ChangeTexture(), and SBS::Polygon::ReplaceTexture().

◆ GetExtents()

Vector2 SBS::MeshObject::GetExtents ( int coord,
bool flip_z = false )

Definition at line 931 of file mesh.cpp.

References SBS::Polygon::geometry, and Walls.

◆ GetHeight()

Real SBS::MeshObject::GetHeight ( )

Definition at line 726 of file mesh.cpp.

References SBS::Polygon::geometry, SBS::ObjectBase::sbs, SBS::SBS::ToLocal(), and Walls.

Referenced by SBS::ElevatorCar::SetHeight().

Here is the call graph for this function:

◆ GetMeshInformation()

void SBS::MeshObject::GetMeshInformation ( const Ogre::Mesh *const mesh,
int & vertex_count,
Vector3 *& vertices,
int & index_count,
unsigned long *& indices,
Ogre::AxisAlignedBox & extents )

Definition at line 1046 of file mesh.cpp.

References SBS::Object::GetSceneNode(), SBS::ObjectBase::sbs, and SBS::SBS::ToRemote().

Referenced by EnablePhysics().

Here is the call graph for this function:

◆ GetOffset()

Vector3 SBS::MeshObject::GetOffset ( )

Definition at line 494 of file mesh.cpp.

References Bounds, SBS::Object::GetSceneNode(), SBS::ObjectBase::sbs, and SBS::SBS::ToLocal().

Referenced by SBS::Model::OnInit().

Here is the call graph for this function:

◆ GetPoint()

Vector3 SBS::MeshObject::GetPoint ( const std::string & wallname,
const Vector3 & start,
const Vector3 & end )

Definition at line 410 of file mesh.cpp.

References SBS::Wall::GetPoint(), and GetWallByName().

Referenced by Skyscraper::ScriptProcessor::CommandsSection::Run().

Here is the call graph for this function:

◆ GetPolyMesh()

PolyMesh * SBS::MeshObject::GetPolyMesh ( )

◆ GetSize()

size_t SBS::MeshObject::GetSize ( )

Definition at line 1245 of file mesh.cpp.

References size, SBS::Polygon::size, and Walls.

◆ GetTriangleCount()

unsigned int SBS::MeshObject::GetTriangleCount ( const std::string & material,
bool total )

Definition at line 1173 of file mesh.cpp.

References SBS::Polygon::material, SBS::Polygon::triangles, and Walls.

Referenced by CreateCollider().

◆ GetVertexCount()

unsigned int SBS::MeshObject::GetVertexCount ( )

◆ GetWallByName()

Wall * SBS::MeshObject::GetWallByName ( std::string name)

Definition at line 217 of file mesh.cpp.

References SBS::ObjectBase::GetName(), name, SBS::SetCase(), SBS::SetCaseCopy(), and Walls.

Referenced by GetPoint(), GetWallExtents(), and Skyscraper::ScriptProcessor::CommandsSection::Run().

Here is the call graph for this function:

◆ GetWallExtents()

Vector3 SBS::MeshObject::GetWallExtents ( const std::string & name,
Real altitude,
bool get_max )

Definition at line 423 of file mesh.cpp.

References GetWallByName(), SBS::Wall::GetWallExtents(), and name.

Referenced by Skyscraper::ScriptProcessor::CommandsSection::Run().

Here is the call graph for this function:

◆ HitBeam()

Real SBS::MeshObject::HitBeam ( const Vector3 & origin,
const Vector3 & direction,
Real max_distance )

◆ InBoundingBox()

bool SBS::MeshObject::InBoundingBox ( const Vector3 & pos,
bool check_y )

Definition at line 1016 of file mesh.cpp.

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

Referenced by SBS::ElevatorCar::IsInCar().

Here is the call graph for this function:

◆ IsEnabled()

bool SBS::MeshObject::IsEnabled ( )
virtual

Reimplemented from SBS::Object.

Definition at line 234 of file mesh.cpp.

References enabled.

Referenced by SBS::CustomObject::IsEnabled(), SBS::Model::IsEnabled(), SBS::Primitive::IsEnabled(), and IsVisible().

◆ IsPhysical()

bool SBS::MeshObject::IsPhysical ( )

◆ IsPrepared()

bool SBS::MeshObject::IsPrepared ( )

Definition at line 679 of file mesh.cpp.

References prepared.

◆ IsVisible()

bool SBS::MeshObject::IsVisible ( Ogre::Camera * camera)

Definition at line 464 of file mesh.cpp.

References Bounds, SBS::Object::GetPosition(), IsEnabled(), SBS::DynamicMesh::IsVisible(), MeshWrapper, SBS::ObjectBase::sbs, and SBS::SBS::ToRemote().

Referenced by SBS::Camera::IsMeshVisible().

Here is the call graph for this function:

◆ LoadColliderModel()

bool SBS::MeshObject::LoadColliderModel ( Ogre::MeshPtr & collidermesh)
private

Definition at line 612 of file mesh.cpp.

References collidermesh, Filename, SBS::SBS::GetMountPath(), is_physical, SBS::ObjectBase::ReportError(), SBS::ObjectBase::sbs, and SBS::SBS::VerifyFile().

Referenced by EnablePhysics().

Here is the call graph for this function:

◆ LoadFromFile()

◆ LoadFromMesh()

bool SBS::MeshObject::LoadFromMesh ( const std::string & meshname)

Definition at line 641 of file mesh.cpp.

References SBS::DynamicMesh::LoadFromMesh(), and MeshWrapper.

Referenced by MeshObject().

Here is the call graph for this function:

◆ OnMove()

void SBS::MeshObject::OnMove ( bool parent)
virtual

Reimplemented from SBS::Object.

Definition at line 435 of file mesh.cpp.

References collider_node, mBody, MeshWrapper, SBS::SceneNode::Update(), SBS::DynamicMesh::UpdateVertices(), and UsingDynamicBuffers().

Referenced by OnRotate().

Here is the call graph for this function:

◆ OnRotate()

void SBS::MeshObject::OnRotate ( bool parent)
virtual

Reimplemented from SBS::Object.

Definition at line 447 of file mesh.cpp.

References collider_node, mBody, MeshWrapper, OnMove(), SBS::SceneNode::Update(), SBS::DynamicMesh::UpdateVertices(), and UsingDynamicBuffers().

Here is the call graph for this function:

◆ Prepare()

void SBS::MeshObject::Prepare ( bool force = false)

◆ ReplaceTexture()

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

Definition at line 689 of file mesh.cpp.

References Walls.

Referenced by SBS::ElevatorCar::ReplaceTexture(), SBS::Floor::ReplaceTexture(), and SBS::Action::Run().

◆ ResetPrepare()

void SBS::MeshObject::ResetPrepare ( )

Definition at line 684 of file mesh.cpp.

References prepared.

Referenced by SBS::Polygon::Polygon(), and SBS::Polygon::~Polygon().

◆ SetMaterial()

void SBS::MeshObject::SetMaterial ( const std::string & material)

Definition at line 1197 of file mesh.cpp.

References MeshWrapper, and SBS::DynamicMesh::SetMaterial().

Referenced by SBS::CustomObject::SetTexture(), and SBS::Primitive::SetTexture().

Here is the call graph for this function:

◆ UsingDynamicBuffers()

bool SBS::MeshObject::UsingDynamicBuffers ( )

Definition at line 647 of file mesh.cpp.

References MeshWrapper, and SBS::DynamicMesh::UseDynamicBuffers().

Referenced by SBS::Polygon::ChangeHeight(), SBS::Wall::ChangeHeight(), SBS::Polygon::Move(), SBS::Wall::Move(), OnMove(), and OnRotate().

Here is the call graph for this function:

Member Data Documentation

◆ Bounds

Ogre::AxisAlignedBox* SBS::MeshObject::Bounds

◆ collider_node

SceneNode* SBS::MeshObject::collider_node

◆ collidermesh

Ogre::MeshPtr SBS::MeshObject::collidermesh
private

Definition at line 122 of file mesh.h.

Referenced by EnablePhysics(), LoadColliderModel(), and MeshObject().

◆ create_collider

bool SBS::MeshObject::create_collider

◆ enabled

bool SBS::MeshObject::enabled
private

Definition at line 112 of file mesh.h.

Referenced by Enabled(), IsEnabled(), and MeshObject().

◆ Filename

std::string SBS::MeshObject::Filename

Definition at line 107 of file mesh.h.

Referenced by SBS::PolyMesh::CreateMesh(), EnablePhysics(), LoadColliderModel(), and MeshObject().

◆ friction

Real SBS::MeshObject::friction
private

Definition at line 114 of file mesh.h.

Referenced by CreateBoxCollider(), EnablePhysics(), and MeshObject().

◆ is_physical

bool SBS::MeshObject::is_physical
private

Definition at line 113 of file mesh.h.

Referenced by EnablePhysics(), IsPhysical(), LoadColliderModel(), and MeshObject().

◆ mass

Real SBS::MeshObject::mass
private

Definition at line 114 of file mesh.h.

Referenced by CreateBoxCollider(), EnablePhysics(), and MeshObject().

◆ mBody

OgreBulletDynamics::RigidBody* SBS::MeshObject::mBody

◆ Meshname

std::string SBS::MeshObject::Meshname

Definition at line 108 of file mesh.h.

Referenced by EnablePhysics(), and MeshObject().

◆ MeshWrapper

◆ model_loaded

bool SBS::MeshObject::model_loaded

Definition at line 109 of file mesh.h.

Referenced by LoadFromFile(), MeshObject(), SBS::Model::Model(), and Prepare().

◆ mShape

OgreBulletCollisions::CollisionShape* SBS::MeshObject::mShape

◆ name

std::string SBS::MeshObject::name

◆ polymesh

PolyMesh* SBS::MeshObject::polymesh
private

Definition at line 121 of file mesh.h.

Referenced by GetPolyMesh(), MeshObject(), and ~MeshObject().

◆ prepared

bool SBS::MeshObject::prepared
private

Definition at line 115 of file mesh.h.

Referenced by IsPrepared(), MeshObject(), Prepare(), and ResetPrepare().

◆ remove_on_disable

bool SBS::MeshObject::remove_on_disable

◆ restitution

Real SBS::MeshObject::restitution
private

Definition at line 114 of file mesh.h.

Referenced by CreateBoxCollider(), EnablePhysics(), and MeshObject().

◆ size

◆ tricollider

bool SBS::MeshObject::tricollider

Definition at line 48 of file mesh.h.

Referenced by EnablePhysics(), and MeshObject().

◆ Walls

◆ wrapper_selfcreate

bool SBS::MeshObject::wrapper_selfcreate
private

Definition at line 116 of file mesh.h.

Referenced by MeshObject(), and ~MeshObject().


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