Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var (
// A split scoring strategy that uses the surface area heuristic (SAH).
SurfaceAreaHeuristic = surfaceAreaHeuristic{}
)
Functions ¶
func Build ¶
func Build(workList []BoundedVolume, minLeafItems int, leafCb LeafCallback, scoreStrategy ScoreStrategy) []scene.BvhNode
Construct a BVH from a set of bounded volumes.
The builder uses SAH for scoring splits: score = num_polygons * node bbox face area.
The minLeafItems param should be used to specified the minimum number of items that can form a leaf. The BVH builder will automatically generate leafs if the incoming work length is <= minLeafItems.
Types ¶
type BoundedVolume ¶
The BoundedVolume interface is implemented by all meshes/primitives that can be partitioned by the bvh builder.
type LeafCallback ¶
type LeafCallback func(leaf *scene.BvhNode, itemList []BoundedVolume)
A callback that is called whenever the BVH builder creates a new leaf.
type ScoreStrategy ¶
type ScoreStrategy interface { // Calculate a score for splitting workList at splitPoint along a particular Axis. ScoreSplit(workList []BoundedVolume, splitAxis Axis, splitPoint float32) (leftCount, rightCount int, score float32) // Calculate a score for all items in workList. ScorePartition(workList []BoundedVolume) (score float32) }
A split scoring strategy.
Click to show internal directories.
Click to hide internal directories.