An extension to FoxVertexBuffer to store multiple attributes in a single buffer

Constructor

new(elements:Int, dataPerVertex:Int, ?dynamicUsage:Bool)

Variables

@:value([])regions:Array<VertexBufferRegion> = []

Methods

@:value({ normalized : false, offset : 0 })addRegion(dataPerVertex:Int, stride:Int, offset:Int = 0, normalized:Bool = false):Void

Adds an attribute region for the vertex buffer

Note: The order of the regions should follow the order of attributes in your shader

Parameters:

dataPerVertex

How many elements per vertex for the attribute

stride

The number of bytes to skip to reach the next batch, usually calculated as dataPerVertex*bytesPerElement plus an offset

offset

The byte offset to where start reading the buffer

normalized

if enabled, values from the byte/short/int range will be normalized from -1 to 1 (or 0 to 1 in the case of unsigned)

inlineclearRegions():Void

Inherited Variables

Defined by FoxVertexBuffer

@:value(null)id:GLBuffer = null

usage:Int

count:Int

@:value(0)stride:Int = 0

@:value(0)bytesPerElement:Int = 0

@:value(0)type:Int = 0

@:value(false)hasData:Bool = false

If buffer data has been uploaded once

read onlyloaded:Bool

@:value(false)normalized:Bool = false

Used at render time, if enabled, values from the byte/short/int range will be normalized from -1 to 1 (or 0 to 1 in the case of unsigned)

privatecontext:Context3D

data:ArrayBufferView

Holder data for this buffer, disabled by default so it saves memory

Inherited Methods

Defined by FoxVertexBuffer

privateget_loaded():Bool

uploadFromTypedArray(data:ArrayBufferView):Void

privatebindAndUpload():Void

@:value({ byteOffset : 0 })updateFromTypedArray(data:ArrayBufferView, byteOffset:Int = 0):Void

dispose():Void