Documentation ¶
Overview ¶
Package texmap provides a shader node that performs texture mapping with various options.
Index ¶
- func Construct(m yamldata.Map) (data interface{}, err error)
- type Coordinates
- type DiscreteTexture
- type Projector
- type ProjectorFunc
- type Texture
- type TextureMapper
- func (tmap *TextureMapper) Dependencies() []shader.Node
- func (tmap *TextureMapper) Eval(inputs []shader.Result, params shader.Params) (result shader.Result)
- func (tmap *TextureMapper) EvalDerivative(inputs []shader.Result, params shader.Params) (result shader.Result)
- func (tmap *TextureMapper) Init(tex Texture, coord Coordinates, scalar bool)
- func (tmap *TextureMapper) ViewDependent() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Coordinates ¶
type Coordinates int
Coordinates specifies which coordinate system to use during texture mapping.
const ( UV Coordinates = iota // UV-mapping Global // Global coordinates Orco // Original coordinates Transform // Transformation matrix Window // Viewport-relative )
type DiscreteTexture ¶
A DiscreteTexture is a texture which has quantized values (a raster image).
type Projector ¶
A Projector computes the projection of 3D space into a 2D texture coordinate.
var ( FlatMap Projector = ProjectorFunc(flatMap) TubeMap Projector = ProjectorFunc(tubeMap) SphereMap Projector = ProjectorFunc(sphereMap) CubeMap Projector = ProjectorFunc(cubeMap) )
Built-in projection schemes
type ProjectorFunc ¶
A ProjectorFunc is a simple function-based projector.
type Texture ¶
type Texture interface { ColorAt(pt vec64.Vector) color.AlphaColor ScalarAt(pt vec64.Vector) float64 Is3D() bool IsNormalMap() bool }
A Texture is a 2D/3D function for surface values. This is usually based on a raster image, but could be procedurally generated.
type TextureMapper ¶
type TextureMapper struct { Texture Texture // The 2D/3D texture to apply Coordinates Coordinates // The coordinate system to use Projector Projector // The 3D projection type to use MapX, MapY, MapZ vecutil.Axis // Axis re-mapping (use -1 to indicate zero) Transform mat64.Matrix // Transformation matrix (if using Transform coordinates) Scale, Offset vec64.Vector // Constant scale and offset for coordinates Scalar bool // Should the result be a scalar? BumpStrength float64 // Bump mapping weight // contains filtered or unexported fields }
A TextureMapper is a shader that applies a texture to geometry.
func New ¶
func New(tex Texture, coord Coordinates, scalar bool) (tmap *TextureMapper)
New creates a new texture mapper with the given parameters.
func (*TextureMapper) Dependencies ¶
func (tmap *TextureMapper) Dependencies() []shader.Node
func (*TextureMapper) EvalDerivative ¶
func (*TextureMapper) Init ¶
func (tmap *TextureMapper) Init(tex Texture, coord Coordinates, scalar bool)
Init initializes the mapper with default values. You must call this method before using the mapper (but it is called automatically by New).
func (*TextureMapper) ViewDependent ¶
func (tmap *TextureMapper) ViewDependent() bool