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.
typeraster_face_cull =
[ `Back | `Front ]
type
raster = {
|
raster_face_cull : |
|
raster_multisample : |
val raster_default : raster
raster_default
is the default raster state:
raster_default.raster_face_cull
is None
.raster_default.raster_multisample
is true
.typedepth_test =
[ `Always | `Equal | `Gequal | `Greater | `Lequal | `Less | `Nequal | `Never ]
type
depth = {
|
depth_test : |
(* | Some _ if z-test should be performed. | *) |
|
depth_write : |
(* | true if z-buffer should be written. | *) |
|
depth_offset : |
(* | factor, units, see glPolygonOffset | *) |
val depth_default : depth
depth_default
is the default depth state:
depth_default.depth_test
is Some `Less
.depth_default.depth_write
is true
.depth_default.depth_offset
is (0., 0.)
TODO.
typeblend_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 ]
typeblend_eq =
[ `Add of blend_mul * blend_mul
| `Max
| `Min
| `Rev_sub of blend_mul * blend_mul
| `Sub of blend_mul * blend_mul ]
`Add (a, b)
is a * src + b * dst
.`Sub (a, b)
is a * src - b * dst
.`Rev_sub (a, b)
is b * dst - a * src
.`Min
, component wise min a b
.`Max
, component wise max a b
.val blend_eq_default : blend_eq
blend_default_eq
is `Add (Src_a, One_minus_src_a)
.type
blend = {
|
blend : |
(* | true if blending should be performed. | *) |
|
blend_rgb : |
(* | Blending equation for rgb | *) |
|
blend_a : |
(* | Blending equation for alpha. | *) |
|
blend_cst : |
(* | Blend color for `Cst_* multiplier. | *) |
val blend_default : blend
blend_default
is the default blend state:
blend_default.blend
is false
.blend_default.blend_rgb
is blend_default_eq
.blend_default.blend_a
is blend_default_eq
.blend_default.blenc_cst
is Gg.Color.void
.val blend_alpha : blend
blend_alpha
is blend_default
with the blend
field
to true
.typet =
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.