RigsofRods
Soft-body Physics Simulation
Public Member Functions | 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 Member Functions

 ~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 ()
 
void setVisible (bool visible)
 
void setFlexbodyCastShadow (bool val)
 
int getVertexCount ()
 
Locator_tgetVertexLocator (int vert)
 
Ogre::Vector3 getVertexPos (int vert)
 
Ogre::Entity * getEntity ()
 
std::string getOrigMeshName ()
 
std::vector< NodeNum_t > & getForsetNodes ()
 
std::string getOrigMeshInfo ()
 
std::string getLiveMeshInfo ()
 
NodeNum_t getRefNode ()
 
NodeNum_t getXNode ()
 
NodeNum_t getYNode ()
 

Private Member Functions

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

Private Attributes

RoR::GfxActorm_gfx_actor
 
size_t m_vertex_count
 
Ogre::Vector3 m_flexit_center
 Updated per frame. More...
 
Ogre::Vector3 * m_dst_pos
 
Ogre::Vector3 * m_src_normals
 
Ogre::Vector3 * m_dst_normals
 
Ogre::ARGB * m_src_colors
 
Locator_tm_locators
 1 loc per vertex More...
 
NodeNum_t m_node_center
 
NodeNum_t m_node_x
 
NodeNum_t m_node_y
 
Ogre::Vector3 m_center_offset
 
Ogre::SceneNode * m_scene_node
 
Ogre::Entity * m_scene_entity
 
int m_camera_mode
 Visibility control {-2 = always, -1 = 3rdPerson only, 0+ = cinecam index}. More...
 
int m_shared_buf_num_verts
 
Ogre::HardwareVertexBufferSharedPtr m_shared_vbuf_pos
 
Ogre::HardwareVertexBufferSharedPtr m_shared_vbuf_norm
 
Ogre::HardwareVertexBufferSharedPtr m_shared_vbuf_color
 
int m_num_submesh_vbufs
 
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
 
bool m_has_texture
 
bool m_has_texture_blend
 
bool m_blend_changed
 
std::vector< NodeNum_tm_forset_nodes
 
std::string m_orig_mesh_info
 

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.

Constructor & Destructor Documentation

◆ FlexBody()

