chrono::irrlicht::ChIrrAppInterface Class Reference

Description

Class to add some GUI to Irrlicht + ChronoEngine applications.

This basic GUI can be used to monitor solver timings, to easily change physical system settings, etc.

#include <ChIrrAppInterface.h>

Inheritance diagram for chrono::irrlicht::ChIrrAppInterface:

Public Member Functions

 ChIrrAppInterface (ChSystem *psystem, const wchar_t *title=0, irr::core::dimension2d< irr::u32 > dimens=irr::core::dimension2d< irr::u32 >(640, 480), bool do_fullscreen=false, bool do_shadows=false, bool do_antialias=true, irr::video::E_DRIVER_TYPE mydriver=irr::video::EDT_DIRECT3D9, irr::ELOG_LEVEL log_level=irr::ELL_INFORMATION)
 Create the IRRLICHT context (device, etc.)
 
virtual ~ChIrrAppInterface ()
 Safely delete all Irrlicht items (including the Irrlicht scene nodes)
 
irr::IrrlichtDevice * GetDevice ()
 
irr::video::IVideoDriver * GetVideoDriver ()
 
irr::scene::ISceneManager * GetSceneManager ()
 
irr::gui::IGUIEnvironment * GetIGUIEnvironment ()
 
EffectHandlerGetEffects ()
 
irr::scene::ISceneNode * GetContainer ()
 
ChSystemGetSystem ()
 
void SetShowInfos (bool val)
 Show the info panel in the 3D view.
 
bool GetShowInfos ()
 
void SetShowProfiler (bool val)
 Show the realtime profiler in the 3D view.
 
bool GetShowProfiler ()
 
void SetShowExplorer (bool val)
 Show the object explorer.
 
bool GetShowExplorer ()
 
void SetTimestep (double val)
 Set/Get the time step for time integration. More...
 
double GetTimestep ()
 
void SetStepManage (bool val)
 If set to true, you can use DoStep() in the simulation loop to advance the simulation by one timestep. More...
 
bool GetStepManage ()
 
void SetTryRealtime (bool val)
 If set to true, the function DoStep() will try to use a timestep that is the same as that used to refresh the interface and compute physics (i.e., it attempts to keep soft-realtime performance). More...
 
bool GetTryRealtime ()
 
void SetPaused (bool val)
 Set/Get the simulation state (running or paused)
 
bool GetPaused ()
 
void SetVideoframeSave (bool val)
 If set to true, each frame of the animation will be saved on the disk as snapshot0001.bmp, snapshot0002.bmp, etc.
 
bool GetVideoframeSave ()
 
void SetVideoframeSaveInterval (int val)
 Set to 1 if you need to save on disk all simulation steps, set to 2 for saving each 2 steps, etc.
 
int GetVideoframeSaveInterval ()
 
void SetContactsLabelMode (ChIrrTools::eCh_ContactsLabelMode mm)
 Set the label mode for contacts.
 
void SetContactsDrawMode (ChIrrTools::eCh_ContactsDrawMode mm)
 Set the draw mode for contacts.
 
void SetLinksLabelMode (ChIrrTools::eCh_LinkLabelMode mm)
 Set the label mode for links.
 
void SetLinksDrawMode (ChIrrTools::eCh_LinkDrawMode mm)
 Set the draw mode for links.
 
void SetPlotAABB (bool val)
 Set if the AABB collision shapes will be plotted.
 
void SetPlotCOGFrames (bool val)
 Set if the COG frames will be plotted.
 
void SetPlotCollisionShapes (bool val)
 Set if the Bullet collision shapes will be plotted.
 
void SetPlotLinkFrames (bool val)
 Set if the link frames will be plotted.
 
void SetPlotConvergence (bool val)
 Set if the COG frames will be plotted.
 
void SetSymbolscale (double val)
 Set the scale for symbol drawing (link frames, COGs, etc.)
 
double GetSymbolscale ()
 
void SetUserEventReceiver (irr::IEventReceiver *mreceiver)
 Use this function to hook a custom event receiver to the application.
 
void SetFonts (const std::string &mfontdir=GetChronoDataFile("fonts/arial8.xml"))
 Set the fonts to be used from now on. More...
 
virtual void BeginScene (bool backBuffer=true, bool zBuffer=true, irr::video::SColor color=irr::video::SColor(255, 0, 0, 0))
 Call this to clean the canvas at the beginning of each animation frame.
 
virtual void DoStep ()
 Call this important function inside a cycle like while(application.GetDevice()->run()) {...} in order to advance the physics by one timestep. More...
 
virtual void DrawAll ()
 Call this important function inside a loop like while(application.GetDevice()->run()) {...} in order to get the redrawing of all 3D shapes and all the GUI elements.
 
virtual void EndScene ()
 Call this to end the scene draw at the end of each animation frame.
 
void DumpSystemMatrices ()
 Dump the last used system matrices and vectors in the current directory, as 'dump_xxxx.dat' files that can be loaded with Matlab for debugging, benchmarking etc. More...
 
