bsort

package
v0.0.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 31, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewLayerForScene

func NewLayerForScene(scene *seen.Scene) layer.Layer

NewLayerForScene returns the splitting-BSP layer: exact painter's order from ANY eye, with polygons that straddle a partition plane cut into pieces at build time. The tree is world-space and rebuilt only when world geometry changes, so its build cost amortises across camera motion — which makes this the layer for STATIC geometry under a moving eye. For per-frame dynamic geometry (noise fields, mocap) use layer/nsort, which orders for the current eye and cuts only on genuine occlusion cycles.

Types

type Layer

type Layer struct {
	// contains filtered or unexported fields
}

Layer implements the layer.Layer interface.

func (*Layer) RenderOn

func (s *Layer) RenderOn(canvas canvas.Canvas)

RenderOn renders all faces that are part of the shapes and objects in the scene on to the given canvas

type Planes

type Planes []bsp.Plane

func (Planes) EnterGroup

func (b Planes) EnterGroup()

func (Planes) LeaveGroup

func (b Planes) LeaveGroup()

func (Planes) VisitLight

func (b Planes) VisitLight(light seen.Light, model matrix.Matrix)

func (*Planes) VisitObject

func (b *Planes) VisitObject(object seen.Object, model matrix.Matrix)

type Shader

type Shader struct {
	Cache ShaderCache
	// contains filtered or unexported fields
}

func NewShader

func NewShader(cache ShaderCache) *Shader

func (*Shader) EnterGroup

func (v *Shader) EnterGroup()

func (*Shader) LeaveGroup

func (v *Shader) LeaveGroup()

func (*Shader) Shade

func (shader *Shader) Shade(scene *seen.Scene, projection, viewport matrix.Matrix) (updated, world bool)

Shade updates the cache for every face in the scene. updated reports any change at all (including projection/viewport-only changes); world reports changes to world-space geometry — a face new to the cache, marked Dirty, or moved by its model transform. Consumers that derive world-space structures (the bsort BSP tree is built from world-space planes) should rebuild on world only: a camera or viewport change alone moves no plane.

func (*Shader) VisitLight

func (v *Shader) VisitLight(l seen.Light, model matrix.Matrix)

func (*Shader) VisitObject

func (v *Shader) VisitObject(object seen.Object, model matrix.Matrix)

type ShaderCache

type ShaderCache map[int]ShaderFragment

type ShaderFragment

type ShaderFragment struct {
	face.Coordinates
	Fill   *color.Color
	Stroke *color.Color
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL