Click or drag to resize
Ab4d.SharpEngine logo

TriangleMeshT Class

TriangleMesh class defines the mesh that is created from triangles. Triangles are defined using the data from the TriangleIndices to combine three vertices (defined in Vertices).
Inheritance Hierarchy

Namespace: Ab4d.SharpEngine.Meshes
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public class TriangleMesh<T> : Mesh, 
	IRayHitTestedObject, ITriangularMesh
where T : struct, new(), Object

Type Parameters

T

The TriangleMeshT type exposes the following members.

Constructors
Properties
 NameDescription
Public propertyTriangleIndices Array of integers that define the triangles (3 consecutive integers defined 3 indexes in the Vertices array that define a triangle). When the data in the TriangleIndices array are changed and if this mesh was already initialized ([!:Mesh.IsInitialized] is true) then you need to call UpdateMesh or UpdateMesh(BoundingBox) method for the changes to take effect. When the TriangleIndices property is changed to another array, then UpdateMesh is called automatically.
Public propertyTrianglesCount Gets the number of triangles that are used to define this mesh.
Public propertyVertices Array of vertices of the specified type T. When the data in the Vertices array are changed and if this mesh was already initialized ([!:Mesh.IsInitialized] is true) then you need to call UpdateMesh or UpdateMesh(BoundingBox) method for the changes to take effect. When the Vertices property is changed to another array, then UpdateMesh is called automatically.
Top
Methods
 NameDescription
Public methodGetClosestHitResult GetClosestHitResult method returns a RayHitTestResult with the closest triangle hit by the specified ray. When no triangle is hit, null is returned.
Public methodGetDataChannel GetDataChannel returns an object with the data from the specified channel. For example, for Positions an array of Vector3 is returned with positions defined by this mesh. Executing this method may take some time because the method may need to create new array objects and copy data from some other data structure (for example an array of PositionNormalTextureVertex values).
(Overrides MeshGetDataChannel(MeshDataChannelTypes))
Public methodGetDetailsText GetDetailsText method gets string with values of individual vertices and triangle indices of this mesh.
(Overrides MeshGetDetailsText(Boolean, Boolean, Boolean, Int32, Int32, Int32))
Public methodGetNextHitResult GetNextHitResult method continues hit testing from the previously returned hit test and returns a RayHitTestResult with the next hit triangle (not necessary the next closest triangle) or null if no other triangle is hit. This method can be used to get all hit results.
Public methodGetNormals Returns an array of Vector3 that define the normals of this mesh. Executing this method may take some time because the method will need to create new array objects and copy data from the original vertices data structure (for example an array of PositionNormalTextureVertex values).
Public methodGetPositions Returns an array of Vector3 that define the positions of this mesh. Executing this method may take some time because the method will need to create new array objects and copy data from the original vertices data structure (for example an array of PositionNormalTextureVertex values).
Public methodGetTextureCoordinates Returns an array of Vector2 that define the texture coordinates of this mesh. Executing this method may take some time because the method will need to create new array objects and copy data from the original vertices data structure (for example an array of PositionNormalTextureVertex values).
Public methodGetTrianglePositions GetTrianglePositions sets the 3 positions that define the triangle with the specified index (max allowed triangleIndex is TrianglesCount - 1).
Public methodHitTest HitTest method test the triangles defined in this mesh for hitting with the specified ray. When getOnlyNextHitTest is false, then the closest hit result is returned, else the next hit result is returned. When no hit is found, null is returned.
Protected methodOnInitializeSceneResources Initializes resources with the specified Scene and GpuDevice. This method can be override and is called from InitializeSceneResources(Scene) method.
(Overrides InitializedSceneComponentOnInitializeSceneResources(Scene, VulkanDevice))
Protected methodOnUpdateMesh OnUpdateMesh
(Overrides MeshOnUpdateMesh(Boolean))
Public methodUpdateBoundingBox UpdateBoundingBox method calculates the BoundingBox from the Vertices.
Top
See Also