Module Lit.Effect

module Effect: sig .. end

An effect defines a configuration of the graphics pipeline or a list of effects for rendering a Lit.prim value.

TODO. Pretty printers.

Rasterization state

type raster_face_cull = [ `Back | `Front ] 
The type for face culling. Faces with a counter clockwise orientation are front faces.
type raster = {
   raster_face_cull : raster_face_cull option;
   raster_multisample : bool;
The type for raster state.
val raster_default : raster
raster_default is the default raster state:

Depth state

type depth_test = [ `Always | `Equal | `Gequal | `Greater | `Lequal | `Less | `Nequal | `Never ] 
type depth = {
   depth_test : depth_test option; (*Some _ if z-test should be performed.*)
   depth_write : bool; (*true if z-buffer should be written.*)
   depth_offset : float * float; (*factor, units, see glPolygonOffset*)
The type for depth state.
val depth_default : depth
depth_default is the default depth state:

Blend state


type blend_mul = [ `Cst
| `Cst_a
| `Dst
| `Dst_a
| `One
| `One_minus_cst
| `One_minus_cst_a
| `One_minus_dst
| `One_minus_dst_a
| `One_minus_src
| `One_minus_src1
| `One_minus_src1_a
| `One_minus_src_a
| `Src
| `Src1
| `Src1_a
| `Src_a
| `Src_a_saturate
| `Zero ]
The type for blend multipliers.
type blend_eq = [ `Add of blend_mul * blend_mul
| `Max
| `Min
| `Rev_sub of blend_mul * blend_mul
| `Sub of blend_mul * blend_mul ]
The type for blend equations.
val blend_eq_default : blend_eq
blend_default_eq is `Add (Src_a, One_minus_src_a).
type blend = {
   blend : bool; (*true if blending should be performed.*)
   blend_rgb : blend_eq; (*Blending equation for rgb*)
   blend_a : blend_eq; (*Blending equation for alpha.*)
   blend_cst : Gg.color; (*Blend color for `Cst_* multiplier.*)
The type for blend states.
val blend_default : blend
blend_default is the default blend state:
val blend_alpha : blend
blend_alpha is blend_default with the blend field to true.


type t = Lit.effect 
val create : ?raster:raster ->
?depth:depth ->
?blend:blend ->
?uniforms:Lit.Uniform.set -> Lit.prog -> Lit.effect
create raster depth blend uniforms prog is an effect that uses the GPU program prog. raster, depth and blend respectively define the rasterization, depth buffer and blend states (resp. default to Lit.Effect.raster_default, Lit.Effect.depth_default, Lit.Effect.blend_default). uniforms is the uniforms used with prog (defaults to Prog.uniforms (prog e)).
val prog : Lit.effect -> Lit.prog
prog e is e's GPU program.
val uniforms : Lit.effect -> Lit.Uniform.set
uniforms e the uniforms that are used with e's program.
val get_uniform : Lit.effect -> 'a Lit.uniform -> Lit.Uniform.value_untyped
get_uniform e u is the value of uniform u in e.
val set_uniform : Lit.effect -> 'a Lit.uniform -> 'a -> unit
set_uniform e u v sets the value of uniform u to v in e.
val raster : Lit.effect -> raster
raster e is e's raster state.
val depth : Lit.effect -> depth
depth e is e's depth state.
val blend : Lit.effect -> blend
blend e is e's blend state.