chrono::ChTriangleMeshShape Class Reference


Class for referencing a triangle mesh shape that can be visualized in some way.

A ChTriangleMeshShape can be attached to a physics object. Provides various rendering options (e.g., drawing as wireframe, performing backface culling, etc.) which may not be supported by a particular visualization system.

#include <ChTriangleMeshShape.h>

Inheritance diagram for chrono::ChTriangleMeshShape:
Collaboration diagram for chrono::ChTriangleMeshShape:

Public Member Functions

std::shared_ptr< geometry::ChTriangleMeshConnectedGetMesh ()
void SetMesh (std::shared_ptr< geometry::ChTriangleMeshConnected > mesh, bool load_materials=true)
 Associate the mesh asset with a triangle mesh geometry. More...
bool IsWireframe () const
void SetWireframe (bool mw)
bool IsBackfaceCull () const
void SetBackfaceCull (bool mbc)
const std::string & GetName () const
void SetName (const std::string &mname)
const ChVectorGetScale () const
void SetScale (const ChVector<> &mscale)
void SetFixedConnectivity ()
bool FixedConnectivity () const
void SetModifiedVertices (std::vector< int > vertices)
const std::vector< int > & GetModifiedVertices () const
virtual void ArchiveOut (ChArchiveOut &marchive) override
 Method to allow serialization of transient data to archives.
virtual void ArchiveIn (ChArchiveIn &marchive) override
 Method to allow de-serialization of transient data from archives.
- Public Member Functions inherited from chrono::ChVisualShape
void SetVisible (bool mv)
 Set this visualization asset as visible.
bool IsVisible () const
 Return true if the asset is set as visible.
void SetColor (const ChColor &col)
 Set the diffuse color for this shape. More...
ChColor GetColor () const
 Return the diffuse color of the first material in the list of materials for this shape. More...
void SetOpacity (float val)
 Set opacity for this shape (0: fully transparent; 1: fully opaque). More...
float GetOpacity () const
 Get opacity of the first material in the list of materials for this shape. More...
void SetTexture (const std::string &filename, float scale_x=1, float scale_y=1)
 Set the diffuse texture map for this shape. More...
std::string GetTexture () const
 Return the diffuse texture map of the first material in the list of materials for this shape. More...
void SetMutable (bool val)
 Set this visualization shape as modifiable (default: false for primitive shapes, true otherwise). More...
bool IsMutable () const
 Return true if the visualization shape is marked as modifiable.
int AddMaterial (std::shared_ptr< ChVisualMaterial > material)
 Add a visualization material and return its index in the list of materials.
void SetMaterial (int i, std::shared_ptr< ChVisualMaterial > material)
 Replace the material with specified index. More...
std::vector< std::shared_ptr< ChVisualMaterial > > & GetMaterials ()
 Get the list of visualization materials.
std::shared_ptr< ChVisualMaterialGetMaterial (int i)
 Get the specified material in the list.
int GetNumMaterials () const
 Get the number of visualization materials.

Additional Inherited Members

- Protected Member Functions inherited from chrono::ChVisualShape
virtual void Update (ChPhysicsItem *updater, const ChFrame<> &frame)
 Update this visual shape with information for the owning physical object. More...
- Protected Attributes inherited from chrono::ChVisualShape
bool visible
 shape visibility flag
bool is_mutable
 flag indicating whether the shape is rigid or deformable
std::vector< std::shared_ptr< ChVisualMaterial > > material_list
 list of visualization materials

Member Function Documentation

◆ SetMesh()

void chrono::ChTriangleMeshShape::SetMesh ( std::shared_ptr< geometry::ChTriangleMeshConnected mesh,
bool  load_materials = true 

Associate the mesh asset with a triangle mesh geometry.

Optionally, if load_materials is set to true and if the provided trimesh was loaded from a Wavefront OBJ file, associated material files are searched for and visualization materials loaded.

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