Click or drag to resize
AB4D logo

WpfGeometryModel3DNodeSortTrianglesByCameraDistance Method

SortTrianglesByCameraDistance method sorts the triangle indices so that the triangles are sorted by camera distance - triangles that are farther away are rendered first. When the objects' world transformation is usually changed, then it is recommended to call this method with transformCamera parameter set to true. This transforms the camera's position by inverted world matrix and does not require to transform all positions. When objects' world transformation is not changed, then it is recommended to set transformCamera to false. This transforms all positions by world transform once and does not require to calculate the inverted world matrix.

Namespace: Ab3d.DirectX.Models
Assembly: Ab3d.DXEngine.Wpf (in Ab3d.DXEngine.Wpf.dll) Version: 7.0.8865.1045
Syntax
C#
public bool SortTrianglesByCameraDistance(
	Vector3 cameraPosition,
	bool transformCamera,
	bool useDynamicIndexBuffer = true
)

Parameters

cameraPosition  Vector3
position of the camera
transformCamera  Boolean
when true, then the camera's position is transformed by inverted world matrix (recommended when object's world transform is changing); when false the original camera position is used but all the positions are transformed by the world transform (recommended when the object's world transform is not changing)
useDynamicIndexBuffer  Boolean  (Optional)
when true then a dynamic index buffer is used for the mesh (true by default)

Return Value

Boolean
true if triangle indices array way changed
See Also