rsagl- The RogueStar Animation and Graphics Library



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 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.

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. MaterialSurfaces that are only one color (as opposed to procedural textures) can be described using pure, for example pure red.

data Material Source

A stack of MaterialLayers. 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.

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.