chrono::irrlicht::ChVisualSystemIrrlicht Class Reference

Description

Irrlicht-based Chrono run-time visualization system.

#include <ChVisualSystemIrrlicht.h>

Inheritance diagram for chrono::irrlicht::ChVisualSystemIrrlicht:
Collaboration diagram for chrono::irrlicht::ChVisualSystemIrrlicht:

Public Member Functions

void SetAntialias (bool val)
 Enable/disable antialias (default true). More...
 
void SetFullscreen (bool val)
 Enable/disable full-screen mode (default false). More...
 
void SetShadows (bool val)
 Enable/disable shadows (default false). More...
 
void SetDriverType (irr::video::E_DRIVER_TYPE driver_type)
 Set the device driver type (default irr::video::EDT_DIRECT3D9). More...
 
void SetWindowSize (unsigned int width, unsigned int height)
 Set the window size (default 640x480). More...
 
void SetWindowTitle (const std::string &win_title)
 Set the windoiw title (default ""). More...
 
void SetCameraVertical (CameraVerticalDir vert)
 Use Y-up camera rendering (default CameraVerticalDir::Y). More...
 
void SetLogLevel (irr::ELOG_LEVEL log_level)
 Set the Irrlicht logging level (default irr::ELL_INFORMATION). More...
 
void SetSymbolScale (double scale)
 Set the scale for symbol drawing (default: 1).
 
virtual void Initialize ()
 Initialize the visualization system. More...
 
void AddLogo (const std::string &logo_filename=GetChronoDataFile("logo_chronoengine_alpha.png"))
 Add a logo in a 3D scene. More...
 
void AddCamera (const ChVector<> &pos, ChVector<> targ=VNULL)
 Add a camera in an Irrlicht 3D scene. More...
 
void AddSkyBox (const std::string &texture_dir=GetChronoDataFile("skybox/"))
 Add a sky box in a 3D scene. More...
 
irr::scene::ILightSceneNode * AddLightDirectional (double elevation=90, double azimuth=0, ChColor ambient=ChColor(0.3f, 0.3f, 0.3f), ChColor specular=ChColor(0.8f, 0.8f, 0.8f), ChColor diffuse=ChColor(1.0f, 1.0f, 1.0f))
 Add a directional light to the scene. More...
 
irr::scene::ILightSceneNode * AddLight (const ChVector<> &pos, double radius, ChColor color=ChColor(0.7f, 0.7f, 0.7f))
 Add a point light to the scene. More...
 
