Module Geometry-PIXI

class type _t = { ... }
type t = Js.t(_t);

The Geometry represents a model. It consists of two components:

GeometryStyle - The structure of the model such as the attributes layout GeometryData - the data of the model - this consists of buffers. This can include anything from positions, uvs, normals, colors etc. Geometry can be defined without passing in a style or data if required (thats how I prefer!)

module Impl: { ... };
include Impl;
let create: ?⁠buffers:array(PIXI.Buffer.t) => ?⁠attributes:Js.t({.. }) => unit => t;
let merge: geometries:array(t) => t;

merges an array of geometries into a new single one geometry attribute styles must match for this operation to work

let getInstanceCount: Js.t(_t) => int;

Number of instances in this geometry, pass it to GeometrySystem.draw()

let getRefCount: Js.t(_t) => int;

Count of existing (not destroyed) meshes that reference this geometry

let _addAttribute: t => id:string => ?⁠buffer:PIXI.Buffer.t => ?⁠size:int => ?⁠normalized:bool => ?⁠_type:int => ?⁠stride:int => ?⁠start:int => unit => t;
let addAttribute: t => id:string => ?⁠buffer:PIXI.Buffer.t => ?⁠size:PIXI.TYPES.t => ?⁠normalized:bool => ?⁠_type:int => ?⁠stride:int => ?⁠start:int => unit => t;

Adds an attribute to the geometry

parameter id

the name of the attribute (matching up to a shader)

parameter buffer

the buffer that holds the data of the attribute . You can also provide an Array and a buffer will be created from it.

parameter size

the size of the attribute. If you have 2 floats per vertex (eg position x and y) this would be 2

parameter normalized

should the data be normalized.

parameter type

what type of number is the attribute. Check PIXI.TYPES to see the ones available

parameter stride

How far apart (in floats) the start of each value is. (used for interleaving data)

parameter start

How far into the array to start reading values (used for interleaving data)

let addIndex: t => ?⁠buffer:PIXI.Buffer.t => unit => t;

Adds an index buffer to the geometry The index buffer contains integers, three for each triangle in the geometry, which reference the various attribute buffers (position, colour, UV coordinates, other UV coordinates, normal, …). There is only ONE index buffer.

let clone: t => t;

returns a clone of the geometry

let destroy: t => unit;

Destroys the geometry.

let dispose: t => unit;

disposes WebGL resources that are connected to this geometry

let getAttribute: t => id:string => PIXI.Attribute.t;

returns the requested attribute

let getBuffer: t => id:string => PIXI.Buffer.t;

returns the requested buffer

let getIndex: t => PIXI.Buffer.t;

returns the index buffer

let interleave: t => t;

this function modifies the structure so that all current attributes become interleaved into a single buffer This can be useful if your model remains static as it offers a little performance boost