RigsofRods
Soft-body Physics Simulation
Public Types | Public Member Functions | Static Public Attributes | Private Member Functions | Private Attributes | Friends
RoR::FlexBody Class Reference

Flexbody = A deformable mesh; updated on CPU every frame, then uploaded to video memory. More...

#include <FlexBody.h>

+ Collaboration diagram for RoR::FlexBody:

Public Types

typedef int FlexBodyPlaceholder_t
 

Public Member Functions

 FlexBody (FlexBodyPlaceholder_t, FlexbodyID_t id, const std::string &orig_meshname)
 
 ~FlexBody ()
 
void reset ()
 
void updateBlend ()
 
void writeBlend ()
 
void setCameraMode (int mode)
 Visibility control. More...
 
int getCameraMode ()
 
void computeFlexbody ()
 Updates mesh deformation; works on CPU using local copy of vertex data. More...
 
void updateFlexbodyVertexBuffers ()
 
bool isVisible () const
 
void setVisible (bool visible)
 
void setFlexbodyCastShadow (bool val)
 
int getVertexCount ()
 
Locator_tgetVertexLocator (int vert)
 
Ogre::Vector3 getVertexPos (int vert)
 
Ogre::Entity * getEntity ()
 
const std::string & getOrigMeshName () const
 
std::vector< NodeNum_t > & getForsetNodes ()
 
std::string getOrigMeshInfo ()
 
std::string getLiveMeshInfo ()
 
NodeNum_t getRefNode ()
 
NodeNum_t getXNode ()
 
NodeNum_t getYNode ()
 
FlexbodyID_t getID () const
 

Static Public Attributes

static const FlexBodyPlaceholder_t TUNING_PLACEHOLDER = -11
 

Private Member Functions

 FlexBody (RoR::FlexBodyCacheData *preloaded_from_cache, RoR::GfxActor *gfx_actor, Ogre::Entity *entity, NodeNum_t ref, NodeNum_t nx, NodeNum_t ny, Ogre::Vector3 offset, Ogre::Quaternion const &rot, std::vector< unsigned int > &node_indices)
 
void defragmentFlexbodyMesh ()
 

Private Attributes

RoR::GfxActorm_gfx_actor = nullptr
 
size_t m_vertex_count = 0
 
Ogre::Vector3 m_flexit_center = Ogre::Vector3::ZERO
 Updated per frame. More...
 
FlexbodyID_t m_id = FLEXBODYID_INVALID
 
Ogre::Vector3 * m_dst_pos = nullptr
 
Ogre::Vector3 * m_src_normals = nullptr
 
Ogre::Vector3 * m_dst_normals = nullptr
 
Ogre::ARGB * m_src_colors = nullptr
 
Locator_tm_locators = nullptr
 1 loc per vertex More...
 
NodeNum_t m_node_center = NODENUM_INVALID
 
NodeNum_t m_node_x = NODENUM_INVALID
 
NodeNum_t m_node_y = NODENUM_INVALID
 
Ogre::Vector3 m_center_offset = Ogre::Vector3::ZERO
 
Ogre::SceneNode * m_scene_node = nullptr
 
Ogre::Entity * m_scene_entity = nullptr
 
int m_camera_mode = CAMERA_MODE_ALWAYS_VISIBLE
 Visibility control {-2 = always, -1 = 3rdPerson only, 0+ = cinecam index}. More...
 
int m_shared_buf_num_verts = 0
 
Ogre::HardwareVertexBufferSharedPtr m_shared_vbuf_pos
 
Ogre::HardwareVertexBufferSharedPtr m_shared_vbuf_norm
 
Ogre::HardwareVertexBufferSharedPtr m_shared_vbuf_color
 
int m_num_submesh_vbufs = 0
 
int m_submesh_vbufs_vertex_counts [16]
 
Ogre::HardwareVertexBufferSharedPtr m_submesh_vbufs_pos [16]
 positions More...
 
Ogre::HardwareVertexBufferSharedPtr m_submesh_vbufs_norm [16]
 normals More...
 
Ogre::HardwareVertexBufferSharedPtr m_submesh_vbufs_color [16]
 colors More...
 
bool m_uses_shared_vertex_data = false
 
bool m_has_texture = true
 
bool m_has_texture_blend = true
 
bool m_blend_changed = false
 
std::vector< NodeNum_tm_forset_nodes
 
std::string m_orig_mesh_info
 
std::string m_orig_mesh_name
 

Friends

class RoR::FlexFactory
 
class RoR::FlexBodyFileIO
 

Detailed Description

Flexbody = A deformable mesh; updated on CPU every frame, then uploaded to video memory.

Definition at line 42 of file FlexBody.h.

Member Typedef Documentation

◆ FlexBodyPlaceholder_t

Definition at line 61 of file FlexBody.h.

Constructor & Destructor Documentation

◆ FlexBody() [1/2]

