Click or drag to resize
Ab4d.SharpEngine logo

TriangleMeshTCreateOctree Method

CreateOctree returns a MeshOctree that is created from the mesh defined in this SimpleMesh. This method can be used when the type of the vertex buffer is PositionNormalTexture or Vector3 (only positions). When the type of the vertex buffer is PositionNormal or PositionTexture, then vertex data are copied into positions array and then Octree is created. Other types of vertex buffers are not supported and will generate an exception. Note: this method does not set the Octree property.

Namespace: Ab4d.SharpEngine.Meshes
Assembly: Ab4d.SharpEngine (in Ab4d.SharpEngine.dll) Version: 3.2.9386+3a404a3e1ebfa4efd231da7fe6f10dfb23b95dc4
Syntax
C#
public MeshOctree? CreateOctree(
	int maxNodeLevel = 4,
	float expandChildBoundingBoxes = 0,2f
)

Parameters

maxNodeLevel  Int32  (Optional)
Number of levels used for MeshOctree - bigger number reduces the number of triangles in each node but increased the MeshOctree initialization time and used memory. Default value is 4.
expandChildBoundingBoxes  Single  (Optional)
ExpandChildBoundingBoxes is a float that defined how much the bounding boxes of node overlap. By default, the value is set to 0.2 - so each bounding box is extended for 20% (but it does not go out of the parent's bounding box). This way the triangles that lay on node borders will be put into the child nodes instead of having them in the parent node (there we need to do a hit test every time).

Return Value

MeshOctree
created MeshOctree or null if octree cannot be created

Implements

IOctreeMeshCreateOctree(Int32, Single)
Remarks

CreateOctree returns a MeshOctree that is created from the mesh defined in this SimpleMesh.

This method can be used when the type of the vertex buffer is PositionNormalTexture or Vector3 (only positions). When the type of the vertex buffer is PositionNormal or PositionTexture, then vertex data are copied into positions array and then Octree is created. Other types of vertex buffers are not supported and will generate an exception.

Note: this method does not set the Octree property.

See Also