module Attr:sig
..end
An attribute is part of the vertex stream sent to the GPU by a primitive. It define the value of an input variable of the vertex shader (e.g. vertice, normal, color, etc.).
An attribute value adds immutable metadata to a (mutable) buffer
value in order specify the location and nature of the attribute
elements in the buffer.
typet =
Lit.attr
val create : ?normalize:bool ->
?stride:int -> ?first:int -> string -> dim:int -> Lit.Buf.t -> t
create normalize stride first name dim buf
is an attribute such that:
normalize
, if true
, scalars stored as integer and
signed integer are respectively mapped to floating point
ranges [0;1]
and [-1;1]
on access on the GPU;
defaults to false
.stride
is the number of scalars from attribute
element to attribute element, defaults to dim
.first
is the scalar index of the first attribute
element in buf
; defaults to 0.name
is the name of the attribute. This name will be used
to bind the attribute to the corresponding input variable in
the vertex shaderdim
is the dimension of the data (from 1
to 4
).buf
is the buffer holding the attribute elements.Invalid_argument
if dim
is out of range.val name : Lit.attr -> string
name a
is a
's name.val dim : Lit.attr -> int
dim a
is a
's dimension.val buf : Lit.attr -> Lit.Buf.t
buf a
is a
's buffer.val stride : Lit.attr -> int
val first : Lit.attr -> int
val normalize : Lit.attr -> bool
val rename : Lit.attr -> string -> Lit.attr
rename a name
is like a
except the name is changed to name
.val pp : Format.formatter -> Lit.attr -> unit
pp ppf a
prints an unspecified representation of a
on ppf
.val vertex : string
vertex
is "vertex"
.val normal : string
normal
is "normal"
.val color : string
color
is "color"
.val tex : string
tex
is "tex"
.val texn : int -> string
texn n
is (Printf.sprintf "tex%d" n)
Invalid_argument
if n
is negative.