FlexBody::FlexBody ( RoR::FlexBodyCacheData preloaded_from_cache,
RoR::GfxActor gfx_actor,
Ogre::Entity *  entity,
NodeNum_t  ref,
NodeNum_t  nx,
NodeNum_t  ny,
Ogre::Vector3  offset,
Ogre::Quaternion const &  rot,
std::vector< unsigned int > &  node_indices 
)
private

Definition at line 38 of file FlexBody.cpp.

+ Here is the call graph for this function:

◆ FlexBody() [2/2]

FlexBody::FlexBody ( FlexBodyPlaceholder_t  ticket,
FlexbodyID_t  id,
const std::string &  orig_meshname 
)

Definition at line 522 of file FlexBody.cpp.

◆ ~FlexBody()

FlexBody::~FlexBody ( )

Definition at line 529 of file FlexBody.cpp.

+ Here is the call graph for this function:

Member Function Documentation

◆ computeFlexbody()

void FlexBody::computeFlexbody ( )

Updates mesh deformation; works on CPU using local copy of vertex data.

Definition at line 581 of file FlexBody.cpp.

+ Here is the call graph for this function:

◆ defragmentFlexbodyMesh()

void FlexBody::defragmentFlexbodyMesh ( )
private

Definition at line 754 of file FlexBody.cpp.

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

◆ getCameraMode()

int RoR::FlexBody::getCameraMode ( )
inline

Definition at line 74 of file FlexBody.h.

◆ getEntity()

Ogre::Entity* RoR::FlexBody::getEntity ( )
inline

Definition at line 87 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getForsetNodes()

std::vector<NodeNum_t>& RoR::FlexBody::getForsetNodes ( )
inline

Definition at line 89 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getID()

FlexbodyID_t RoR::FlexBody::getID ( ) const
inline

Definition at line 97 of file FlexBody.h.

◆ getLiveMeshInfo()

std::string RoR::FlexBody::getLiveMeshInfo ( )
inline

Definition at line 91 of file FlexBody.h.

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

◆ getOrigMeshInfo()

std::string RoR::FlexBody::getOrigMeshInfo ( )
inline

Definition at line 90 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getOrigMeshName()

const std::string& RoR::FlexBody::getOrigMeshName ( ) const
inline

Definition at line 88 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getRefNode()

NodeNum_t RoR::FlexBody::getRefNode ( )
inline

Definition at line 93 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getVertexCount()

int RoR::FlexBody::getVertexCount ( )
inline

Definition at line 84 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getVertexLocator()

Locator_t& RoR::FlexBody::getVertexLocator ( int  vert)
inline

Definition at line 85 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getVertexPos()

Ogre::Vector3 RoR::FlexBody::getVertexPos ( int  vert)
inline

Definition at line 86 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getXNode()

NodeNum_t RoR::FlexBody::getXNode ( )
inline

Definition at line 94 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getYNode()

NodeNum_t RoR::FlexBody::getYNode ( )
inline

Definition at line 95 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ isVisible()

bool FlexBody::isVisible ( ) const

Definition at line 559 of file FlexBody.cpp.

◆ reset()

void FlexBody::reset ( )

Definition at line 653 of file FlexBody.cpp.

+ Here is the call graph for this function:

◆ setCameraMode()

void RoR::FlexBody::setCameraMode ( int  mode)
inline

Visibility control.

Parameters
mode{-2 = always, -1 = 3rdPerson only, 0+ = cinecam index}

Definition at line 73 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ setFlexbodyCastShadow()

void FlexBody::setFlexbodyCastShadow ( bool  val)

Definition at line 574 of file FlexBody.cpp.

◆ setVisible()

void FlexBody::setVisible ( bool  visible)

Definition at line 568 of file FlexBody.cpp.

◆ updateBlend()

void FlexBody::updateBlend ( )

Definition at line 678 of file FlexBody.cpp.

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

◆ updateFlexbodyVertexBuffers()

void FlexBody::updateFlexbodyVertexBuffers ( )

Definition at line 622 of file FlexBody.cpp.

+ Here is the call graph for this function:

◆ writeBlend()

void FlexBody::writeBlend ( )

Definition at line 662 of file FlexBody.cpp.

+ Here is the caller graph for this function:

Friends And Related Function Documentation

◆ RoR::FlexBodyFileIO

friend class RoR::FlexBodyFileIO
friend

Definition at line 45 of file FlexBody.h.

◆ RoR::FlexFactory

friend class RoR::FlexFactory
friend

Definition at line 44 of file FlexBody.h.

Field Documentation

◆ m_blend_changed

bool RoR::FlexBody::m_blend_changed = false
private

Definition at line 136 of file FlexBody.h.

◆ m_camera_mode

int RoR::FlexBody::m_camera_mode = CAMERA_MODE_ALWAYS_VISIBLE
private

Visibility control {-2 = always, -1 = 3rdPerson only, 0+ = cinecam index}.

Definition at line 120 of file FlexBody.h.

◆ m_center_offset

Ogre::Vector3 RoR::FlexBody::m_center_offset = Ogre::Vector3::ZERO
private

Definition at line 117 of file FlexBody.h.

◆ m_dst_normals

Ogre::Vector3* RoR::FlexBody::m_dst_normals = nullptr
private

