Documentation ¶
Index ¶
Constants ¶
View Source
const MAX_OCTREE_DEPTH = 2
View Source
const MAX_SPHERES_PER_CONTAINER = 64
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ObjectContainer ¶
type ObjectContainer struct { // Cache-friendly list of sphere intersection data SphereInfos [MAX_SPHERES_PER_CONTAINER]scene.SphereIntersectionInfo // Less frequently accessed sphere data. This is assumed to have the // same length and order as SphereInfos, so that the remaining sphere // data corresponding to a certain intersection info can be retrieved using // an index into SphereInfos SphereRemainders []*scene.TraceableBase // Non-spheres (not optimized) Objects []*scene.Traceable }
Back end for spatial data structures: A flat list of traceables, that allows checking against rays. When used directly as tracing Engine, you get the classic "naive ray tracing" algorithm.
func (*ObjectContainer) FindClosestObject ¶
func (*ObjectContainer) FindOccluder ¶
func (self *ObjectContainer) FindOccluder(ray *scene.Ray, lightDistance float32) bool
func (*ObjectContainer) Insert ¶
func (self *ObjectContainer) Insert(object *scene.Traceable)
type Octree ¶
type Octree struct {
Root OctreeNode
}
A very naive and unoptimized Octree. This actually uses an AABB per node - normally you wouldn't do that, since there are Octree-specific ray intersection testing/walking algorithms. The placement heuristics are also super simple and not tweaked at all.
I'm planning to replace this with a Kd-Tree anyway
func MakeOctree ¶
func (*Octree) FindClosestObject ¶
func (*Octree) FindOccluder ¶
func (*Octree) InsertObject ¶
type OctreeNode ¶
type OctreeNode struct { Bounds scene.AABB Children [8]*OctreeNode Objects *ObjectContainer // contains filtered or unexported fields }
func MakeNode ¶
func MakeNode(bounds scene.AABB) *OctreeNode
func (*OctreeNode) AddObject ¶
func (self *OctreeNode) AddObject(object *scene.Traceable)
func (*OctreeNode) IsLeaf ¶
func (self *OctreeNode) IsLeaf() bool
func (*OctreeNode) Split ¶
func (self *OctreeNode) Split()
Click to show internal directories.
Click to hide internal directories.