tracer

package
v0.0.0-...-e996cf0 Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2020 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hit

func Hit(intersections []shapes.Intersection) (shapes.Intersection, bool)

Hit finds the first intersection with a positive T (the passed intersections are assumed to have been sorted already)

func NormalAt

func NormalAt(s shapes.Shape, worldPoint geom.Tuple4, intersection *shapes.Intersection) geom.Tuple4

func NormalAtPtr

func NormalAtPtr(s shapes.Shape, worldPoint geom.Tuple4, intersection *shapes.Intersection, localPoint *geom.Tuple4) geom.Tuple4

func NormalToWorld

func NormalToWorld(shape shapes.Shape, normal geom.Tuple4) geom.Tuple4

func NormalToWorldPtr

func NormalToWorldPtr(shape shapes.Shape, normal *geom.Tuple4)

func Position

func Position(r geom.Ray, distance float64) geom.Tuple4

Position multiplies direction of ray with the passed distance and adds the result onto the origin. Used for finding the position along a ray.

func PositionPtr

func PositionPtr(r geom.Ray, distance float64, out *geom.Tuple4)

func PrepareComputationForIntersectionPtr

func PrepareComputationForIntersectionPtr(i shapes.Intersection, r geom.Ray, comps *Computation, xs ...shapes.Intersection)

func RandHemi

func RandHemi(normalVec geom.Tuple4, rnd *rand.Rand) geom.Tuple4

Also from Hunter Loftis pathtracer. This one produces a similar, but definitely darker result than the one I'm using from https://raytracey.blogspot.com/2016/11/opencl-path-tracing-tutorial-2-path.html.

func Reflect

func Reflect(vec geom.Tuple4, normal geom.Tuple4) geom.Tuple4

in - normal * 2 * dot(in, normal)

func ReflectPtr

func ReflectPtr(vec geom.Tuple4, normal geom.Tuple4, out *geom.Tuple4)

in - normal * 2 * dot(in, normal)

func Schlick

func Schlick(comps Computation) float64

func TransformRay

func TransformRay(r geom.Ray, m1 geom.Mat4x4) geom.Ray

func TransformRayPtr

func TransformRayPtr(r geom.Ray, m1 geom.Mat4x4, out *geom.Ray)

func WorldToObject

func WorldToObject(shape shapes.Shape, point geom.Tuple4) geom.Tuple4

func WorldToObjectPtr

func WorldToObjectPtr(shape shapes.Shape, point geom.Tuple4, out *geom.Tuple4)

Types

type Computation

type Computation struct {
	T          float64
	Object     shapes.Shape
	Point      geom.Tuple4
	EyeVec     geom.Tuple4
	NormalVec  geom.Tuple4
	Inside     bool
	OverPoint  geom.Tuple4
	UnderPoint geom.Tuple4
	ReflectVec geom.Tuple4
	N1         float64
	N2         float64
	// contains filtered or unexported fields
}

func NewComputation

func NewComputation() Computation

type Ctx

type Ctx struct {
	Id int
	// contains filtered or unexported fields
}

func NewCtx

func NewCtx(id int, scene *scenes.Scene, canvas *canvas2.Canvas, jobsChan chan *job, wg *sync.WaitGroup) *Ctx

type LightData

type LightData struct {
	//Ambient        Tuple4
	//Diffuse        Tuple4
	//Specular       Tuple4
	//EffectiveColor Tuple4
	LightVec   geom.Tuple4
	ReflectVec geom.Tuple4
}

LightData is used for pre-allocated memory for lighting computations.

func NewLightData

func NewLightData() LightData

type PathTracer

type PathTracer struct {
}

func NewPathTracer

func NewPathTracer() *PathTracer

func (*PathTracer) Render

func (t *PathTracer) Render(sceneFactory func() *scenes.Scene)

Jump to

Keyboard shortcuts

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