zbuf

package
v0.0.0-...-9c88ebf Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2022 License: BSD-3-Clause Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Scan

Types

type Camera

type Camera struct {
	Near, Far float64
	*scene.Camera
}

func (*Camera) Perspective

func (c *Camera) Perspective() *d3.T

func (*Camera) T

func (c *Camera) T() *d3.T

type Context

type Context struct {
	*Frame
	*TriangleRef
	barycentric.B
}

type Frame

type Frame struct {
	*scene.Frame
	*ZBufFrame
	CameraMeshes [][]d3.Pt
}

func (*Frame) PopulateCameraMeshes

func (f *Frame) PopulateCameraMeshes()

func (*Frame) PopulateShaders

func (f *Frame) PopulateShaders()

type MaterialWrapper

type MaterialWrapper struct {
	material.Material
}

func (*MaterialWrapper) ZBufShader

func (m *MaterialWrapper) ZBufShader(ctx *Context) *color.RGBA

type Scene

type Scene struct {
	*scene.Scene
	*ZBufFrame
	// ImageScale will render the image larger than the final size then scale it
	// down. This helps eliminate artifacts.
	ImageScale float64
	// contains filtered or unexported fields
}

func (*Scene) Frame

func (s *Scene) Frame(idx int, img image.Image) (image.Image, error)

type Shader

type Shader func(ctx *Context) *color.RGBA

type TriangleRef

type TriangleRef struct {
	scene.TriangleIndex
	Space, Camera   *triangle.Triangle
	NSpace, NCamera d3.V
	BSpace, BCamera *triangle.BT
	Orgin, U        int
}

TriangleRef is a reference to a triangle in the scene. The MeshIdx, PolygonIdx and TriangleIdx provide the indexes to pull the value out of a SceneFrame. Space represents the triangle in scene space and Camera represents the triangle in Camera space (after the camera transform). NSpace and NCamera provide the respective normals.

type ZBufFrame

type ZBufFrame struct {
	Near, Far  float64
	Background color.RGBA
	Shaders    []Shader
}

type ZBufShader

type ZBufShader interface {
	ZBufShader(ctx *Context) *color.RGBA
}

type ZBuffer

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

func New

func New(w, h int) *ZBuffer

func (*ZBuffer) Draw

func (buf *ZBuffer) Draw(f *Frame, img *image.RGBA) *image.RGBA

Jump to

Keyboard shortcuts

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