Project Chrono: chrono::gpu::ChGpuVisualization Class Reference

Public Member Functions | List of all members
chrono::gpu::ChGpuVisualization Class Reference
GPU module » Utilities

## 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.

`#include <ChGpuVisualization.h>`

## Public Member Functions
| ChGpuVisualization (ChSystemGpu *sysGPU)
| Create a run-time visualization object associated with a given Chrono::Gpu system.
void | SetTitle (const std::string &title)
| Set title of the visualization window (default: "").
void | SetSize (int width, int height)
| Set window dimensions (default: 1280x720).
void | AddCamera (const ChVector3d &pos, const ChVector3d &target)
| Add a camera initially at the specified position and target (look at) point.
void | UpdateCamera (const ChVector3d &pos, const ChVector3d &target)
| Set camera position and target (look at) point.
virtual void | SetCameraVertical (CameraVerticalDir up)
| Set camera up vector (default: Z).
void | SetCameraMoveScale (float scale)
| Set scale for camera movement increments (default: 0.1).
void | AttachSystem (ChSystem *system)
| Attach a user-provided Chrono system for rendering.
void | AddProxyBody (std::shared_ptr< ChBody > body)
| Add additional proxy body to supplemental system.
void | Initialize ()
| Initialize the run-time visualization system.
bool | Render ()
| Render the current state of the Chrono::Gpu system.

## Constructor & Destructor Documentation

## ◆ ChGpuVisualization()

chrono::gpu::ChGpuVisualization::ChGpuVisualization | ( | ChSystemGpu * | sysGPU | ) |

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.

## 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().

## ◆ AttachSystem()

void chrono::gpu::ChGpuVisualization::AttachSystem | ( | ChSystem * | system | ) |
| inline

Attach a user-provided Chrono system for rendering.

By default, the GPU run-time visualization renders granular particles. This function can be used to also render the mechanical system interacting with the granular system.

## ◆ 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. Returns false if the visualization window was closed. 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().

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

- D:/W/B/src/chrono-9.0.1/src/chrono_gpu/utils/ChGpuVisualization.h
- D:/W/B/src/chrono-9.0.1/src/chrono_gpu/utils/ChGpuVisualization.cpp