Documentation ¶
Overview ¶
Package surface contains functions that populate images with lit textured surfaces.
Surface Light - Ambient Directional Material BumpMap
Index ¶
Constants ¶
This section is empty.
Variables ¶
DefaultAmbient is a low gray light.
var DefaultMaterial = &defaultMaterial{color.NewFRGBA(col.White), color.NewFRGBA(col.White)}
DefaultMaterial describes a material with 0 emissivity, full white ambient and directional, and no specular components.
Functions ¶
Types ¶
type Ambient ¶
Ambient describes an ambient light source.
func NewAmbient ¶
NewAmbient returns a new ambient light source.
type BumpMap ¶
type BumpMap struct { Ambient *Ambient Direct Light Mat Material Normals texture.VectorField }
BumpMap collects the ambient light, a direct light, a material, and normal map required to describe an area. If the normal map is nil then the standard normal is use {0, 0, 1}
type Directional ¶
Directional describes a directional light source. The direction is from the surface to the light, normalized.
func NewDirectional ¶
func NewDirectional(col col.Color, dir []float64) *Directional
NewDirectional returns a new directional light source.
type Light ¶
Light provides the At function to determine the color (RGB in [0,1]), unit direction, distance and power of a light at a location. If the direction is nil then the light is treated as an ambient one and any distance and power values ignored. If the distance is -ve then this is treated as a directional light at infinity. Otherwise the light is treated as a point light source with the power falling as the inverse square of the distance from the light.
type Material ¶
type Material interface {
Eval2(x, y float64) (*color.FRGBA, *color.FRGBA, *color.FRGBA, *color.FRGBA, float64, float64)
}
Material provides the At function to determine the emissive light, various reflectances, shininess and roughness at a location. Reflectances are ordered as ambient, diffuse and specular.
type Quaternion ¶
Quaternion holds a quaternion defined as a vector (unit) and angle.
func NewQuaternion ¶
func NewQuaternion(v []float64, th float64) *Quaternion
func (*Quaternion) Apply ¶
func (q *Quaternion) Apply(pts ...[]float64) [][]float64
Apply applies the quaternion to the set of supplied points.
func (*Quaternion) Rotation ¶
func (q *Quaternion) Rotation() [][]float64
Rotation returns the rotation matrix that describes a point transformed by the quaternion.