core

package
v0.0.0-...-7e8cd7c Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2014 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const EPSILON = 0.0001

Variables

This section is empty.

Functions

This section is empty.

Types

type Canvas

type Canvas struct {
	Width  int
	Height int
	// contains filtered or unexported fields
}

func NewCanvas

func NewCanvas(width, height int) *Canvas

func (*Canvas) Export

func (canvas *Canvas) Export() error

func (*Canvas) SetPixel

func (canvas *Canvas) SetPixel(x, y int, c ColourRGB)

func (*Canvas) SetPixelRGB

func (canvas *Canvas) SetPixelRGB(x, y int, r, g, b uint8)

type ColourRGB

type ColourRGB struct {
	R, G, B float64
}

func NewColourRGB

func NewColourRGB(r, g, b float64) ColourRGB

func (*ColourRGB) AddTo

func (c1 *ColourRGB) AddTo(c2 ColourRGB)

func (ColourRGB) Mul

func (c1 ColourRGB) Mul(c2 ColourRGB) ColourRGB

func (ColourRGB) MulScalar

func (c ColourRGB) MulScalar(s float64) ColourRGB

func (*ColourRGB) Set

func (c *ColourRGB) Set(r, g, b float64)

type Material

type Material struct {
	Name            string
	Colour          ColourRGB
	Reflection      float64
	Refraction      float64
	RefractiveIndex float64
	Diffuse         float64
	Specular        float64
}

func NewMaterial

func NewMaterial(colour ColourRGB, reflection, refraction, refractiveIndex, diffuse, specular float64) *Material

func NewMaterialBlank

func NewMaterialBlank() *Material

type Plane

type Plane struct {
	Normal Vec3
	D      float64
}

func NewPlane

func NewPlane(normal Vec3, d float64) *Plane

type Ray

type Ray struct {
	Origin Vec3
	Dir    Vec3
	Depth  int
}

func NewRay

func NewRay(origin, dir Vec3) Ray

func NewRayWithDepth

func NewRayWithDepth(origin, dir Vec3, depth int) Ray

type Sphere

type Sphere struct {
	Centre      Vec3
	Radius      float64
	RadiusSq    float64
	RadiusRecip float64
}

func NewSphere

func NewSphere(centre Vec3, radius float64) *Sphere

type Textures

type Textures map[string]image.Image

func NewTextures

func NewTextures() Textures

func (Textures) Fetch

func (textures Textures) Fetch(path string) (texture image.Image, err error)

type Vec2

type Vec2 struct {
	X, Y float64
}

func NewVec2

func NewVec2(x, y float64) Vec2

func NewVec2Zero

func NewVec2Zero() Vec2

func (Vec2) Add

func (v1 Vec2) Add(v2 Vec2) Vec2

func (Vec2) Div

func (v1 Vec2) Div(v2 Vec2) Vec2

func (Vec2) DivScalar

func (v1 Vec2) DivScalar(s float64) Vec2

func (Vec2) Length

func (v Vec2) Length() float64

func (Vec2) Mul

func (v1 Vec2) Mul(v2 Vec2) Vec2

func (Vec2) MulScalar

func (v1 Vec2) MulScalar(s float64) Vec2

func (Vec2) Sub

func (v1 Vec2) Sub(v2 Vec2) Vec2

type Vec3

type Vec3 struct {
	X, Y, Z float64
}

func NewVec3

func NewVec3(x, y, z float64) Vec3

func NewVec3Zero

func NewVec3Zero() Vec3

func (Vec3) Add

func (v1 Vec3) Add(v2 Vec3) Vec3

func (Vec3) Cross

func (v1 Vec3) Cross(v2 Vec3) (v3 Vec3)

func (Vec3) Div

func (v1 Vec3) Div(v2 Vec3) Vec3

func (Vec3) DivScalar

func (v1 Vec3) DivScalar(s float64) Vec3

func (Vec3) Dot

func (v1 Vec3) Dot(v2 Vec3) float64

func (Vec3) Length

func (v Vec3) Length() float64

func (Vec3) Mul

func (v1 Vec3) Mul(v2 Vec3) Vec3

func (Vec3) MulScalar

func (v1 Vec3) MulScalar(s float64) Vec3

func (Vec3) Normal

func (v Vec3) Normal() Vec3

func (Vec3) NormalWithLength

func (v Vec3) NormalWithLength() (normal Vec3, originalLength float64)

func (Vec3) Sub

func (v1 Vec3) Sub(v2 Vec3) Vec3

Jump to

Keyboard shortcuts

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