chrono::gpu::ChGpuVisualization Class Reference

Description

Run-time visualization support for Chrono::Gpu systems.

Requires the Chrono::OpenGL module; if not available, most ChGpuVisualization functions are no-op.

Visualization is based on a separate Chrono system which carries proxies for all particles in the Chrono::Gpu system. This separate system can be provided by the user or else created automatically. Note that using run-time visualization for a Chrono::Gpu system incurs the penalty of collecting positions of all particles every time the Render() function is invoked.

To implement a moving camera (i.e., prescribe the camera position), get the current instance of the active Chrono::OpenGL window and use the function ChOpenGLWindow::SetCamera().

#include <ChGpuVisualization.h>

Public Member Functions

 ChGpuVisualization (ChSystemGpu *sysGPU, ChSystem *sys=nullptr)
 Create a run-time visualization object associated with a given Chrono::Gpu system. More...
 
void SetTitle (const std::string &title)
 Set title of the visualization window (default: "").
 
void SetCameraPosition (const ChVector<> &pos, const ChVector<> &target)
 Set camera position and target (look at) point. More...
 
void SetCameraUpVector (const ChVector<> &up)
 Set camera up vector (default: Z). More...
 
void SetCameraMoveScale (float scale)
 Set scale for camera movement increments (default: 0.1). More...
 
void AddProxyBody (std::shared_ptr< ChBody > body)
 Add additional proxy body to supplemental system. More...
 
void Initialize ()
 Initialize the run-time visualization system. More...
 
bool Render ()
 Render the current state of the Chrono::Gpu system. More...
 

Constructor & Destructor Documentation

◆ ChGpuVisualization()

chrono::gpu::ChGpuVisualization::ChGpuVisualization ( ChSystemGpu sysGPU,
ChSystem sys = nullptr 
)

Create a run-time visualization object associated with a given Chrono::Gpu system.

If a supplemental Chrono system is not provided (default), one will be created internally.

Parameters
sysGPUAssociated Chrono::Gpu system
sysSupplemental Chrono system containing visualization proxies

Member Function Documentation

◆ AddProxyBody()

void chrono::gpu::ChGpuVisualization::AddProxyBody ( std::shared_ptr< ChBody body)

Add additional proxy body to supplemental system.

Must be called before Initialize(). The provided body is set fixed to ground and it is the caller's responsibility to update the position of this body before a call to Render().

◆ Initialize()

void chrono::gpu::ChGpuVisualization::Initialize ( )

Initialize the run-time visualization system.

If the Chrono::OpenGL module is not available, this function is no-op.

◆ Render()

bool chrono::gpu::ChGpuVisualization::Render ( )

Render the current state of the Chrono::Gpu system.

This function, typically invoked from within the main simulation loop, can only be called after construction of the Gpu system was completed (i.e., the system was initialized). This funtion querries the positions of all particles in the Gpu system in order to update the positions of the proxy bodies. If the Chrono::OpenGL module is not available, this function is no-op.

◆ SetCameraMoveScale()

void chrono::gpu::ChGpuVisualization::SetCameraMoveScale ( float  scale)

Set scale for camera movement increments (default: 0.1).

Must be called before Initialize().

◆ SetCameraPosition()

void chrono::gpu::ChGpuVisualization::SetCameraPosition ( const ChVector<> &  pos,
const ChVector<> &  target 
)

Set camera position and target (look at) point.

Must be called before Initialize().

◆ SetCameraUpVector()

void chrono::gpu::ChGpuVisualization::SetCameraUpVector ( const ChVector<> &  up)

Set camera up vector (default: Z).

Must be called before Initialize().


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