View on GitHub

3DreamEngine

3DreamEngine is an *awesome* 3d engine for LÖVE.

Buffer

A buffer is a continues collection of primitives (vectors, scalars or matrices) used to store vertex information and co.

Constructors

Buffer:newBuffer(type, dataType, length)

New compact data buffer

Arguments

type (string) “vec2”, “vec3”, “vec4”, or “mat4”

dataType (string) C type, e.g. “float”

length (number)

Returns

(Buffer)


Buffer:newDynamicBuffer()

A dynamic buffer is a slower, more dynamic lua array implementation

Returns

(Buffer)


Methods

Buffer:getType()


Buffer:getDataType()


Buffer:append(data)

Append a value to the buffer

Arguments

data (number)


Buffer:set(index, data)

Set a value in the buffer

Arguments

index (number)

data (number)


Buffer:get(index)

Get a raw value from the buffer

Arguments

index (number)

Returns

(number)


Buffer:getOrDefault(index)

Get a raw value from the buffer without risking a out of bounds

Arguments

index (number)

Returns

(number)


Buffer:getVector(index)

Get a casted value from the buffer

Arguments

index (number)

Returns

(number)


Buffer:copyFrom(source, dstOffset, srcOffset, srcLength)

Copy data from one buffer into another, offsets given in indices

Arguments

source (Buffer)

dstOffset (number)

srcOffset (number)

srcLength (number)


Buffer:getSize()

Get the size of this buffer


Buffer:ipairs()

Iterate over every raw value


Buffer:toArray()

Convert buffer to a Lua array