irr::scene::ILightSceneNode * AddLightWithShadow (const ChVector<> &pos, const ChVector<> &aim, double radius, double near_value, double far_value, double angle, unsigned int resolution=512, ChColor color=ChColor(1, 1, 1), 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 close 'near_value' and 'far_value' are to the bounding box of the scene. More...
 
void AddTypicalLights ()
 Simple shortcut to set two point lights in the scene. More...
 
void AddUserEventReceiver (irr::IEventReceiver *receiver)
 Attach a custom event receiver to the application.
 
void EnableShadows (std::shared_ptr< ChPhysicsItem > item=nullptr)
 Enable shadow maps for all visual models in a scene or only for a single physics item. More...
 
void EnableContactDrawing (ContactsDrawMode mode)
 Enable contact rendering (default: none). More...
 
void EnableLinkDrawing (LinkDrawMode mode)
 Enable rendering of link (joint) frames (default: none). More...
 
void EnableBodyFrameDrawing (bool val)
 Enable rendering of body frames (default: false). More...
 
void EnableLinkFrameDrawing (bool val)
 Enable rendering of link frames (default: false). More...
 
void EnableCollisionShapeDrawing (bool val)
 Enable rendering of collision shapes (default: false). More...
 
virtual void EnableModalAnalysis (bool val) override
 Enable modal analysis visualization (default: false). More...
 
virtual void SetModalModeNumber (int val) override
 Set the mode to be shown (only if some ChModalAssembly is found).
 
virtual void SetModalAmplitude (double val) override
 Set the amplitude of the shown mode (only if some ChModalAssembly is found).
 
virtual void SetModalSpeed (double val) override
 Set the speed of the shown mode (only if some ChModalAssembly is found).
 
void ShowProfiler (bool val)
 Show the realtime profiler in the 3D view.
 
void ShowExplorer (bool val)
 Show the object explorer.
 
void ShowInfoPanel (bool val)
 Show the info panel in the 3D view.
 
void SetInfoTab (int ntab)
 Set the active tab on the info panel. More...
 
irr::IrrlichtDevice * GetDevice ()
 
irr::video::IVideoDriver * GetVideoDriver ()
 
irr::scene::ISceneManager * GetSceneManager ()
 
irr::scene::ICameraSceneNode * GetActiveCamera ()
 
irr::gui::IGUIEnvironment * GetGUIEnvironment ()
 
virtual void BindAll () override
 Process all visual assets in the associated ChSystem. More...
 
virtual void BindItem (std::shared_ptr< ChPhysicsItem > item) override
 Process the visual assets for the spcified physics item. More...
 
bool Run ()
 Run the Irrlicht device. More...
 
virtual void BeginScene (bool backBuffer=true, bool zBuffer=true, ChColor color=ChColor(0, 0, 0))
 Clean the canvas at the beginning of each animation frame.
 
virtual void DrawAll ()
 Draw all 3D shapes and GUI elements at the current frame. More...
 
virtual void EndScene ()
 End the scene draw at the end of each animation frame.
 
virtual void WriteImageToFile (const std::string &filename) override
 Create a snapshot of the last rendered frame and save it to the provided file. More...
 
- Public Member Functions inherited from chrono::ChVisualSystem
ChSystemGetSystem () const
 Get the associated Chrono system.
 

Additional Inherited Members

- Protected Attributes inherited from chrono::ChVisualSystem
ChSystemm_system
 associated Chrono system
 

Member Function Documentation

◆ AddCamera()

void chrono::irrlicht::ChVisualSystemIrrlicht::AddCamera ( const ChVector<> &  pos,
ChVector<>  targ = VNULL 
)

Add a camera in an Irrlicht 3D scene.

The camera rotation/pan is controlled by mouse left and right buttons, the zoom is controlled by mouse wheel or rmb+lmb+mouse, the position can be changed also with keyboard up/down/left/right arrows, the height can be changed with keyboard 'PgUp' and 'PgDn' keys. Optional parameters are position and target. Has no effect, unles called after Initialize().

◆ AddLight()

irr::scene::ILightSceneNode * chrono::irrlicht::ChVisualSystemIrrlicht::AddLight ( const ChVector<> &  pos,
double  radius,
ChColor  color = ChColor(0.7f, 0.7f, 0.7f) 
)

Add a point light to the scene.

Has no effect, unles called after Initialize().

◆ AddLightDirectional()

irr::scene::ILightSceneNode * chrono::irrlicht::ChVisualSystemIrrlicht::AddLightDirectional ( double  elevation = 90,
double  azimuth = 0,
ChColor  ambient = ChColor(0.3f, 0.3f, 0.3f),
ChColor  specular = ChColor(0.8f, 0.8f, 0.8f),
ChColor  diffuse = ChColor(1.0f, 1.0f, 1.0f) 
)

Add a directional light to the scene.

Has no effect, unles called after Initialize(). Light direction is defined by:

  • elevation (deg) between 0 (at the horizon) and 90 (above)
  • azimuth (deg) between 0 and 360, with 0 = South (-X), 90 = East (-Y), 180 = North (+X), 270 = West (+Y)
Parameters
elevationlight elevation
azimuthlight azimuth
ambientambient color
specularspecular color
diffusediffuse color

◆ AddLightWithShadow()

irr::scene::ILightSceneNode * chrono::irrlicht::ChVisualSystemIrrlicht::AddLightWithShadow ( const ChVector<> &  pos,
const ChVector<> &  aim,
double  radius,
double  near_value,
double  far_value,
double  angle,
unsigned int  resolution = 512,
ChColor  color = ChColor(1, 1, 1),
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 close 'near_value' and 'far_value' are to the bounding box of the scene.

Use AddShadow() to enable shadows for an object or for the entire scene. Has no effect, unless called after Initialize().

◆ AddLogo()

void chrono::irrlicht::ChVisualSystemIrrlicht::AddLogo ( const std::string &  logo_filename = GetChronoDataFile("logo_chronoengine_alpha.png"))

Add a logo in a 3D scene.

Has no effect, unles called after Initialize().

◆ AddSkyBox()

void chrono::irrlicht::ChVisualSystemIrrlicht::AddSkyBox ( const std::string &  texture_dir = GetChronoDataFile("skybox/"))

Add a sky box in a 3D scene.

Note: it is assumed that the specified "texture_dir" directory contains the following three texture images: sky_lf.jpg, sky_up.jpg, sky_dn.jpg. Has no effect, unless called after Initialize().

◆ AddTypicalLights()

void chrono::irrlicht::ChVisualSystemIrrlicht::AddTypicalLights ( )

Simple shortcut to set two point lights in the scene.

For more precise control on lights, use AddLight() or just use Irrlicht directly. Has no effect, unless called after Initialize().

◆ BindAll()

void chrono::irrlicht::ChVisualSystemIrrlicht::BindAll ( )
overridevirtual

Process all visual assets in the associated ChSystem.

This function is called by default by Initialize(), but can also be called later if further modifications to visualization assets occur.

Reimplemented from chrono::ChVisualSystem.

◆ BindItem()

void chrono::irrlicht::ChVisualSystemIrrlicht::BindItem ( std::shared_ptr< ChPhysicsItem item)
overridevirtual

Process the visual assets for the spcified physics item.

This function must be called if a new physics item is added to the system or if changes to its visual model occur after the call to Initialize().

Reimplemented from chrono::ChVisualSystem.

◆ DrawAll()

void chrono::irrlicht::ChVisualSystemIrrlicht::DrawAll ( )
virtual

Draw all 3D shapes and GUI elements at the current frame.

This function is typically called inside a loop such as

   while(vis->GetDevice()->run()) {...}

Reimplemented in chrono::vehicle::ChVehicleVisualSystemIrrlicht, and chrono::robosimian::RoboSimianVisualSystemIrrlicht.

◆ EnableBodyFrameDrawing()

void chrono::irrlicht::ChVisualSystemIrrlicht::EnableBodyFrameDrawing ( bool  val)

Enable rendering of body frames (default: false).

Has no effect, unless called after the visual system is initialized and attached.

◆ EnableCollisionShapeDrawing()

void chrono::irrlicht::ChVisualSystemIrrlicht::EnableCollisionShapeDrawing ( bool  val)

Enable rendering of collision shapes (default: false).

Has no effect, unless called after the visual system is initialized and attached.

◆ EnableContactDrawing()

void chrono::irrlicht::ChVisualSystemIrrlicht::EnableContactDrawing ( ContactsDrawMode  mode)

Enable contact rendering (default: none).

Has no effect, unless called after the visual system is initialized and attached.

◆ EnableLinkDrawing()

void chrono::irrlicht::ChVisualSystemIrrlicht::EnableLinkDrawing ( LinkDrawMode  mode)

Enable rendering of link (joint) frames (default: none).

Has no effect, unless called after the visual system is initialized and attached.

◆ EnableLinkFrameDrawing()

void chrono::irrlicht::ChVisualSystemIrrlicht::EnableLinkFrameDrawing ( bool  val)

Enable rendering of link frames (default: false).

Has no effect, unless called after the visual system is initialized and attached.

◆ EnableModalAnalysis()

void chrono::irrlicht::ChVisualSystemIrrlicht::EnableModalAnalysis ( bool  val)
overridevirtual

Enable modal analysis visualization (default: false).

If true, visualize an oscillatory motion of the n-th mode (only if some ChModalAssembly is found). Otherwise, visualize the dynamic evolution of the associated system.

Reimplemented from chrono::ChVisualSystem.

◆ EnableShadows()

void chrono::irrlicht::ChVisualSystemIrrlicht::EnableShadows ( std::shared_ptr< ChPhysicsItem item = nullptr)

Enable shadow maps for all visual models in a scene or only for a single physics item.

A shadow-enabled light must be added to the scene with Shadow maps in Irrlicht may slow visualization a bit. Also, one must remember to add shadow-enabled light, using AddLightWithShadow(). Has no effect, unless called after Initialize().

◆ Initialize()

void chrono::irrlicht::ChVisualSystemIrrlicht::Initialize ( )
virtual

Initialize the visualization system.

This creates the Irrlicht device using the current values for the optional device parameters.

Reimplemented in chrono::vehicle::ChVehicleVisualSystemIrrlicht.

◆ Run()

bool chrono::irrlicht::ChVisualSystemIrrlicht::Run ( )

Run the Irrlicht device.

Returns false if the device wants to be deleted.

◆ SetAntialias()

void chrono::irrlicht::ChVisualSystemIrrlicht::SetAntialias ( bool  val)

Enable/disable antialias (default true).

Must be called before Initialize().

◆ SetCameraVertical()

void chrono::irrlicht::ChVisualSystemIrrlicht::SetCameraVertical ( CameraVerticalDir  vert)

Use Y-up camera rendering (default CameraVerticalDir::Y).

Must be called before Initialize().

◆ SetDriverType()

void chrono::irrlicht::ChVisualSystemIrrlicht::SetDriverType ( irr::video::E_DRIVER_TYPE  driver_type)

Set the device driver type (default irr::video::EDT_DIRECT3D9).

Must be called before Initialize().

◆ SetFullscreen()

void chrono::irrlicht::ChVisualSystemIrrlicht::SetFullscreen ( bool  val)

Enable/disable full-screen mode (default false).

Must be called before Initialize().

◆ SetInfoTab()

void chrono::irrlicht::ChVisualSystemIrrlicht::SetInfoTab ( int  ntab)

Set the active tab on the info panel.

Has no effect, unless called after the visual system is initialized and attached.

◆ SetLogLevel()

void chrono::irrlicht::ChVisualSystemIrrlicht::SetLogLevel ( irr::ELOG_LEVEL  log_level)

Set the Irrlicht logging level (default irr::ELL_INFORMATION).

Must be called before Initialize().

◆ SetShadows()

void chrono::irrlicht::ChVisualSystemIrrlicht::SetShadows ( bool  val)

Enable/disable shadows (default false).

Must be called before Initialize().

◆ SetWindowSize()

void chrono::irrlicht::ChVisualSystemIrrlicht::SetWindowSize ( unsigned int  width,
unsigned int  height 
)

Set the window size (default 640x480).

Must be called before Initialize().

◆ SetWindowTitle()

void chrono::irrlicht::ChVisualSystemIrrlicht::SetWindowTitle ( const std::string &  win_title)

Set the windoiw title (default "").

Must be called before Initialize().

◆ WriteImageToFile()

void chrono::irrlicht::ChVisualSystemIrrlicht::WriteImageToFile ( const std::string &  filename)
overridevirtual

Create a snapshot of the last rendered frame and save it to the provided file.

The file extension determines the image format.

Reimplemented from chrono::ChVisualSystem.


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