RigsofRods
Soft-body Physics Simulation
Data Structures | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes
RoR::ProceduralRoad Class Reference

#include <ProceduralRoad.h>

+ Inheritance diagram for RoR::ProceduralRoad:
+ Collaboration diagram for RoR::ProceduralRoad:

Data Structures

struct  CoVertice_t
 

Public Member Functions

 ProceduralRoad ()
 
virtual ~ProceduralRoad () override
 
void addBlock (Ogre::Vector3 pos, Ogre::Quaternion rot, RoadType type, float width, float bwidth, float bheight, int pillartype=1)
 
void addQuad (Ogre::Vector3 p1, Ogre::Vector3 p2, Ogre::Vector3 p3, Ogre::Vector3 p4, TextureFit texfit, Ogre::Vector3 pos, Ogre::Vector3 lastpos, float width, bool flip=false)
 
void addCollisionQuad (Ogre::Vector3 p1, Ogre::Vector3 p2, Ogre::Vector3 p3, Ogre::Vector3 p4, ground_model_t *gm, bool flip=false)
 
void addCollisionQuad (Ogre::Vector3 p1, Ogre::Vector3 p2, Ogre::Vector3 p3, Ogre::Vector3 p4, std::string const &gm_name, bool flip=false)
 
void createMesh ()
 
void finish (Ogre::SceneNode *snode)
 
void setCollisionEnabled (bool v)
 
- Public Member Functions inherited from RefCountingObject< ProceduralRoad >
 RefCountingObject ()
 
virtual ~RefCountingObject ()
 
void AddRef ()
 
void Release ()
 

Static Public Attributes

static const unsigned int MAX_VERTEX = 50000
 
static const unsigned int MAX_TRIS = 50000
 

Private Member Functions

Ogre::Vector3 baseOf (Ogre::Vector3 p)
 
void computePoints (Ogre::Vector3 *pts, Ogre::Vector3 pos, Ogre::Quaternion rot, RoadType type, float width, float bwidth, float bheight)
 
void textureFit (Ogre::Vector3 p1, Ogre::Vector3 p2, Ogre::Vector3 p3, Ogre::Vector3 p4, TextureFit texfit, Ogre::Vector2 *texc, Ogre::Vector3 pos, Ogre::Vector3 lastpos, float width)
 

Private Attributes

Ogre::MeshPtr msh
 
Ogre::SubMesh * mainsub = nullptr
 
Ogre::Vector2 tex [MAX_VERTEX] = {}
 
Ogre::Vector3 vertex [MAX_VERTEX] = {}
 
int tricount = 0
 
int vertexcount = 0
 
uint16_t tris [MAX_TRIS *3] = {}
 
Ogre::Quaternion lastrot
 
Ogre::SceneNode * snode = nullptr
 
Ogre::Vector3 lastpos
 
bool first = true
 
float lastbheight = 0.f
 
float lastbwidth = 0.f
 
float lastwidth = 0.f
 
RoadType lasttype
 
int mid = 0
 
bool collision = true
 Register collision triangles? More...
 
std::vector< int > registeredCollTris
 

Additional Inherited Members

- Static Public Member Functions inherited from RefCountingObject< ProceduralRoad >
static void RegisterRefCountingObject (AS_NAMESPACE_QUALIFIER asIScriptEngine *engine, const char *name)
 
- Data Fields inherited from RefCountingObject< ProceduralRoad >
int m_refcount
 
std::mutex m_refcount_mtx
 

Detailed Description

Definition at line 60 of file ProceduralRoad.h.

Constructor & Destructor Documentation

◆ ProceduralRoad()

ProceduralRoad::ProceduralRoad ( )

Definition at line 38 of file ProceduralRoad.cpp.

◆ ~ProceduralRoad()

ProceduralRoad::~ProceduralRoad ( )
overridevirtual

Definition at line 43 of file ProceduralRoad.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ addBlock()

void ProceduralRoad::addBlock ( Ogre::Vector3  pos,
Ogre::Quaternion  rot,
RoadType  type,
float  width,
float  bwidth,
float  bheight,
int  pillartype = 1 
)

Definition at line 81 of file ProceduralRoad.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addCollisionQuad() [1/2]

void RoR::ProceduralRoad::addCollisionQuad ( Ogre::Vector3  p1,
Ogre::Vector3  p2,
Ogre::Vector3  p3,
Ogre::Vector3  p4,
ground_model_t gm,
bool  flip = false 
)

◆ addCollisionQuad() [2/2]

void ProceduralRoad::addCollisionQuad ( Ogre::Vector3  p1,
Ogre::Vector3  p2,
Ogre::Vector3  p3,
Ogre::Vector3  p4,
std::string const &  gm_name,
bool  flip = false 
)

Definition at line 563 of file ProceduralRoad.cpp.

+ Here is the call graph for this function:

◆ addQuad()

void ProceduralRoad::addQuad ( Ogre::Vector3  p1,
Ogre::Vector3  p2,
Ogre::Vector3  p3,
Ogre::Vector3  p4,
TextureFit  texfit,
Ogre::Vector3  pos,
Ogre::Vector3  lastpos,
float  width,
bool  flip = false 
)
Parameters
p1Top left point.
p2Top right point.

