RSAGL.Modeling.Material
Description
RSAGL.Material handles properties of surfaces such as color, shininess, and transparency including procedural textures but not including anything touching the normal vector, such as bumpiness. Materials are handled using layers.
- data MaterialLayer
- type MaterialSurface a = ApplicativeWrapper Surface a
- data Material
- materialIsEmpty :: Material -> Bool
- toLayers :: Material -> [MaterialLayer]
- materialLayerSurface :: MaterialLayer -> MaterialSurface RGBA
- materialLayerRelevant :: MaterialLayer -> MaterialSurface Bool
- materialComplexity :: Material -> Integer
- materialLayerToOpenGLWrapper :: MaterialLayer -> IO () -> IO ()
- isOpaqueLayer :: MaterialLayer -> Bool
- diffuseLayer :: MaterialSurface RGB -> Material
- specularLayer :: MaterialSurface RGB -> GLfloat -> Material
- transparentLayer :: MaterialSurface RGBA -> Material
- emissiveLayer :: MaterialSurface RGB -> Material
- filteringLayer :: MaterialSurface RGB -> Material
Documentation
data MaterialLayer Source
A MaterialLayer
is a layer of material some material quality (diffuse, transparent, emissive, or specular highlight).
MaterialLayers
are rendered one on top of another to create layered effects.
Instances
type MaterialSurface a = ApplicativeWrapper Surface aSource
A MaterialSurface
is parameterized either on RGB or RGBA, depending
on whether or not the MaterialLayer
is capable of transparency.
MaterialSurface
s that are only one color (as opposed to procedural textures)
can be described using pure
, for example pure red.
A stack of MaterialLayer
s. Material
is smart about compressing multiple layers into the least of number of equivalent layers.
toLayers :: Material -> [MaterialLayer]Source
Split open a Material into its component layers.
materialLayerSurface :: MaterialLayer -> MaterialSurface RGBASource
Get the color information for a MaterialLayer
.
materialLayerRelevant :: MaterialLayer -> MaterialSurface BoolSource
Get a relevance layer for a surface. Purely irrelevant materials can be removed without changing the appearance of a model. Irrelevant triangles can also be selectively culled from a model.
materialComplexity :: Material -> IntegerSource
Answers a complexity heuristic for a Material
. Result is a small integer greater than or equal to zero.
materialLayerToOpenGLWrapper :: MaterialLayer -> IO () -> IO ()Source
Run an IO action wrapped in OpenGL state appropriate for the layer in question.
isOpaqueLayer :: MaterialLayer -> BoolSource
True if the MaterialLayer
is completely opaque. A layer under an opaque layer is not visible.
diffuseLayer :: MaterialSurface RGB -> MaterialSource
A simple colored material.
specularLayer :: MaterialSurface RGB -> GLfloat -> MaterialSource
A shiny material with specular highlight, including a specular exponent parameter. Larger exponents give tighter specular highlights, but should be less than 128 (larger than that wouldn't have very much effect anyway). Typical values are 1-10 or so.
transparentLayer :: MaterialSurface RGBA -> MaterialSource
A transparent colored material.
emissiveLayer :: MaterialSurface RGB -> MaterialSource
A material that seems to glow.
filteringLayer :: MaterialSurface RGB -> MaterialSource
A material that doesn't reflect or emit life, but simply performs a multiplicative filter on whatever is behind it.