Jolt Physics
A multi core friendly Game Physics Engine
Loading...
Searching...
No Matches
MeshShapeSettings Class Referencefinal

Class that constructs a MeshShape. More...

#include <MeshShape.h>

Inheritance diagram for MeshShapeSettings:
ShapeSettings SerializableObject RefTarget< ShapeSettings > NonCopyable

Public Member Functions

 MeshShapeSettings ()=default
 Default constructor for deserialization. More...
 
 MeshShapeSettings (const TriangleList &inTriangles, PhysicsMaterialList inMaterials=PhysicsMaterialList())
 Create a mesh shape. More...
 
 MeshShapeSettings (VertexList inVertices, IndexedTriangleList inTriangles, PhysicsMaterialList inMaterials=PhysicsMaterialList())
 
void Sanitize ()
 Sanitize the mesh data. Remove duplicate and degenerate triangles. This is called automatically when constructing the MeshShapeSettings with a list of (indexed-) triangles. More...
 
virtual ShapeResult Create () const override
 Create a shape according to the settings specified by this object. More...
 
- Public Member Functions inherited from ShapeSettings
virtual ShapeResult Create () const =0
 Create a shape according to the settings specified by this object. More...
 
void ClearCachedResult ()
 
- Public Member Functions inherited from SerializableObject
virtual ~SerializableObject ()=default
 Constructor. More...
 
- Public Member Functions inherited from NonCopyable
 NonCopyable ()=default
 
 NonCopyable (const NonCopyable &)=delete
 
void operator= (const NonCopyable &)=delete
 
- Public Member Functions inherited from RefTarget< ShapeSettings >
 RefTarget ()=default
 Constructor. More...
 
 RefTarget (const RefTarget &)
 
 ~RefTarget ()
 assert no one is referencing us More...
 
void SetEmbedded () const
 
RefTargetoperator= (const RefTarget &)
 Assignment operator. More...
 
uint32 GetRefCount () const
 Get current refcount of this object. More...
 
void AddRef () const
 Add or release a reference to this object. More...
 
void Release () const
 

Public Attributes

VertexList mTriangleVertices
 Vertices belonging to mIndexedTriangles. More...
 
IndexedTriangleList mIndexedTriangles
 
PhysicsMaterialList mMaterials
 Materials assigned to the triangles. Each triangle specifies which material it uses through its mMaterialIndex. More...
 
uint mMaxTrianglesPerLeaf = 8
 
float mActiveEdgeCosThresholdAngle = 0.996195f
 
- Public Attributes inherited from ShapeSettings
uint64 mUserData = 0
 User data (to be used freely by the application) More...
 

Additional Inherited Members

- Public Types inherited from ShapeSettings
using ShapeResult = Result< Ref< Shape > >
 
- Static Public Member Functions inherited from RefTarget< ShapeSettings >
static int sInternalGetRefCountOffset ()
 INTERNAL HELPER FUNCTION USED BY SERIALIZATION. More...
 
- Protected Attributes inherited from ShapeSettings
ShapeResult mCachedResult
 
- Protected Attributes inherited from RefTarget< ShapeSettings >
atomic< uint32mRefCount
 Current reference count. More...
 
- Static Protected Attributes inherited from RefTarget< ShapeSettings >
static constexpr uint32 cEmbedded
 A large value that gets added to the refcount to mark the object as embedded. More...
 

Detailed Description

Class that constructs a MeshShape.

Constructor & Destructor Documentation

◆ MeshShapeSettings() [1/3]

MeshShapeSettings::MeshShapeSettings ( )
default

Default constructor for deserialization.

◆ MeshShapeSettings() [2/3]

MeshShapeSettings::MeshShapeSettings ( const TriangleList inTriangles,
PhysicsMaterialList  inMaterials = PhysicsMaterialList() 
)

Create a mesh shape.

◆ MeshShapeSettings() [3/3]

MeshShapeSettings::MeshShapeSettings ( VertexList  inVertices,
IndexedTriangleList  inTriangles,
PhysicsMaterialList  inMaterials = PhysicsMaterialList() 
)

Member Function Documentation

◆ Create()

ShapeSettings::ShapeResult MeshShapeSettings::Create ( ) const
overridevirtual

Create a shape according to the settings specified by this object.

Implements ShapeSettings.

◆ Sanitize()

void MeshShapeSettings::Sanitize ( )

Sanitize the mesh data. Remove duplicate and degenerate triangles. This is called automatically when constructing the MeshShapeSettings with a list of (indexed-) triangles.

Member Data Documentation

◆ mActiveEdgeCosThresholdAngle

float MeshShapeSettings::mActiveEdgeCosThresholdAngle = 0.996195f

Cosine of the threshold angle (if the angle between the two triangles is bigger than this, the edge is active, note that a concave edge is always inactive). Setting this value too small can cause ghost collisions with edges, setting it too big can cause depenetration artifacts (objects not depenetrating quickly). Valid ranges are between cos(0 degrees) and cos(90 degrees). The default value is cos(5 degrees).

◆ mIndexedTriangles

IndexedTriangleList MeshShapeSettings::mIndexedTriangles

Original list of indexed triangles (triangles will be reordered internally in the mesh shape). Triangles must be provided in counter clockwise order. For simulation, the triangles are considered to be single sided. For ray casts you can choose to make triangles double sided by setting RayCastSettings::mBackFaceMode to EBackFaceMode::CollideWithBackFaces. For collide shape tests you can use CollideShapeSettings::mBackFaceMode and for shape casts you can use ShapeCastSettings::mBackFaceModeTriangles.

◆ mMaterials

PhysicsMaterialList MeshShapeSettings::mMaterials

Materials assigned to the triangles. Each triangle specifies which material it uses through its mMaterialIndex.

◆ mMaxTrianglesPerLeaf

uint MeshShapeSettings::mMaxTrianglesPerLeaf = 8

Maximum number of triangles in each leaf of the axis aligned box tree. This is a balance between memory and performance. Can be in the range [1, MeshShape::MaxTrianglesPerLeaf]. Sensible values are between 4 (for better performance) and 8 (for less memory usage).

◆ mTriangleVertices

VertexList MeshShapeSettings::mTriangleVertices

Vertices belonging to mIndexedTriangles.


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