Definition at line 358 of file ProceduralRoad.cpp.

+ Here is the call graph for this function:

◆ baseOf()

Vector3 ProceduralRoad::baseOf ( Ogre::Vector3  p)
inlineprivate

Definition at line 346 of file ProceduralRoad.cpp.

+ Here is the call graph for this function:

◆ computePoints()

void ProceduralRoad::computePoints ( Ogre::Vector3 *  pts,
Ogre::Vector3  pos,
Ogre::Quaternion  rot,
RoadType  type,
float  width,
float  bwidth,
float  bheight 
)
private

Definition at line 276 of file ProceduralRoad.cpp.

◆ createMesh()

void ProceduralRoad::createMesh ( )

Create the mesh via the MeshManager

Define the vertices

Define triangles

Create vertex data structure for vertices shared between sub meshes

Create declaration (memory format) of vertex data

Allocate vertex buffer of the requested number of vertices (vertexCount) and bytes per vertex (offset)

Upload the vertex data to the card

Set vertex buffer binding so buffer 0 is bound to our vertex buffer

Allocate index buffer of the requested number of vertices (ibufCount)

Upload the index data to the card

Set parameters of the submesh

Notify Mesh object that it has been loaded

Definition at line 577 of file ProceduralRoad.cpp.

◆ finish()

void ProceduralRoad::finish ( Ogre::SceneNode *  snode)

Definition at line 61 of file ProceduralRoad.cpp.

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setCollisionEnabled()

void RoR::ProceduralRoad::setCollisionEnabled ( bool  v)
inline

Definition at line 77 of file ProceduralRoad.h.

+ Here is the caller graph for this function:

◆ textureFit()

void ProceduralRoad::textureFit ( Ogre::Vector3  p1,
Ogre::Vector3  p2,
Ogre::Vector3  p3,
Ogre::Vector3  p4,
TextureFit  texfit,
Ogre::Vector2 *  texc,
Ogre::Vector3  pos,
Ogre::Vector3  lastpos,
float  width 
)
private

Definition at line 403 of file ProceduralRoad.cpp.

Field Documentation

◆ collision

bool RoR::ProceduralRoad::collision = true
private

Register collision triangles?

Definition at line 113 of file ProceduralRoad.h.

◆ first

bool RoR::ProceduralRoad::first = true
private

Definition at line 107 of file ProceduralRoad.h.

◆ lastbheight

float RoR::ProceduralRoad::lastbheight = 0.f
private

Definition at line 108 of file ProceduralRoad.h.

◆ lastbwidth

float RoR::ProceduralRoad::lastbwidth = 0.f
private

Definition at line 109 of file ProceduralRoad.h.

◆ lastpos

Ogre::Vector3 RoR::ProceduralRoad::lastpos
private

Definition at line 106 of file ProceduralRoad.h.

◆ lastrot

Ogre::Quaternion RoR::ProceduralRoad::lastrot
private

Definition at line 104 of file ProceduralRoad.h.

◆ lasttype

RoadType RoR::ProceduralRoad::lasttype
private

Definition at line 111 of file ProceduralRoad.h.

◆ lastwidth

float RoR::ProceduralRoad::lastwidth = 0.f
private

Definition at line 110 of file ProceduralRoad.h.

◆ mainsub

Ogre::SubMesh* RoR::ProceduralRoad::mainsub = nullptr
private

Definition at line 96 of file ProceduralRoad.h.

◆ MAX_TRIS

const unsigned int RoR::ProceduralRoad::MAX_TRIS = 50000
static

Definition at line 80 of file ProceduralRoad.h.

◆ MAX_VERTEX

const unsigned int RoR::ProceduralRoad::MAX_VERTEX = 50000
static

Definition at line 79 of file ProceduralRoad.h.

◆ mid

int RoR::ProceduralRoad::mid = 0
private

Definition at line 112 of file ProceduralRoad.h.

◆ msh

Ogre::MeshPtr RoR::ProceduralRoad::msh
private

Definition at line 95 of file ProceduralRoad.h.

◆ registeredCollTris

std::vector<int> RoR::ProceduralRoad::registeredCollTris
private

Definition at line 114 of file ProceduralRoad.h.

◆ snode

Ogre::SceneNode* RoR::ProceduralRoad::snode = nullptr
private

Definition at line 105 of file ProceduralRoad.h.

◆ tex

Ogre::Vector2 RoR::ProceduralRoad::tex[MAX_VERTEX] = {}
private

Definition at line 98 of file ProceduralRoad.h.

◆ tricount

int RoR::ProceduralRoad::tricount = 0
private

Definition at line 100 of file ProceduralRoad.h.

◆ tris

uint16_t RoR::ProceduralRoad::tris[MAX_TRIS *3] = {}
private

Definition at line 102 of file ProceduralRoad.h.

◆ vertex

Ogre::Vector3 RoR::ProceduralRoad::vertex[MAX_VERTEX] = {}
private

Definition at line 99 of file ProceduralRoad.h.

◆ vertexcount

int RoR::ProceduralRoad::vertexcount = 0
private

Definition at line 101 of file ProceduralRoad.h.


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