components

package
v0.15.5 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2022 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func ParseInts added in v0.15.5

func ParseInts(value_string string) []int64

Parse up to three values separated by a /

func ParseObjFile added in v0.15.5

func ParseObjFile(filename string, smooth bool, mats map[string]patterns.Material) *parsed_obj

Parse vertices and triangles from Wavefront OBJ file

Types

type Camera

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

Camera Camera object to determine the view of the render

func MakeCamera

func MakeCamera(width, height uint64, fieldOfView float64) *Camera

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 MakeWorld

func MakeWorld() *World

MakeWorld Make an empty world and a black background

func (*World) AddLight

func (w *World) AddLight(light PointLight)

AddLight Add a light object to the world

func (*World) AddObject

func (w *World) AddObject(shape shapes.Shape)

AddObject Add a shape object to the world

func (World) ColorAt

func (w World) ColorAt(ray primitives.Ray, remaining int) patterns.RGB

ColorAt Calculate the color of a possible intersection hit

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

func (w *World) SetBackground(color patterns.RGB)

SetBackground Set the background color

Jump to

Keyboard shortcuts

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