chrono::irrlicht::ChIrrAssetConverter Class Reference

Description

Class with static functions which allow creation of Irrlicht frequent 'scene nodes' like lights, camera, sky box etc.

with very simple statements.

#include <ChIrrAssetConverter.h>

Collaboration diagram for chrono::irrlicht::ChIrrAssetConverter:

Public Member Functions

 ChIrrAssetConverter (ChIrrAppInterface &ainterface)
 Constructor.
 
 ~ChIrrAssetConverter ()
 Destructor.
 
std::shared_ptr< ChIrrNodeAssetGetIrrNodeAsset (std::shared_ptr< ChPhysicsItem > mitem)
 Returns the proxy to the ChIrrNode, by scanning all assets. More...
 
void Bind (std::shared_ptr< ChPhysicsItem > mitem)
 Shortcut to add and bind a ChIrrNodeAsset to an item, if it has not been added previously. More...
 
void BindAll ()
 Shortcut to add and bind a ChIrrNodeAsset to all items in a ChSystem. More...
 
void Update (std::shared_ptr< ChPhysicsItem > mitem)
 This function sets up the Irrlicht nodes corresponding to the geometric assets that are found in the ChPhysicsItem 'mitem'. More...
 
void UpdateAll ()
 For all items in a ChSystem, this function sets up the Irrlicht nodes corresponding to the geometric assets that have been added to the items. More...
 
void CleanIrrlicht (std::shared_ptr< ChPhysicsItem > mitem)
 Clean all Irrlicht stuff that has been put in the ChIrrNode in a previous Update or PopulateIrrlicht operation. More...
 

Public Attributes

irr::scene::IAnimatedMesh * sphereMesh
 
irr::scene::IMesh * cubeMesh
 
irr::scene::IMesh * cylinderMesh
 
irr::scene::ISceneManager * scenemanager
 
irr::IrrlichtDevice * mdevice
 
ChIrrAppInterfaceminterface
 
ChCameramcamera
 
bool camera_found_in_assets
 

Member Function Documentation

void chrono::irrlicht::ChIrrAssetConverter::Bind ( std::shared_ptr< ChPhysicsItem mitem)

Shortcut to add and bind a ChIrrNodeAsset to an item, if it has not been added previously.

void chrono::irrlicht::ChIrrAssetConverter::BindAll ( )

Shortcut to add and bind a ChIrrNodeAsset to all items in a ChSystem.

If it has been already added, the existing ChIrrNodeAsset is used. NOTE. If you want a finer control on which item has an Irrlicht proxy, and which other does not need it, just use Bind() on a per-item basis.. NOTE. This conversion should be done only if needed (e.g. at the beginning of an animation), i.e. not too often, for performance reasons.

void chrono::irrlicht::ChIrrAssetConverter::CleanIrrlicht ( std::shared_ptr< ChPhysicsItem mitem)

Clean all Irrlicht stuff that has been put in the ChIrrNode in a previous Update or PopulateIrrlicht operation.

std::shared_ptr< ChIrrNodeAsset > chrono::irrlicht::ChIrrAssetConverter::GetIrrNodeAsset ( std::shared_ptr< ChPhysicsItem mitem)

Returns the proxy to the ChIrrNode, by scanning all assets.

Note, check for the returned pointer, just in case a proxy has not been added.

void chrono::irrlicht::ChIrrAssetConverter::Update ( std::shared_ptr< ChPhysicsItem mitem)

This function sets up the Irrlicht nodes corresponding to the geometric assets that are found in the ChPhysicsItem 'mitem'.

For example, if one has added a ChSphereShape and a ChBoxShape to the assets of a ChBody, and a ChIrrNodeAsset too, this Update() function will prepare a ISceneNode in Irrlicht (precisely, a ChIrrNode node) and it will fill it with a spherical triangle mesh, and a box triangle mesh. NOTE. This must be done after the ChIrrNodeAsset has been created and bound, for example via Bind(). NOTE. This conversion should be done only if needed (e.g. at the beginning of an animation or when a shape changes), i.e. not too often, for performance reasons.

void chrono::irrlicht::ChIrrAssetConverter::UpdateAll ( )

For all items in a ChSystem, this function sets up the Irrlicht nodes corresponding to the geometric assets that have been added to the items.

NOTE. This must be done after the ChIrrNodeAsset has been created and bound, for example via Bind(). NOTE. This conversion should be done only if needed (e.g. at the beginning of an animation), i.e. not too often, for performance reasons.