void AddTypicalLogo (const std::string &mlogofilename=GetChronoDataFile("logo_chronoengine_alpha.png"))
 
void AddTypicalCamera (irr::core::vector3df mpos=irr::core::vector3df(0, 0, -8), irr::core::vector3df mtarg=irr::core::vector3df(0, 0, 0))
 
void AddTypicalLights (irr::core::vector3df pos1=irr::core::vector3df(30.f, 100.f, 30.f), irr::core::vector3df pos2=irr::core::vector3df(30.f, 80.f, -30.f), double rad1=290, double rad2=190, irr::video::SColorf col1=irr::video::SColorf(0.7f, 0.7f, 0.7f, 1.0f), irr::video::SColorf col2=irr::video::SColorf(0.7f, 0.8f, 0.8f, 1.0f))
 
void AddTypicalSky (const std::string &mtexturedir=GetChronoDataFile("skybox/"))
 
irr::scene::ILightSceneNode * AddLight (irr::core::vector3df pos, double radius, irr::video::SColorf color=irr::video::SColorf(0.7f, 0.7f, 0.7f, 1.0f))
 Add a point light to the scene.
 
irr::scene::ILightSceneNode * AddLightWithShadow (irr::core::vector3df pos, irr::core::vector3df aim, double radius, double mnear, double mfar, double angle, irr::u32 resolution=512, irr::video::SColorf color=irr::video::SColorf(1.f, 1.f, 1.f, 1.f), bool directional=false, bool clipborder=true)
 Add a point light that cast shadow (using soft shadows/shadow maps) Note that the quality of the shadow strictly depends on how you set 'mnear' and 'mfar' parameters as close as possible to the bounding box of the scene. More...
 

Friends

class ChIrrAppEventReceiver
 

Member Function Documentation

◆ AddLightWithShadow()

irr::scene::ILightSceneNode* chrono::irrlicht::ChIrrAppInterface::AddLightWithShadow ( irr::core::vector3df  pos,
irr::core::vector3df  aim,
double  radius,
double  mnear,
double  mfar,
double  angle,
irr::u32  resolution = 512,
irr::video::SColorf  color = irr::video::SColorf(1.f, 1.f, 1.f, 1.f),
bool  directional = false,
bool  clipborder = true 
)
inline

Add a point light that cast shadow (using soft shadows/shadow maps) Note that the quality of the shadow strictly depends on how you set 'mnear' and 'mfar' parameters as close as possible to the bounding box of the scene.

NOTE: use myapplication.AddShadow(myitem) to enable shadow for an object! Otherwise, use myapplication.AddShadowAll().

◆ DoStep()

void chrono::irrlicht::ChIrrAppInterface::DoStep ( )
virtual

Call this important function inside a cycle like while(application.GetDevice()->run()) {...} in order to advance the physics by one timestep.

The value of the timestep can be set via SetTimestep(). Optionally, you can use SetTryRealtime(true) if your simulation can run in realtime. Alternatively, if you want to use ChSystem::DoStepDynamics() directly in your loop, use SetStepManage(false).

◆ DumpSystemMatrices()

void chrono::irrlicht::ChIrrAppInterface::DumpSystemMatrices ( )

Dump the last used system matrices and vectors in the current directory, as 'dump_xxxx.dat' files that can be loaded with Matlab for debugging, benchmarking etc.

It saves M mass matrix, Cq jacobians, E compliance as Matlab sparse matrix format, and known vectors fb, bi as column Matlab matrices.

◆ SetFonts()

void chrono::irrlicht::ChIrrAppInterface::SetFonts ( const std::string &  mfontdir = GetChronoDataFile("fonts/arial8.xml"))

Set the fonts to be used from now on.

Note that the font must be in the XML format of Irrlicht - this can be generated using a tool provided with Irrlicht.

◆ SetStepManage()

void chrono::irrlicht::ChIrrAppInterface::SetStepManage ( bool  val)
inline

If set to true, you can use DoStep() in the simulation loop to advance the simulation by one timestep.

Otherwise, you have to handle the time stepping by yourself, e.g. by calling ChSystem::DoStepDynamics().

◆ SetTimestep()

void chrono::irrlicht::ChIrrAppInterface::SetTimestep ( double  val)

Set/Get the time step for time integration.

This value is used when calling DoStep() in a loop, to advance the simulation by one timestep.

◆ SetTryRealtime()

void chrono::irrlicht::ChIrrAppInterface::SetTryRealtime ( bool  val)
inline

If set to true, the function DoStep() will try to use a timestep that is the same as that used to refresh the interface and compute physics (i.e., it attempts to keep soft-realtime performance).

Note: the realtime step is bounded above by the timestep specified through SetTimestep()! This clamping will happen if there's too much load.


The documentation for this class was generated from the following files:
  • /builds/uwsbel/chrono/src/chrono_irrlicht/ChIrrAppInterface.h
  • /builds/uwsbel/chrono/src/chrono_irrlicht/ChIrrAppInterface.cpp