rayengine

package
v0.0.0-...-92036ad Latest Latest
Warning

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

Go to latest
Published: Sep 24, 2022 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const EPSILON = 0.000000001

EPSILON constant for checking if two float numbers are the same

Variables

This section is empty.

Functions

func AvailableWorlds

func AvailableWorlds() []string

AvailableWorlds returns presets with scenes

func InCloseRange

func InCloseRange(a, b float64) bool

InCloseRange checks if two numbers are identical, for floating-point computations

Types

type Box

type Box struct {
	Min, Max *Vec
	Faces    hitlist
}

Box holds dimmensions and list of faces

func NewBox

func NewBox(p0, p1 *Vec, m material) *Box

NewBox returns box bounded by two points, p0 and p1

type Camera

type Camera struct {
	LowerLeftCorner *Vec
	Horizontal      *Vec
	Vertical        *Vec
	Origin          *Vec
	U, V, W         *Vec
	LensRadius      float64
	Time0, Time1    float64
}

Camera describes properties of virtual camera which be used as parameters for rendering process

func NewCamera

func NewCamera(lookfrom, lookat, vup *Vec, vfov, aspect, aperture, focusDist, t0, t1 float64) Camera

NewCamera prepares instance of object describing viewport and rendering properties

type RotateY

type RotateY struct {
	Obj                hitable
	SinTheta, CosTheta float64
	HasBox             bool
	Box                *aabb
}

RotateY holds reference to original object along precomputed parameters for computing rotation

func NewRotateY

func NewRotateY(obj hitable, angle float64) *RotateY

NewRotateY returns object containing original object rotated by 'angle' over y axis at center of object's bounding box

type Vec

type Vec [3]float64

Vec is a vector with implemented main math ops, both mutable and unmutable

func ComputeXY

func ComputeXY(randSource *rand.Rand, w *World, x, y, nx, ny, ns uint) *Vec

ComputeXY returns color at (X, Y) position of camera plane, computed ns times and averaged

func (*Vec) AddSI

func (v *Vec) AddSI(a float64) *Vec

AddSI adds scalar to each dimmension, returns result in a new object

func (*Vec) AddSM

func (v *Vec) AddSM(a float64) *Vec

AddSM adds scalar to vector in place, returns reference to original object

func (*Vec) AddVI

func (v *Vec) AddVI(v2 *Vec) *Vec

AddVI adds vector to vector, returns result in a new object

func (*Vec) AddVM

func (v *Vec) AddVM(v2 *Vec) *Vec

AddVM adds vector to vector in place, returns reference to original object

func (*Vec) Copy

func (v *Vec) Copy() *Vec

Copy returns new copy of existing Vec

func (*Vec) CrossI

func (v *Vec) CrossI(v2 *Vec) *Vec

CrossI returns cross product of two vectors, returns result in a new object

func (*Vec) DivSM

func (v *Vec) DivSM(a float64) *Vec

DivSM divides each dimmension by scalar in place, returns reference to original object

func (*Vec) Dot

func (v *Vec) Dot(v2 *Vec) float64

Dot returns dot product of two vectors

func (*Vec) Len

func (v *Vec) Len() float64

Len returns lenght of vector

func (*Vec) LenSQ

func (v *Vec) LenSQ() float64

LenSQ return length of vector ^ 2

func (*Vec) MulSI

func (v *Vec) MulSI(a float64) *Vec

MulSI multiplies vector by scalar, returns result in a new object

func (*Vec) MulSM

func (v *Vec) MulSM(a float64) *Vec

MulSM multiplies vector by scalar in place, returns reference to original object

func (*Vec) NegI

func (v *Vec) NegI() *Vec

NegI multiplies each dimmension by -1, returns result in a new object

func (*Vec) NegM

func (v *Vec) NegM() *Vec

NegM multiplies each dimmension by -1 in place, returns reference to original object

func (*Vec) Normalize

func (v *Vec) Normalize() *Vec

Normalize normalizes the vector in place, returns reference to original object

func (*Vec) NormalizeI

func (v *Vec) NormalizeI() *Vec

NormalizeI normalizes vector, returns result in a new object

func (*Vec) SubSI

func (v *Vec) SubSI(a float64) *Vec

SubSI subtracts scalar from each dimmension, returns result in a new object

func (*Vec) SubSM

func (v *Vec) SubSM(a float64) *Vec

SubSM subtracts scalar from each dimmension in place, returns reference to original object

func (*Vec) SubVI

func (v *Vec) SubVI(v2 *Vec) *Vec

SubVI performs vector subtraction, returns result in a new object

func (*Vec) SubVM

func (v *Vec) SubVM(v2 *Vec) *Vec

SubVM performs vector subtraction in place, returns reference to original object

type World

type World struct {
	Cam  Camera
	Objs hitlist
}

World holds camera parameters and list of objects

func NewWorld

func NewWorld(preset string, nx, ny float64) *World

NewWorld creates world with camera and objects from preset

Jump to

Keyboard shortcuts

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