Module Lit.Prim

module Prim: sig .. end
Primitives.

A primitive defines a vertex stream (set of attributes) sent to the GPU and how this stream must be interpreted as geometrical primitives. A primitive defines the Lit.Prim.kind of primitive for the geometry shader (if any) and its set of attributes define the values of the input variables of the vertex shader.

A primitive value gathers a set of attributes, an optional index buffer to specify the stream of vertices and a primitive Lit.Prim.kind. Primitives are immutable but the underlying buffers are not.



Primitive kinds


type kind = [ `Line_loop
| `Line_strip
| `Line_strip_adjacency
| `Lines
| `Lines_adjacency
| `Points
| `Triangle_fan
| `Triangle_strip
| `Triangle_strip_adjacency
| `Triangles
| `Triangles_adjacency ]
The kind of primitive. Defines how the vertex stream is interpreted.
val pp_kind : Format.formatter -> kind -> unit
pp_kind ppf kind prints an unspecified representation of kind on ppf.

Primitives


type t = Lit.prim 
The type for primitives.
val create : ?tr:Gg.M4.t ->
?name:string ->
?first:int ->
?count:int -> ?index:Lit.Buf.t -> kind -> Lit.attr list -> Lit.prim
create name tr first count index kind attrs is a primitive such that:
Raises Invalid_argument if:
val kind : Lit.prim -> kind
kind p is the kind of p.
val name : Lit.prim -> string
name p is the name of p.
val index : Lit.prim -> Lit.Buf.t option
index p is the index of p (if any). See Lit.Prim.create.
val first : Lit.prim -> int
first p is first scalar index read from index. See Lit.Prim.create.
val count : Lit.prim -> int option
cout p is the count of p as specified at primitive creation. See also Lit.Prim.count_now.
val count_now : Lit.prim -> int
count_now p is the number of vertices in the vertex stream. If count was specified at creation time, this is always that number. Otherwise, let b be Lit.Prim.index p and first be Lit.Prim.first p:
val tr : Lit.prim -> Gg.M4.t
tr p is pre-transform matrix of p.
val pp : Format.formatter -> Lit.prim -> unit
pp ppf p prints an unspecified representation of p on ppf.

Primitive Attributes


val attrs : Lit.prim -> Lit.attr list
attrs p is the attributes of p.
val iter : (Lit.attr -> unit) -> Lit.prim -> unit
iter p f iterates f over the attributes of p.
val fold : ('a -> Lit.attr -> 'a) -> 'a -> Lit.prim -> 'a
fold f acc p folds f over the attributes of p starting with acc.
val mem : Lit.prim -> string -> bool
mem p n is true there is an attribute with name n in p.
val find : Lit.prim -> string -> Lit.attr option
find p n is the attribute named n of p (if any).
val get : Lit.prim -> string -> Lit.attr
get p n is the attribute named n of p.
Raises Invalid_argument if there is no attribute named n in p.