shader

package
v0.0.0-...-ec9fd1c Latest Latest
Warning

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

Go to latest
Published: Dec 14, 2012 License: GPL-3.0 Imports: 2 Imported by: 0

Documentation

Overview

Package shader is a node-based shader system.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Node

type Node interface {
	// Eval evalutes the node for a given surface point.
	Eval(inputs []Result, params Params) Result

	// EvalDerivative evaluates the node's partial derivatives for a given
	// surface point (e.g. for bump mapping).
	EvalDerivative(inputs []Result, params Params) Result

	// ViewDependent returns whether the shader value depends on wo and wi.
	ViewDependent() bool

	// Dependencies returns the nodes on which the output of this shader depends.
	Dependencies() []Node
}

Nodes are elements of a node-based shading tree. A shader associates a color or scalar with a surface point.

type Params

type Params map[string]interface{}

Params convey non-result values to shaders.

type Result

type Result [4]float64

func Eval

func Eval(targets []Node, params Params) (final []Result)

func (Result) Color

func (r Result) Color() color.AlphaColor

func (Result) Derivative

func (r Result) Derivative() (du, dv float64)

Derivative calculates the (approximate) partial derivatives of df/dNU and df/dNV where f is the shader function, and NU/NV/N build the shading coordinate system.

func (Result) Scalar

func (r Result) Scalar() float64

Jump to

Keyboard shortcuts

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