module Prim:sig..end
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.
typekind =[ `Line_loop
| `Line_strip
| `Line_strip_adjacency
| `Lines
| `Lines_adjacency
| `Points
| `Triangle_fan
| `Triangle_strip
| `Triangle_strip_adjacency
| `Triangles
| `Triangles_adjacency ]
val pp_kind : Format.formatter -> kind -> unitpp_kind ppf kind prints an unspecified representation of kind
on ppf.typet =Lit.prim
val create : ?tr:Gg.M4.t ->
?name:string ->
?first:int ->
?count:int -> ?index:Lit.Buf.t -> kind -> Lit.attr list -> Lit.primcreate name tr first count index kind attrs is a primitive
such that:
tr is a is a transform that is right-multiplied to the render
operation matrix (e.g. for normalizing disparate model
coordinate scales); TODO defaults to id.name is an optional client name for identifiying the primitive;
auto generated by default.first is the scalar index of the first vertex index in index,
ignored if index is unspecified; defaults to 0.count is the number of vertices that are part of the vertex
stream. count must be specified if index is unspecified. In that
case count attribute elements in each attribute are read to define
the vertex stream.index if specified must be a buffer of unsigned integers
used to index the attribute elements to specify the vertex stream.
If count is specified then always count indices will be read
from index starting at first. If count is unspecified then
all indices starting at first until the end of buffer will be read
(hence the primitive's size may change dynamically).kind the kind of primitive to render.attrs, the primitive's attributes.Invalid_argument if:
count and index are unspecifiedindex scalar type is not an unsigned integer.attrsval kind : Lit.prim -> kindkind p is the kind of p.val name : Lit.prim -> stringname p is the name of p.val index : Lit.prim -> Lit.Buf.t option
val first : Lit.prim -> int
val count : Lit.prim -> int option
val count_now : Lit.prim -> intcount_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:
Lit.Buf.gpu_upload b is true, Lit.Buf.cpu_count b - first
is returned.Lit.Buf.gpu_count b - first is returned.val tr : Lit.prim -> Gg.M4.ttr p is pre-transform matrix of p.val pp : Format.formatter -> Lit.prim -> unitpp ppf p prints an unspecified representation of p on ppf.val attrs : Lit.prim -> Lit.attr listattrs p is the attributes of p.val iter : (Lit.attr -> unit) -> Lit.prim -> unititer p f iterates f over the attributes of p.val fold : ('a -> Lit.attr -> 'a) -> 'a -> Lit.prim -> 'afold f acc p folds f over the attributes of p starting with
acc.val mem : Lit.prim -> string -> boolmem p n is true there is an attribute with name n in p.val find : Lit.prim -> string -> Lit.attr optionfind p n is the attribute named n of p (if any).val get : Lit.prim -> string -> Lit.attrget p n is the attribute named n of p.Invalid_argument if there is no attribute named n in p.