Click or drag to resize
Ab4d.SharpEngine logo

MeshUtils Methods

The MeshUtils type exposes the following members.

Methods
 NameDescription
Public methodStatic memberCalculateNormals(PositionNormalTextureVertex, Int32) CalculateNormals method calculates normals for the specified vertexBuffer (PositionNormalTexture array) and triangle indices array. Normal values are written to the vertexBuffer. Normals are always normalized.
Public methodStatic memberCalculateNormals(Vector3, Boolean) CalculateNormals method calculates normals for the specified positions and without triangle indices (the triangles are defined by 3 consecutive positions).
Public methodStatic memberCalculateNormals(Vector3, Int32, Boolean) CalculateNormals method calculates normals for the specified positions and and triangle indices arrays.
Public methodStatic memberCalculateNormals(PositionNormalTextureVertex, Int32, Int32, Int32) CalculateNormals method calculates normals for the specified vertexBuffer (PositionNormalTexture array) and triangle indices array. Normal values are written to the vertexBuffer. Normals are always normalized.
Public methodStatic memberCalculateNormals(Vector3, Int32, Int32, Int32, Boolean) CalculateNormals method calculates normals for the specified positions and and triangle indices arrays.
Public methodStatic memberCalculateNormals(Vector3, Int32, Vector3, Int32, Int32, Boolean) CalculateNormals method calculates normals for the specified positions and and triangle indices arrays. Normal values are written to the specified normals array.
Public methodStatic memberCalculateTangentVectors CalculateTangentVectors returns a Vector3 array that represents tangent vectors calculated from specified mesh data.
Public methodStatic memberCombineAllMeshes CombineAllMeshes method combines all meshes from the specified groupNode hierarchy and converts them into a single StandardMesh. It also applies all the transformations to the positions and normals.
Public methodStatic memberCombineMeshes(IListStandardMesh) CombineAllMeshes method combines all meshes from specified list of meshes and returns a single StandardMesh.
Public methodStatic memberCombineMeshes(StandardMesh, StandardMesh, StandardMesh, StandardMesh, StandardMesh) CombineAllMeshes method combines all the specified meshes into a single StandardMesh.
Public methodStatic memberGenerateCubicTextureCoordinates(StandardMesh) Generate texture coordinates for the given mesh. Texture coordinates are computed using cubic projection, which projects the 3D positions on an axis-aligned 3D cube.
Public methodStatic memberGenerateCubicTextureCoordinates(PositionNormalTextureVertex, Int32) Generate texture coordinates for the given vertices and triangleIndices. Texture coordinates are computed using cubic projection, which projects the 3D positions on an axis-aligned 3D cube.
Public methodStatic memberGenerateCubicTextureCoordinates(Vector3, Int32) Generate texture coordinates for the given positions and triangleIndices. Texture coordinates are computed using cubic projection, which projects the 3D positions on an axis-aligned 3D cube.
Public methodStatic memberGenerateCylindricalTextureCoordinates(PositionNormalTextureVertex, Int32, Vector3, Vector3) Generate texture coordinates for the given vertices and triangleIndices. Texture coordinates are computed using cylindrical projection. Texture coordinates for positions that are parallel to the cylinderDirectionVector use simple planar projection. Texture coordinates for other positions are computed based on the angle from the cylinder center axis to the position.
Public methodStatic memberGenerateCylindricalTextureCoordinates(Vector3, Int32, Vector3, Vector3, Vector3) Generate texture coordinates for the given positions and triangleIndices. Texture coordinates are computed using cylindrical projection. Texture coordinates for positions that are parallel to the cylinderDirectionVector use simple planar projection. Texture coordinates for other positions are computed based on the angle from the cylinder center axis to the position.
Public methodStatic memberGenerateCylindricalTextureCoordinates(StandardMesh, NullableVector2, NullableVector2, Vector3, Vector3, Boolean) Generate texture coordinates for the given vertices and triangleIndices. Texture coordinates are computed using cylindrical projection. Texture coordinates for positions that are parallel to the cylinderDirectionVector use simple planar projection. Texture coordinates for other positions are computed based on the angle from the cylinder center axis to the position.
Public methodStatic memberGenerateCylindricalTextureCoordinates(PositionNormalTextureVertex, Int32, NullableVector2, NullableVector2, Vector3, Vector3, Boolean) Generate texture coordinates for the given vertices and triangleIndices. Texture coordinates are computed using cylindrical projection. Texture coordinates for positions that are parallel to the cylinderDirectionVector use simple planar projection. Texture coordinates for other positions are computed based on the angle from the cylinder center axis to the position.
Public methodStatic memberGenerateCylindricalTextureCoordinates(Vector3, Int32, Vector3, NullableVector2, NullableVector2, Vector3, Vector3, Boolean) Generate texture coordinates for the given vertices and triangleIndices. Texture coordinates are computed using cylindrical projection. Texture coordinates for positions that are parallel to the cylinderDirectionVector use simple planar projection. Texture coordinates for other positions are computed based on the angle from the cylinder center axis to the position.
Public methodStatic memberGeneratePlanarTextureCoordinates(StandardMesh, Vector3, Vector3, Boolean, Boolean, Boolean) Generate texture coordinates for the given mesh. Texture coordinates are computed using planar projection. The plane is defined by the normal vector (perpendicular to the plane surface) and direction vector along the plane surface (i.e., the Y direction of the 2D plane shape).
Public methodStatic memberGeneratePlanarTextureCoordinates(PositionNormalTextureVertex, Int32, Vector3, Vector3, Boolean, Boolean, Boolean) Generate texture coordinates for the given vertices and triangleIndices. Texture coordinates are computed using planar projection. The plane is defined by the normal vector (perpendicular to the plane surface) and direction vector along the plane surface (i.e., the Y direction of the 2D plane shape).
Public methodStatic memberGeneratePlanarTextureCoordinates(Vector3, Int32, Vector3, Vector3, Vector3, Boolean, Boolean, Boolean) Generate texture coordinates for the given positions and triangleIndices. Texture coordinates are computed using planar projection. The plane is defined by the normal vector (perpendicular to the plane surface) and direction vector along the plane surface (i.e., the Y direction of the 2D plane shape).
Public methodStatic memberGeneratePlanarTextureCoordinates(PositionNormalTextureVertex, Int32, Vector3, Vector3, NullableVector2, NullableVector2, Boolean, Boolean, Boolean) Generate texture coordinates for the given vertices and triangleIndices. Texture coordinates are computed using planar projection. The plane is defined by the normal vector (perpendicular to the plane surface) and direction vector along the plane surface (i.e., the Y direction of the 2D plane shape).
Public methodStatic memberGeneratePlanarTextureCoordinates(Vector3, Int32, Vector3, Vector3, Vector3, NullableVector2, NullableVector2, Boolean, Boolean, Boolean) Generate texture coordinates for the given positions and triangleIndices. Texture coordinates are computed using planar projection. The plane is defined by the normal vector (perpendicular to the plane surface) and direction vector along the plane surface (i.e., the Y direction of the 2D plane shape).
Public methodStatic memberGetIntersectingTriangles GetIntersectingTriangles returns a list of indexes of triangles from the mesh that intersect the specified boundingBox. To actually split the mesh you can then call the SplitMeshByIndexesOfTriangles(StandardMesh, ListInt32, Boolean, StandardMesh, StandardMesh) method.
Public methodStatic memberGetPositionFromVertexBufferT Gets a single position from the specified vertex buffer array. If vertex buffer type is not supported (not defined by DXEngine) then an exception is thrown. To get a triangle (3 positions) use the GetTriangleFromVertexBufferT(T, Int32, Int32, Int32, Vector3, Vector3, Vector3) method.
Public methodStatic memberGetTriangleFromVertexBufferT Gets 3 positions from the specified vertex buffer array. If vertex buffer type is not supported (not defined by DXEngine) then an exception is thrown. To get a single position use the GetPositionFromVertexBufferT(T, Int32) method.
Public methodStatic memberInverseTriangleIndicesOrientation Inverses the order of triangles indices so that the triangles will face in the other direction (change clockwise direction into counter-clockwise and vice versa).
Public methodStatic memberProject3DPointsTo2DPlane(PositionNormalTextureVertex, Vector3, Vector3, Vector2, Vector2) Projects the given array of vertices (i.e., their 3D positions) onto a 2D plane specified by its normal vector and side direction vector (the "height" direction of the 2D shape).
Public methodStatic memberProject3DPointsTo2DPlane(Vector3, Vector3, Vector3, Vector2, Vector2) Projects the given array of 3D positions onto a 2D plane specified by its normal vector and side direction vector (the "height" direction of the 2D shape).
Public methodStatic memberRemoveDuplicateFollowingPositions RemoveDuplicateFollowingPositions checks an array of Vector3 and returns an array with removed duplicate positions that follow each other. In case there are no duplicates, the same positions instance is returned as it was passed to this method (no new array is created).
Public methodStatic memberSliceMesh Slices the StandardMesh with the specified Plane and returns two new StandardMesh objects: one StandardMesh that is in front of the plane (in the direction of plane's Normal vector) and one StandardMesh that is in the back of the plane. If StandardMesh is fully in front (or in back) of the Plane, then the same instance of StandardMesh is returned (the other returned mesh is null). If the StandardMesh intersects the Plane, it is sliced and new StandardMesh objects are created from it.
Public methodStatic memberSplitMeshByIndexesOfTriangles SplitMeshByIndexesOfTriangles splits the originalMesh into mesh1 and mesh2 based on the list of triangle indexes defined in indexesOfTriangles (can be get by GetIntersectingTriangles(BoundingBox, StandardMesh, Transform) method). When the triangle index is present in the indexesOfTriangles, then the triangle is added to mesh1, otherwise triangle is added to mesh2. Note that mesh1 can be null (when indexesOfTriangles is null or empty). mesh2 can be null when indexesOfTriangles contains the same number of triangles as the originalMesh.
Public methodStatic memberTransformMesh(PositionNormalTextureVertex, Transform, Boolean) Transforms the specified vertices in an array of PositionNormalTextureVertex with the specified Transform and returns a new PositionNormalTextureVertex array (the same array is returned in case of null or identity transform). If transformNormals is set to true (by default) the normals are transformed with inverted and transposed transform matrix.
Public methodStatic memberTransformMesh(StandardMesh, Transform, Boolean) Transforms the specified StandardMesh with the specified Transform and returns a new StandardMesh (the same StandardMesh is returned in case of null or identity transform). If transformNormals is set to true (by default) the normals are transformed with inverted and transposed transform matrix.
Public methodStatic memberUpdateCombinedMeshes UpdateCombinedMeshes method updates the Vertices in specified combinedMesh that was created before by calling CombineAllMeshes(GroupNode, Transform) method. It also applies all the transformations to the positions and normals. If the count of triangle indices is the same, then they are not updated.
Top
See Also