Click or drag to resize
Ab4d.SharpEngine logo

MeshUtilsGeneratePlanarTextureCoordinates(Vector3, Int32, Vector3, Vector3, Vector3, Boolean, Boolean, Boolean) Method

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).

Namespace: Ab4d.SharpEngine.Utilities
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 2.0.8956+4c7684e186ca1be74e7a284fbe739d9a1b843d3c
Syntax
C#
public static Vector2[] GeneratePlanarTextureCoordinates(
	Vector3[] positions,
	int[] triangleIndices,
	Vector3[]? normals,
	Vector3 planeNormalVector,
	Vector3 planeHeightVector,
	bool flipXCoordinate = false,
	bool flipYCoordinate = false,
	bool flipBackwardFacingXCoordinate = false
)

Parameters

positions  Vector3
Array of 3D vertex positions that define the mesh.
triangleIndices  Int32
Array of triangle indices that define the mesh.
normals  Vector3
Array of 3D normals that define the mesh. Used only if flipBackwardFacingXCoordinate is true; if normals are not provided (null), they are computed from positions and indices.
planeNormalVector  Vector3
Vector that defines the plane normal (i.e., perpendicular to the plane's surface).
planeHeightVector  Vector3
Vector that defines the direction along the plane surface (i.e., along the Y direction of the 2D plane shape).
flipXCoordinate  Boolean  (Optional)
Invert/flip the X texture coordinate.
flipYCoordinate  Boolean  (Optional)
Invert/flip the Y texture coordinate.
flipBackwardFacingXCoordinate  Boolean  (Optional)
Invert/flip the X texture coordinate on positions with backwards-facing normals. This for example allows creating texture coordinates for displaying text that can be read on both sides of the object.

Return Value

Vector2
Array of generated texture coordinates.
See Also