FlexBody::FlexBody ( RigDef::Flexbody def,
RoR::FlexBodyCacheData preloaded_from_cache,
RoR::GfxActor gfx_actor,
Ogre::Entity *  entity,
NodeNum_t  ref,
NodeNum_t  nx,
NodeNum_t  ny,
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()

FlexBody::~FlexBody ( )

Definition at line 532 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 567 of file FlexBody.cpp.

+ Here is the call graph for this function:

◆ defragmentFlexbodyMesh()

void FlexBody::defragmentFlexbodyMesh ( )
private

Definition at line 750 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 70 of file FlexBody.h.

◆ getEntity()

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

Definition at line 82 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getForsetNodes()

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

Definition at line 84 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getLiveMeshInfo()

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

Definition at line 86 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 85 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getOrigMeshName()

std::string FlexBody::getOrigMeshName ( )

Definition at line 681 of file FlexBody.cpp.

+ Here is the caller graph for this function:

◆ getRefNode()

NodeNum_t RoR::FlexBody::getRefNode ( )
inline

Definition at line 88 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getVertexCount()

int RoR::FlexBody::getVertexCount ( )
inline

Definition at line 79 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getVertexLocator()

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

Definition at line 80 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getVertexPos()

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

Definition at line 81 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getXNode()

NodeNum_t RoR::FlexBody::getXNode ( )
inline

Definition at line 89 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ getYNode()

NodeNum_t RoR::FlexBody::getYNode ( )
inline

Definition at line 90 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ reset()

void FlexBody::reset ( )

Definition at line 636 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 69 of file FlexBody.h.

+ Here is the caller graph for this function:

◆ setFlexbodyCastShadow()

void FlexBody::setFlexbodyCastShadow ( bool  val)

Definition at line 562 of file FlexBody.cpp.

◆ setVisible()

void FlexBody::setVisible ( bool  visible)

Definition at line 556 of file FlexBody.cpp.

◆ updateBlend()

void FlexBody::updateBlend ( )

Definition at line 661 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 608 of file FlexBody.cpp.

+ Here is the call graph for this function:

◆ writeBlend()

void FlexBody::writeBlend ( )

Definition at line 645 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
private

Definition at line 128 of file FlexBody.h.

◆ m_camera_mode

int RoR::FlexBody::m_camera_mode
private

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

Definition at line 112 of file FlexBody.h.

◆ m_center_offset

Ogre::Vector3 RoR::FlexBody::m_center_offset
private

Definition at line 109 of file FlexBody.h.

◆ m_dst_normals

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

Definition at line 102 of file FlexBody.h.

◆ m_dst_pos

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

Definition at line 100 of file FlexBody.h.

◆ m_flexit_center

Ogre::Vector3 RoR::FlexBody::m_flexit_center
private

Updated per frame.

Definition at line 98 of file FlexBody.h.

◆ m_forset_nodes

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

Definition at line 131 of file FlexBody.h.

◆ m_gfx_actor

RoR::GfxActor* RoR::FlexBody::m_gfx_actor
private

Definition at line 96 of file FlexBody.h.

◆ m_has_texture

bool RoR::FlexBody::m_has_texture
private

Definition at line 126 of file FlexBody.h.

◆ m_has_texture_blend

bool RoR::FlexBody::m_has_texture_blend
private

Definition at line 127 of file FlexBody.h.

◆ m_locators

Locator_t* RoR::FlexBody::m_locators
private

1 loc per vertex

Definition at line 104 of file FlexBody.h.

◆ m_node_center

NodeNum_t RoR::FlexBody::m_node_center
private

Definition at line 106 of file FlexBody.h.

◆ m_node_x

NodeNum_t RoR::FlexBody::m_node_x
private

Definition at line 107 of file FlexBody.h.

◆ m_node_y

NodeNum_t RoR::FlexBody::m_node_y
private

Definition at line 108 of file FlexBody.h.

◆ m_num_submesh_vbufs

int RoR::FlexBody::m_num_submesh_vbufs
private

Definition at line 119 of file FlexBody.h.

◆ m_orig_mesh_info

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

Definition at line 132 of file FlexBody.h.

◆ m_scene_entity

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

Definition at line 111 of file FlexBody.h.

◆ m_scene_node

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

Definition at line 110 of file FlexBody.h.

◆ m_shared_buf_num_verts

int RoR::FlexBody::m_shared_buf_num_verts
private

Definition at line 114 of file FlexBody.h.

◆ m_shared_vbuf_color

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

Definition at line 117 of file FlexBody.h.

◆ m_shared_vbuf_norm

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

Definition at line 116 of file FlexBody.h.

◆ m_shared_vbuf_pos

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

Definition at line 115 of file FlexBody.h.

◆ m_src_colors

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

Definition at line 103 of file FlexBody.h.

◆ m_src_normals

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

Definition at line 101 of file FlexBody.h.

◆ m_submesh_vbufs_color

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

colors

Definition at line 123 of file FlexBody.h.

◆ m_submesh_vbufs_norm

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

normals

Definition at line 122 of file FlexBody.h.

◆ m_submesh_vbufs_pos

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

positions

Definition at line 121 of file FlexBody.h.

◆ m_submesh_vbufs_vertex_counts

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

Definition at line 120 of file FlexBody.h.

◆ m_uses_shared_vertex_data

bool RoR::FlexBody::m_uses_shared_vertex_data
private

Definition at line 125 of file FlexBody.h.

◆ m_vertex_count

size_t RoR::FlexBody::m_vertex_count
private

Definition at line 97 of file FlexBody.h.


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