Module Lit.Uniform

module Uniform: sig .. end
Uniforms.


Uniforms


type 'a t = 'a Lit.uniform 
The type for uniforms.
val name : 'a t -> string
name u is the name of uniform u.
val value : 'a t -> 'a
value u is the value of uniform u.

Note Returns the zero of 'a if u is a builtin.

val set_value : 'a t -> 'a -> 'a t
val v : 'a t -> 'a -> 'a t
v is Lit.Uniform.set_value.
val set_to_model_to_world : Gg.m4 t -> Gg.m4 t
TODO add the rest
val is_value_builtin : 'a Lit.uniform -> bool
is_value_builtin u is true if u has its value defined by the renderer.
val pp : Format.formatter -> 'a Lit.uniform -> unit
pp ppf u prints an unspecified representation of u on ppf.

Uniform constructors

TODO something must be said about GLSL ivec bvec etc.

val bool : string -> bool -> bool Lit.uniform
bool n v is a boolean uniform named n with value v.
val int : string -> int -> int Lit.uniform
int n v is a integer uniform named n with value v.
val float : string -> float -> float Lit.uniform
float n v is a float uniform named n with value v.
val v2 : string -> Gg.v2 -> Gg.v2 Lit.uniform
v2 n v is a 2D vector uniform named n with value v.
val v3 : string -> Gg.v3 -> Gg.v3 Lit.uniform
v3 n v is a 3D vector uniform named n with value v.
val v4 : string -> Gg.v4 -> Gg.v4 Lit.uniform
v4 n v is a 4D vector uniform named n with value v.
val m2 : string -> Gg.m2 -> Gg.m2 Lit.uniform
m2 n v is a 2x2 matrix uniform named n with value v.
val m3 : string -> Gg.m3 -> Gg.m3 Lit.uniform
m3 n v is a 3x3 matrix uniform named n with value v.
val m4 : string -> Gg.m4 -> Gg.m4 Lit.uniform
m4 n v is a 4x4 matrix uniform named n with value v.
val tex : string -> Lit.tex -> Lit.tex Lit.uniform
tex n v is a sampler uniform named n with value v.

Constructors for special uniform values

Those uniforms have their value automatically setup by the renderer according to TODO.

val model_to_world : string -> Gg.m4 Lit.uniform
val model_to_view : string -> Gg.m4 Lit.uniform
val model_to_clip : string -> Gg.m4 Lit.uniform
val model_normal_to_view : string -> Gg.m3 Lit.uniform
val world_to_view : string -> Gg.m4 Lit.uniform
val world_to_clip : string -> Gg.m4 Lit.uniform
val view_to_clip : string -> Gg.m4 Lit.uniform
val viewport_o : string -> Gg.v2 Lit.uniform
in surface coordinates.
val viewport_size : string -> Gg.v2 Lit.uniform
in surface coordinates.

Uniform values


type builtin = [ `Model_normal_to_view
| `Model_to_clip
| `Model_to_view
| `Model_to_world
| `View_to_clip
| `Viewport_o
| `Viewport_size
| `World_to_clip
| `World_to_view ]
The type for built-in uniform values.
type value_untyped = [ `Bool of bool
| `Builtin of builtin
| `Float of float
| `Int of int
| `M2 of Gg.m2
| `M3 of Gg.m3
| `M4 of Gg.m4
| `Tex of Lit.tex
| `V2 of Gg.v2
| `V3 of Gg.v3
| `V4 of Gg.v4 ]
The type for untyped uniform values.

Uniform sets


type set 
The type for uniform sets.
val empty : set
empty is the empty set of uniforms.
val is_empty : set -> bool
is_empty s is true if s is empty.
val add : set -> 'a Lit.uniform -> set
add s u is s with u added.
val (+) : set -> 'a Lit.uniform -> set
val mem_named : set -> string -> bool
mem_named s n is true if s has a uniform named n.
val find : set -> 'a Lit.uniform -> value_untyped option
find s u is the value of u in s (if any).
val find_named : set -> string -> value_untyped option
find s n is the value of a uniform named n (if any).
val get : set -> 'a Lit.uniform -> value_untyped
find s u is the value of u in s.
Raises Invalid_argument if u is not in s.
val get_named : set -> string -> value_untyped
find s u is the value of u in s.
Raises Invalid_argument if u is not in s.
val fold : ('a -> string -> value_untyped -> 'a) ->
'a -> set -> 'a
fold f acc s folds f over the uniforms of s starting with acc.
val pp_set : Format.formatter -> set -> unit
pp_set ppf set prints an unspecified representation of s on ppf.