Documentation ¶
Index ¶
- Variables
- func Render(scene Scene, renderers []Renderer) chan image.Image
- func RenderSave(out string, scene Scene, renderers []Renderer)
- func RenderServeRPC(stop chan struct{}, port int) error
- func SavePNG(img image.Image, path string)
- type Camera
- type Color
- func (c Color) Add(c2 Color) Color
- func (c Color) Brightness() float64
- func (c Color) Div(c2 Color) Color
- func (c Color) Min(c2 Color) Color
- func (c Color) Mul(c2 Color) Color
- func (c Color) Opacity(a float64) color.RGBA
- func (c Color) RGBA() (uint32, uint32, uint32, uint32)
- func (c Color) Scale(t float64) Color
- type CompressedRaster
- type Dielectric
- type Diffuse
- type Emitter
- type Hit
- type Invisible
- type LocalRenderer
- type Material
- type Matrix44
- type Metallic
- type Nothing
- type Pixel
- type RPCRenderer
- type Random
- type Raster
- type Ray
- type RenderRPC
- type Renderer
- type SDF2
- type SDF3
- func Capsule(h, r1, r2 float64) SDF3
- func Cone(h, r float64) SDF3
- func Cube(x, y, z float64) SDF3
- func CubeR(x, y, z, r float64) SDF3
- func Cylinder(h, r float64) SDF3
- func CylinderR(h, r, ro float64) SDF3
- func Difference(items ...SDF3) SDF3
- func Distort(factor Vec3, sdf SDF3) SDF3
- func Ellipsoid(x, y, z float64) SDF3
- func Elongate(x, y, z float64, sdf SDF3) SDF3
- func Extrude(h float64, sdf SDF2) SDF3
- func GearWheel() SDF3
- func Hollow(thickness float64, sdf SDF3) SDF3
- func Intersection(items ...SDF3) SDF3
- func Mirror(mul Vec3, sdf SDF3) SDF3
- func MirrorX(sdf SDF3) SDF3
- func MirrorY(sdf SDF3) SDF3
- func MirrorZ(sdf SDF3) SDF3
- func Pyramid(h, w float64) SDF3
- func Repeat(cx, cy, cz, ox, oy, oz float64, sdf SDF3) SDF3
- func Revolve(o float64, sdf SDF2) SDF3
- func Rotate(v Vec3, deg float64, sdf SDF3) SDF3
- func RotateX(deg float64, sdf SDF3) SDF3
- func RotateY(deg float64, sdf SDF3) SDF3
- func RotateZ(deg float64, sdf SDF3) SDF3
- func Round(radius float64, sdf SDF3) SDF3
- func Scale(factor float64, sdf SDF3) SDF3
- func Sphere(r float64) SDF3
- func Torus(x, y float64) SDF3
- func Translate(v Vec3, sdf SDF3) SDF3
- func TranslateX(n float64, sdf SDF3) SDF3
- func TranslateY(n float64, sdf SDF3) SDF3
- func TranslateZ(n float64, sdf SDF3) SDF3
- func TriPrism(h, w float64) SDF3
- func Union(items ...SDF3) SDF3
- type SDFCircle
- type SDFCone
- type SDFCube
- type SDFDifference
- type SDFDistort
- type SDFEllipsoid
- type SDFElongate
- type SDFExtrude
- type SDFHexagram
- type SDFHollow
- type SDFIntersection
- type SDFMirror
- type SDFParabola
- type SDFPolygon
- type SDFRectangle
- type SDFRepeat
- type SDFRevolve
- type SDFRounded
- type SDFScale
- type SDFSphere
- type SDFStadium
- type SDFTorus
- type SDFTransform
- type SDFTriangle
- type SDFUnion
- type Scene
- type Thing
- type Vec2
- func (v Vec2) Abs() Vec2
- func (v Vec2) Add(v2 Vec2) Vec2
- func (v Vec2) Div(v2 Vec2) Vec2
- func (v1 Vec2) Dot(v2 Vec2) float64
- func (v Vec2) Length() float64
- func (v Vec2) Max(v1 Vec2) Vec2
- func (v Vec2) Min(v1 Vec2) Vec2
- func (v Vec2) Mul(v2 Vec2) Vec2
- func (v Vec2) Scale(t float64) Vec2
- func (v Vec2) Sub(v2 Vec2) Vec2
- func (v Vec2) Unit() Vec2
- type Vec3
- func (v Vec3) Abs() Vec3
- func (v Vec3) Add(v2 Vec3) Vec3
- func (v1 Vec3) Cross(v2 Vec3) Vec3
- func (v Vec3) Div(v2 Vec3) Vec3
- func (v1 Vec3) Dot(v2 Vec3) float64
- func (v Vec3) Length() float64
- func (v Vec3) Max(v1 Vec3) Vec3
- func (v Vec3) Min(v1 Vec3) Vec3
- func (v Vec3) Mul(v2 Vec3) Vec3
- func (v Vec3) Neg() Vec3
- func (v Vec3) Reflect(n Vec3) Vec3
- func (v Vec3) Refract(n Vec3, niOverNt float64) (Vec3, bool)
- func (v Vec3) Scale(t float64) Vec3
- func (v Vec3) Sub(v2 Vec3) Vec3
- func (v Vec3) Unit() Vec3
Constants ¶
This section is empty.
Variables ¶
View Source
var ( White = Color{1.0, 1.0, 1.0} Black = Color{0.001, 0.001, 0.001} Naught = Color{} Red = Color{1.0, 0.0, 0.0} Blue = Color{0.0, 0.0, 1.0} Green = Color{0.0, 1.0, 0.0} )
View Source
var ( Zero2 = Vec2{} Zero3 = Vec3{} X2 = Vec2{X: 1} Y2 = Vec2{Y: 1} X3 = Vec3{X: 1} Y3 = Vec3{Y: 1} Z3 = Vec3{Z: 1} )
View Source
var ( Steel = Metal(Color{0.4, 0.4, 0.4}, 0.95) Stainless = Metal(Color{0.4, 0.4, 0.4}, 0.3) Gold = Metal(Color{0.93, 0.78, 0.31}, 0.0) Copper = Metal(Color{0.68, 0.45, 0.41}, 0.8) Brass = Metal(Color{0.80, 0.58, 0.45}, 0.9) )
View Source
var Transparent = color.Transparent
Functions ¶
func RenderSave ¶
func RenderServeRPC ¶
Types ¶
type CompressedRaster ¶
type CompressedRaster struct {
Buf []byte
}
type Dielectric ¶
type LocalRenderer ¶
type LocalRenderer struct{}
type Material ¶
type Material interface { Light() (Color, bool) Scatter(Ray, *Thing, Vec3, int) (Ray, Color, bool) }
func ShadowsOnly ¶
func ShadowsOnly() Material
type Matrix44 ¶
type Matrix44 struct {
X00, X01, X02, X03 float64
X10, X11, X12, X13 float64
X20, X21, X22, X23 float64
X30, X31, X32, X33 float64
}
func Translation ¶
func (Matrix44) Determinant ¶
type RPCRenderer ¶
type RPCRenderer struct {
// contains filtered or unexported fields
}
type SDF3 ¶
func Difference ¶
func Intersection ¶
func TranslateX ¶
func TranslateY ¶
func TranslateZ ¶
type SDFDifference ¶
type SDFDifference struct {
Items []SDF3
}
func (SDFDifference) SDF ¶
func (s SDFDifference) SDF() func(Vec3) float64
func (SDFDifference) Sphere ¶
func (s SDFDifference) Sphere() (Vec3, float64)
type SDFDistort ¶
non-uniform scaling
func (SDFDistort) SDF ¶
func (s SDFDistort) SDF() func(Vec3) float64
func (SDFDistort) Sphere ¶
func (s SDFDistort) Sphere() (Vec3, float64)
type SDFEllipsoid ¶
type SDFEllipsoid struct {
R Vec3
}
func (SDFEllipsoid) SDF ¶
func (s SDFEllipsoid) SDF() func(Vec3) float64
func (SDFEllipsoid) Sphere ¶
func (s SDFEllipsoid) Sphere() (Vec3, float64)
type SDFElongate ¶
func (SDFElongate) SDF ¶
func (s SDFElongate) SDF() func(Vec3) float64
func (SDFElongate) Sphere ¶
func (s SDFElongate) Sphere() (Vec3, float64)
type SDFExtrude ¶
func (SDFExtrude) SDF ¶
func (s SDFExtrude) SDF() func(Vec3) float64
func (SDFExtrude) Sphere ¶
func (s SDFExtrude) Sphere() (Vec3, float64)
type SDFHexagram ¶
type SDFHexagram struct {
R float64
}
func (SDFHexagram) Circle ¶
func (s SDFHexagram) Circle() (Vec2, float64)
func (SDFHexagram) SDF ¶
func (s SDFHexagram) SDF() func(Vec2) float64
type SDFIntersection ¶
type SDFIntersection struct {
Items []SDF3
}
func (SDFIntersection) SDF ¶
func (s SDFIntersection) SDF() func(Vec3) float64
func (SDFIntersection) Sphere ¶
func (s SDFIntersection) Sphere() (Vec3, float64)
type SDFParabola ¶
type SDFParabola struct {
M, H float64
}
func (SDFParabola) Circle ¶
func (s SDFParabola) Circle() (Vec2, float64)
func (SDFParabola) SDF ¶
func (s SDFParabola) SDF() func(Vec2) float64
type SDFPolygon ¶
func (SDFPolygon) Circle ¶
func (s SDFPolygon) Circle() (Vec2, float64)
func (SDFPolygon) SDF ¶
func (s SDFPolygon) SDF() func(Vec2) float64
type SDFRectangle ¶
type SDFRectangle struct {
X, Y float64
}
func (SDFRectangle) Circle ¶
func (s SDFRectangle) Circle() (Vec2, float64)
func (SDFRectangle) SDF ¶
func (s SDFRectangle) SDF() func(Vec2) float64
type SDFRevolve ¶
func (SDFRevolve) SDF ¶
func (s SDFRevolve) SDF() func(Vec3) float64
func (SDFRevolve) Sphere ¶
func (s SDFRevolve) Sphere() (Vec3, float64)
type SDFRounded ¶
func (SDFRounded) SDF ¶
func (s SDFRounded) SDF() func(Vec3) float64
func (SDFRounded) Sphere ¶
func (s SDFRounded) Sphere() (Vec3, float64)
type SDFStadium ¶
type SDFStadium struct {
H, R1, R2 float64
}
func (SDFStadium) Circle ¶
func (s SDFStadium) Circle() (Vec2, float64)
func (SDFStadium) SDF ¶
func (s SDFStadium) SDF() func(Vec2) float64
type SDFTransform ¶
func (SDFTransform) SDF ¶
func (s SDFTransform) SDF() func(Vec3) float64
func (SDFTransform) Sphere ¶
func (s SDFTransform) Sphere() (Vec3, float64)
type SDFTriangle ¶
type SDFTriangle struct {
P0, P1, P2 Vec2
}
func (SDFTriangle) Circle ¶
func (s SDFTriangle) Circle() (Vec2, float64)
func (SDFTriangle) SDF ¶
func (s SDFTriangle) SDF() func(Vec2) float64
type Scene ¶
type Scene struct { Seed int64 // Optional Camera Camera // Required Stuff []Thing // Required Width int // in pixels Height int // in pixels Passes int // number of render passes Samples int // number of jittered samples per pixel Bounces int // max shadow ray bounces Horizon float64 // max scene distance from 0,0,0 to limit marching rays Threshold float64 // distance from SDF considered close enough to be a hit Ambient Color // color when rays stop before reaching a light ShadowH float64 // shadow alpha upper limit on invisible surfaces (dark center) ShadowL float64 // shadow alpha lower limit on invisible surfaces (prenumbra cut-off) ShadowD float64 // shadow darkness (light brightness multipler) ShadowR float64 // shadow sharpness (light radius multipler) Raster Raster // summed samples per pixel }
func (*Scene) ColorModel ¶
type Thing ¶
func (*Thing) BoundingDistance ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.