api

package
v0.0.0-...-405cb25 Latest Latest
Warning

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

Go to latest
Published: Feb 8, 2020 License: GPL-3.0 Imports: 32 Imported by: 0

Documentation

Overview

Package api provides a high-level API for defining BruteRay scenes. This is the only package users usually need to interact with.

Index

Constants

View Source
const (
	Pi  = math.Pi
	Deg = geom.Deg
	X   = geom.X
	Y   = geom.Y
	Z   = geom.Z
)
View Source
const SpecMaxDebugNormals = 2

Variables

View Source
var (
	And = objects.And
	Not = objects.Not

	Black   = colorf.Black
	Blue    = colorf.Blue
	Cyan    = colorf.Cyan
	Gray    = colorf.Gray
	Green   = colorf.Green
	Magenta = colorf.Magenta
	Red     = colorf.Red
	White   = colorf.White
	Yellow  = colorf.Yellow

	RectangleLight = lights.RectangleLight
	PointLight     = lights.PointLight
	DiskLight      = lights.DiskLight
	SunLight       = lights.SunLight

	Matte          = materials.Matte
	Reflective     = materials.Reflective
	Refractive     = materials.Refractive
	Transparent    = materials.Transparent
	Flat           = materials.Flat
	Shiny          = materials.Shiny
	Blend          = materials.Blend
	BlendMap       = materials.BlendMap
	ReflectFresnel = materials.ReflectFresnel

	ExpFog = media.ExpFog
	Fog    = media.Fog

	Ex = geom.Ex
	Ey = geom.Ey
	Ez = geom.Ez
	O  = geom.O
)
View Source
var (
	Projective         = cameras.Projective
	ProjectiveAperture = cameras.ProjectiveAperture
	EnvironmentMap     = cameras.EnvironmentMap
)
View Source
var (
	JPEGQuality = 90
)

Functions

func Animate

func Animate(numFrame int, f func(frame int) Spec)

func Render

func Render(spec Spec)

func Serve

func Serve(addr string, spec Spec) error

Types

type Color

type Color = colorf.Color

func C

func C(r, g, b float64) Color

type Light

type Light = tracer.Light

type Material

type Material = tracer.Material

type Medium

type Medium = tracer.Medium

type Object

type Object struct {
	Interface objects.Interface
}

func Backdrop

func Backdrop(m Material) Object

func Bounded

func Bounded(orig Object) Object

func Box

func Box(m Material, dx, dy, dz float64, center Vec) Object

func BoxWithBounds

func BoxWithBounds(m Material, min, max Vec) Object

func Cylinder

func Cylinder(m Material, diam, height float64, center Vec) Object

func CylinderWithCaps

func CylinderWithCaps(m Material, diam, height float64, center Vec) Object

func CylinderX

func CylinderX(m Material, diam, height float64, center Vec) Object

func CylinderZ

func CylinderZ(m Material, diam, height float64, center Vec) Object

func Difference

func Difference(a, b Object) Object

func IsoSurface

func IsoSurface(m Material, dx, dy, dz float64, f func(u, v float64) float64) Object

func ObjFile

func ObjFile(m map[string]Material, file string, transf ...*geom.AffineTransform) Object

func Parametric

func Parametric(m Material, numU, numV int, f func(u, v float64) Vec) Object

func PlyFile

func PlyFile(m Material, file string, transf ...*geom.AffineTransform) Object

func Rectangle

func Rectangle(m Material, dx, dz float64, center Vec) Object

func RectangleWithVertices

func RectangleWithVertices(m Material, o, a, b Vec) Object

func Sphere

func Sphere(m Material, diam float64, center Vec) Object

func Tree

func Tree(children ...Object) Object

func (Object) And

func (o Object) And(b Object) Object

func (Object) AndNot

func (o Object) AndNot(b Object) Object

func (Object) Bounds

func (o Object) Bounds() objects.BoundingBox

func (Object) Center

func (o Object) Center() Vec

func (Object) CenterBack

func (o Object) CenterBack() Vec

func (Object) CenterBottom

func (o Object) CenterBottom() Vec

func (Object) CenterFront

func (o Object) CenterFront() Vec

func (Object) CenterTop

func (o Object) CenterTop() Vec

func (Object) Or

func (o Object) Or(b Object) Object

func (Object) Remap

func (o Object) Remap(f func(Vec) Vec) Object

func (Object) Remove

func (o Object) Remove(b Object) Object

func (Object) Restrict

func (o Object) Restrict(bounds Object) Object

func (Object) Rotate

func (o Object) Rotate(axis Vec, radians float64) Object

func (Object) RotateAt

func (o Object) RotateAt(center Vec, axis Vec, radians float64) Object

func (Object) Scale

func (o Object) Scale(s float64) Object

func (Object) ScaleAt

func (o Object) ScaleAt(center Vec, s float64) Object

func (Object) ScaleToSize

func (o Object) ScaleToSize(maxSize float64) Object

func (Object) Transform

func (o Object) Transform(tr *geom.AffineTransform) Object

func (Object) Translate

func (o Object) Translate(delta Vec) Object

func (Object) WithCenter

func (o Object) WithCenter(pos Vec) Object

func (Object) WithCenterBottom

func (o Object) WithCenterBottom(pos Vec) Object

func (Object) WithMaterial

func (o Object) WithMaterial(m Material) Object

type Spec

type Spec struct {
	Lights  []Light
	Objects []Object
	Media   []Medium
	Camera  tracer.Camera

	Recursion int
	NumPass   int

	Width  int
	Height int

	DebugNormals      int
	DebugIsometricFOV float64
	DebugIsometricDir int

	PostProcess post.Params
}

A Spec specifies a BruteRay scene. Usage:

Render(Spec{
	...
})

func (*Spec) ImageFunc

func (s *Spec) ImageFunc() tracer.ImageFunc

TODO: this should honour DebugNormals, etc, not InitDefaults

func (*Spec) InitDefaults

func (s *Spec) InitDefaults()

TODO: remove!!!! aargh

func (*Spec) Scene

func (s *Spec) Scene() *tracer.Scene

type Texture

type Texture struct {
	texture.Texture
}

func LoadHeightMap

func LoadHeightMap(file string) Texture

func LoadTexture

func LoadTexture(file string) Texture

func (Texture) HeightMap

func (t Texture) HeightMap() func(u, v float64) float64

func (Texture) Scale

func (t Texture) Scale(scaleU, scaleV float64) Texture

type Vec

type Vec = geom.Vec

func V

func V(x, y, z float64) Vec

type View

type View struct {
	Width             int
	Height            int
	AntiAlias         bool
	CamPos            Vec
	CamYaw            float64
	CamPitch          float64
	DebugNormals      int
	DebugIsometric    bool
	DebugIsometricFOV float64
	DebugIsometricDir int
}

TODO: embed in spec TODO: rename spec.Camera -> spec.CameraType

func (*View) ApplyTo

func (v *View) ApplyTo(s Spec) Spec

Jump to

Keyboard shortcuts

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