Documentation ¶
Index ¶
- Variables
- func Lighting(shape shapes.Shape, light PointLight, ...) patterns.RGB
- func ParseInts(value_string string) []int64
- func ParseObjFile(filename string, smooth bool, mats map[string]patterns.Material) *parsed_obj
- type Camera
- type Computations
- type PointLight
- type World
- func (w *World) AddLight(light PointLight)
- func (w *World) AddObject(shape shapes.Shape)
- func (w World) ColorAt(ray primitives.Ray, remaining int) patterns.RGB
- func (w World) Intersect(ray primitives.Ray) shapes.Intersections
- func (w World) ReflectedColor(comps Computations, remaining int) patterns.RGB
- func (w World) RefractedColor(comps Computations, remaining int) patterns.RGB
- func (w *World) SetBackground(color patterns.RGB)
Constants ¶
This section is empty.
Variables ¶
var Default_name string = "DEFAULT"
Functions ¶
func Lighting ¶
func Lighting(shape shapes.Shape, light PointLight, point, eyeVector, normalVector primitives.PV, shade float64) patterns.RGB
Lighting Basic lighting calculation function
Types ¶
type Camera ¶
type Camera struct {
// contains filtered or unexported fields
}
Camera Camera object to determine the view of the render
func MakeCamera ¶
MakeCamera Create a camera object from the width, height, and field of view
func (Camera) RayForPixel ¶
func (c Camera) RayForPixel(x, y uint64) primitives.Ray
RayForPixel Calculate the ray for the given x, y coordinates
func (*Camera) ViewTransform ¶
func (c *Camera) ViewTransform(from, to, up primitives.PV)
ViewTransform Create a view transformation matrix for camera usage
type Computations ¶
type Computations struct { shapes.Intersection Point, OverPoint, UnderPoint, EyeVector, NormalVector, ReflectVector primitives.PV Index1, Index2 float64 Inside bool }
Computations Set of pre-computed values used for point detection
func PrepareComputations ¶
func PrepareComputations(i shapes.Intersection, ray primitives.Ray, xs shapes.Intersections) Computations
PrepareComputations Calculates the vectors at the point on the object
func (Computations) Schlick ¶
func (c Computations) Schlick() float64
Schlick Calculate an approximation of the Fresnel effect
type PointLight ¶
type PointLight struct { Intensity *patterns.RGB Position primitives.PV }
PointLight Basic light object a specific point
type World ¶
type World struct {
// contains filtered or unexported fields
}
World Container for objects
func (*World) AddLight ¶
func (w *World) AddLight(light PointLight)
AddLight Add a light object to the world
func (World) Intersect ¶
func (w World) Intersect(ray primitives.Ray) shapes.Intersections
Intersect Calculate the intersections from the ray to world objects
func (World) ReflectedColor ¶
func (w World) ReflectedColor(comps Computations, remaining int) patterns.RGB
ReflectedColor Calculate the color of the reflected ray
func (World) RefractedColor ¶
func (w World) RefractedColor(comps Computations, remaining int) patterns.RGB
RefractedColor Calculate the color of the refracted ray
func (*World) SetBackground ¶
SetBackground Set the background color