Definition at line 110 of file FlexBody.h.

◆ m_dst_pos

Ogre::Vector3* RoR::FlexBody::m_dst_pos = nullptr
private

Definition at line 108 of file FlexBody.h.

◆ m_flexit_center

Ogre::Vector3 RoR::FlexBody::m_flexit_center = Ogre::Vector3::ZERO
private

Updated per frame.

Definition at line 105 of file FlexBody.h.

◆ m_forset_nodes

std::vector<NodeNum_t> RoR::FlexBody::m_forset_nodes
private

Definition at line 139 of file FlexBody.h.

◆ m_gfx_actor

RoR::GfxActor* RoR::FlexBody::m_gfx_actor = nullptr
private

Definition at line 103 of file FlexBody.h.

◆ m_has_texture

bool RoR::FlexBody::m_has_texture = true
private

Definition at line 134 of file FlexBody.h.

◆ m_has_texture_blend

bool RoR::FlexBody::m_has_texture_blend = true
private

Definition at line 135 of file FlexBody.h.

◆ m_id

FlexbodyID_t RoR::FlexBody::m_id = FLEXBODYID_INVALID
private

Definition at line 106 of file FlexBody.h.

◆ m_locators

Locator_t* RoR::FlexBody::m_locators = nullptr
private

1 loc per vertex

Definition at line 112 of file FlexBody.h.

◆ m_node_center

NodeNum_t RoR::FlexBody::m_node_center = NODENUM_INVALID
private

Definition at line 114 of file FlexBody.h.

◆ m_node_x

NodeNum_t RoR::FlexBody::m_node_x = NODENUM_INVALID
private

Definition at line 115 of file FlexBody.h.

◆ m_node_y

NodeNum_t RoR::FlexBody::m_node_y = NODENUM_INVALID
private

Definition at line 116 of file FlexBody.h.

◆ m_num_submesh_vbufs

int RoR::FlexBody::m_num_submesh_vbufs = 0
private

Definition at line 127 of file FlexBody.h.

◆ m_orig_mesh_info

std::string RoR::FlexBody::m_orig_mesh_info
private

Definition at line 140 of file FlexBody.h.

◆ m_orig_mesh_name

std::string RoR::FlexBody::m_orig_mesh_name
private

Definition at line 141 of file FlexBody.h.

◆ m_scene_entity

Ogre::Entity* RoR::FlexBody::m_scene_entity = nullptr
private

Definition at line 119 of file FlexBody.h.

◆ m_scene_node

Ogre::SceneNode* RoR::FlexBody::m_scene_node = nullptr
private

Definition at line 118 of file FlexBody.h.

◆ m_shared_buf_num_verts

int RoR::FlexBody::m_shared_buf_num_verts = 0
private

Definition at line 122 of file FlexBody.h.

◆ m_shared_vbuf_color

Ogre::HardwareVertexBufferSharedPtr RoR::FlexBody::m_shared_vbuf_color
private

Definition at line 125 of file FlexBody.h.

◆ m_shared_vbuf_norm

Ogre::HardwareVertexBufferSharedPtr RoR::FlexBody::m_shared_vbuf_norm
private

Definition at line 124 of file FlexBody.h.

◆ m_shared_vbuf_pos

Ogre::HardwareVertexBufferSharedPtr RoR::FlexBody::m_shared_vbuf_pos
private

Definition at line 123 of file FlexBody.h.

◆ m_src_colors

Ogre::ARGB* RoR::FlexBody::m_src_colors = nullptr
private

Definition at line 111 of file FlexBody.h.

◆ m_src_normals

Ogre::Vector3* RoR::FlexBody::m_src_normals = nullptr
private

Definition at line 109 of file FlexBody.h.

◆ m_submesh_vbufs_color

Ogre::HardwareVertexBufferSharedPtr RoR::FlexBody::m_submesh_vbufs_color[16]
private

colors

Definition at line 131 of file FlexBody.h.

◆ m_submesh_vbufs_norm

Ogre::HardwareVertexBufferSharedPtr RoR::FlexBody::m_submesh_vbufs_norm[16]
private

normals

Definition at line 130 of file FlexBody.h.

◆ m_submesh_vbufs_pos

Ogre::HardwareVertexBufferSharedPtr RoR::FlexBody::m_submesh_vbufs_pos[16]
private

positions

Definition at line 129 of file FlexBody.h.

◆ m_submesh_vbufs_vertex_counts

int RoR::FlexBody::m_submesh_vbufs_vertex_counts[16]
private

Definition at line 128 of file FlexBody.h.

◆ m_uses_shared_vertex_data

bool RoR::FlexBody::m_uses_shared_vertex_data = false
private

Definition at line 133 of file FlexBody.h.

◆ m_vertex_count

size_t RoR::FlexBody::m_vertex_count = 0
private

Definition at line 104 of file FlexBody.h.

◆ TUNING_PLACEHOLDER

const FlexBodyPlaceholder_t RoR::FlexBody::TUNING_PLACEHOLDER = -11
static

Definition at line 62 of file FlexBody.h.


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