material

package
v0.0.0-...-3626a0a Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2015 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BRDF

type BRDF int

BRDF (bidirectional reflectance distribution function)

const (
	// Lambert is a perfectly diffuse shader.
	Lambert BRDF = iota
	// BlinnPhong uses all the material properties to produce a more realistic shader.
	BlinnPhong
)

type Material

type Material struct {
	Emissive     Property
	Ambient      Property
	Diffuse      Property
	Specular     Property
	Reflective   Property
	Transmissive Property
	Smoothness   Property
	Normal       Property
	IllumMap     *texture.Texture
	Index        float64
	IsLiquid     bool
	Brdf         BRDF
}

Material holds all the properties of a material.

func New

func New(opts *options.Material, fast bool) (*Material, error)

New creates a new Material.

type Property

type Property interface {
	Color(uv mgl64.Vec2) color64.Color64
}

Property is an interface that returns a color for a particular set of UV-coordinates.

func Uniform

func Uniform(color options.Color) Property

Uniform creates a Property that always returns the given color.

type PropertyFunc

type PropertyFunc func(uv mgl64.Vec2) color64.Color64

PropertyFunc is a function that implements the Property interface.

func (PropertyFunc) Color

func (u PropertyFunc) Color(uv mgl64.Vec2) color64.Color64

Color implements the Property interface for PropertyFunc.

Jump to

Keyboard shortcuts

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