world

package
Version: v0.0.0-...-1b60a0e Latest Latest
Warning

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

Go to latest
Published: Nov 2, 2019 License: MIT Imports: 8 Imported by: 0

Documentation

Overview

Package world represents a collection of all Objects that make up a scene.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ColorAt

func ColorAt(w *World, r *ray.Ray) (*color.Color, error)

ColorAt intersects the given ray with the given world and returns the color at the resulting intersection.

func IsShadowed

func IsShadowed(world *World, pt *point.Point) bool

IsShadowed returns true if the passed point lies in the shadow of an object in the passed world.

func RayWorldIntersect

func RayWorldIntersect(r *ray.Ray, w *World) []*ray.Intersection

RayWorldIntersect intersects the passed ray with the passed world.

func ShadeHit

func ShadeHit(w *World, comps *ray.IntersectionComputations) *color.Color

ShadeHit returns the color at the intersection encapsulated by an intersections computations.

Types

type World

type World struct {
	Objects []*sphere.Sphere
	Light   *light.PointLight
}

World represents a collection of all Objects that make up a scene.

func NewDefaultWorld

func NewDefaultWorld() *World

NewDefaultWorld returns a new default world, which contains two spheres and a point light source.

func NewWorld

func NewWorld() *World

NewWorld returns a new World.

Source Files

Jump to

Keyboard shortcuts

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