scene

package
v0.0.0-...-534c38e Latest Latest
Warning

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

Go to latest
Published: Aug 6, 2022 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultWorldLight

func DefaultWorldLight() object.PointLight

func Intersect

func Intersect(w World, r ray.Ray) (intersections object.Intersections)

func ReflectedColor

func ReflectedColor(w World, comps Computation, remaining int) object.RGB

func RefractedColor

func RefractedColor(w World, comps Computation, remaining int) object.RGB

func Schlick

func Schlick(comps Computation) float64

func ShadeHit

func ShadeHit(w World, comps Computation, remaining int) object.RGB

Types

type Camera

type Camera interface {
	HSize() int
	VSize() int
	Origin() ray.Vector
	PixelSize() float64
	FocalLength() float64
	RayForPixel(nx, ny float64) ray.Ray
	FieldOfView() float64
	SetTransform(by ray.Matrix) error
}

func NewBasicCamera

func NewBasicCamera(hSize, vSize int, fieldOfView float64) (c Camera, err error)

func NewCamera

func NewCamera(hSize, vSize int, from, to, vup ray.Vector) (c Camera, err error)

type Canvas

type Canvas [][]object.RGB

func MultiThreadedRender

func MultiThreadedRender(c Camera, w World, noOfWorkers, queueSize int) Canvas

func NewCanvas

func NewCanvas(width, height int) (c Canvas)

func Render

func Render(c Camera, w World) Canvas

func (Canvas) GenerateImg

func (c Canvas) GenerateImg() (img *image.RGBA)

func (Canvas) Get

func (c Canvas) Get(x, y int) object.RGB

func (Canvas) Set

func (c Canvas) Set(x, y int, red, green, blue float64)

func (Canvas) SetColor

func (c Canvas) SetColor(x, y int, col object.RGB)

type Computation

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

func PrepareComputations

func PrepareComputations(i object.Intersection, r ray.Ray, xs ...object.Intersection) (comps Computation)

func (Computation) Eyev

func (c Computation) Eyev() ray.Vector

func (Computation) Inside

func (c Computation) Inside() bool

func (Computation) Intersect

func (c Computation) Intersect() float64

func (Computation) N1

func (c Computation) N1() float64

func (Computation) N2

func (c Computation) N2() float64

func (Computation) Normalv

func (c Computation) Normalv() ray.Vector

func (Computation) Object

func (c Computation) Object() object.Object

func (Computation) OverPoint

func (c Computation) OverPoint() ray.Vector

func (Computation) Point

func (c Computation) Point() ray.Vector

func (Computation) Reflectv

func (c Computation) Reflectv() ray.Vector

func (Computation) UnderPoint

func (c Computation) UnderPoint() ray.Vector

type World

type World interface {
	Objects() []object.Object
	AddObject(obj object.Object)
	AddObjects(objs ...object.Object)
	Light() object.PointLight
	AddLight(light object.PointLight)
	ColorAt(r ray.Ray, remaining int) object.RGB
	IsShadowed(point ray.Vector) bool
}

func DefaultWorld

func DefaultWorld() (w World, err error)

func DefaultWorldWithGroups

func DefaultWorldWithGroups() (w World, err error)

func NewWorld

func NewWorld() World

func TwoSphereWorld

func TwoSphereWorld() World

Jump to

Keyboard shortcuts

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