Class PxTriangleMeshGeometry

java.lang.Object
physx.NativeObject
physx.geometry.PxGeometry
physx.geometry.PxTriangleMeshGeometry

public class PxTriangleMeshGeometry extends PxGeometry
Triangle mesh geometry class.

This class unifies a mesh object with a scaling transform, and lets the combined object be used anywhere a PxGeometry is needed.

The scaling is a transform along arbitrary axes contained in the scale object. The vertices of the mesh in geometry (or shape) space is the PxMeshScale::toMat33() transform, multiplied by the vertex space vertices in the PxTriangleMeshGeometry object.

  • Field Details

    • SIZEOF

      public static final int SIZEOF
    • ALIGNOF

      public static final int ALIGNOF
      See Also:
  • Constructor Details

    • PxTriangleMeshGeometry

      protected PxTriangleMeshGeometry()
    • PxTriangleMeshGeometry

      protected PxTriangleMeshGeometry(long address)
    • PxTriangleMeshGeometry

      public PxTriangleMeshGeometry(PxTriangleMesh mesh)
      Constructor. By default creates an empty object with a NULL mesh and identity scale.
      Parameters:
      mesh - Mesh pointer. May be NULL, though this will not make the object valid for shape construction.
    • PxTriangleMeshGeometry

      public PxTriangleMeshGeometry(PxTriangleMesh mesh, PxMeshScale scaling)
      Constructor. By default creates an empty object with a NULL mesh and identity scale.
      Parameters:
      mesh - Mesh pointer. May be NULL, though this will not make the object valid for shape construction.
      scaling - Scale factor.
    • PxTriangleMeshGeometry

      public PxTriangleMeshGeometry(PxTriangleMesh mesh, PxMeshScale scaling, PxMeshGeometryFlags flags)
      Constructor. By default creates an empty object with a NULL mesh and identity scale.
      Parameters:
      mesh - Mesh pointer. May be NULL, though this will not make the object valid for shape construction.
      scaling - Scale factor.
      flags - Mesh flags.
  • Method Details

    • wrapPointer

      public static PxTriangleMeshGeometry wrapPointer(long address)
    • arrayGet

      public static PxTriangleMeshGeometry arrayGet(long baseAddress, int index)
    • createAt

      public static PxTriangleMeshGeometry createAt(long address, PxTriangleMesh mesh)
      Parameters:
      address - Pre-allocated memory, where the object is created.
      mesh - WebIDL type: PxTriangleMesh
      Returns:
      Stack allocated object of PxTriangleMeshGeometry
    • createAt

      public static <T> PxTriangleMeshGeometry createAt(T allocator, NativeObject.Allocator<T> allocate, PxTriangleMesh mesh)
      Type Parameters:
      T - Allocator class, e.g. LWJGL's MemoryStack.
      Parameters:
      allocator - Object to use for allocation, e.g. an instance of LWJGL's MemoryStack.
      allocate - Method to call on allocator to obtain the target address, e.g. MemoryStack::nmalloc.
      mesh - WebIDL type: PxTriangleMesh
      Returns:
      Stack allocated object of PxTriangleMeshGeometry
    • createAt

      public static PxTriangleMeshGeometry createAt(long address, PxTriangleMesh mesh, PxMeshScale scaling)
      Parameters:
      address - Pre-allocated memory, where the object is created.
      mesh - WebIDL type: PxTriangleMesh
      scaling - WebIDL type: PxMeshScale [Const, Ref]
      Returns:
      Stack allocated object of PxTriangleMeshGeometry
    • createAt

      public static <T> PxTriangleMeshGeometry createAt(T allocator, NativeObject.Allocator<T> allocate, PxTriangleMesh mesh, PxMeshScale scaling)
      Type Parameters:
      T - Allocator class, e.g. LWJGL's MemoryStack.
      Parameters:
      allocator - Object to use for allocation, e.g. an instance of LWJGL's MemoryStack.
      allocate - Method to call on allocator to obtain the target address, e.g. MemoryStack::nmalloc.
      mesh - WebIDL type: PxTriangleMesh
      scaling - WebIDL type: PxMeshScale [Const, Ref]
      Returns:
      Stack allocated object of PxTriangleMeshGeometry
    • createAt

      public static PxTriangleMeshGeometry createAt(long address, PxTriangleMesh mesh, PxMeshScale scaling, PxMeshGeometryFlags flags)
      Parameters:
      address - Pre-allocated memory, where the object is created.
      mesh - WebIDL type: PxTriangleMesh
      scaling - WebIDL type: PxMeshScale [Const, Ref]
      flags - WebIDL type: PxMeshGeometryFlags [Ref]
      Returns:
      Stack allocated object of PxTriangleMeshGeometry
    • createAt

      public static <T> PxTriangleMeshGeometry createAt(T allocator, NativeObject.Allocator<T> allocate, PxTriangleMesh mesh, PxMeshScale scaling, PxMeshGeometryFlags flags)
      Type Parameters:
      T - Allocator class, e.g. LWJGL's MemoryStack.
      Parameters:
      allocator - Object to use for allocation, e.g. an instance of LWJGL's MemoryStack.
      allocate - Method to call on allocator to obtain the target address, e.g. MemoryStack::nmalloc.
      mesh - WebIDL type: PxTriangleMesh
      scaling - WebIDL type: PxMeshScale [Const, Ref]
      flags - WebIDL type: PxMeshGeometryFlags [Ref]
      Returns:
      Stack allocated object of PxTriangleMeshGeometry
    • destroy

      public void destroy()
      Overrides:
      destroy in class PxGeometry
    • getScale

      public PxMeshScale getScale()
      The scaling transformation.
    • setScale

      public void setScale(PxMeshScale value)
      The scaling transformation.
    • getMeshFlags

      public PxMeshGeometryFlags getMeshFlags()
      Mesh flags.
    • setMeshFlags

      public void setMeshFlags(PxMeshGeometryFlags value)
      Mesh flags.
    • getTriangleMesh

      public PxTriangleMesh getTriangleMesh()
      A reference to the mesh object.
    • setTriangleMesh

      public void setTriangleMesh(PxTriangleMesh value)
      A reference to the mesh object.
    • isValid

      public boolean isValid()
      Returns true if the geometry is valid.
      Returns:
      True if the current settings are valid for shape creation.

      Note: A valid triangle mesh has a positive scale value in each direction (scale.scale.x > 0, scale.scale.y > 0, scale.scale.z > 0). It is illegal to call PxRigidActor::createShape and PxPhysics::createShape with a triangle mesh that has zero extents in any direction.