View on GitHub

3DreamEngine

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

MutableMeshBuilder

Extends MeshBuilder

A mutable mesh builder stored references to added objects and can remove them

Constructors

MutableMeshBuilder:newMutableMeshBuilder(material)

Creates a new mutable mesh builder

Arguments

material (Material)

Returns

(MutableMeshBuilder)


Methods

MutableMeshBuilder:clear()


MutableMeshBuilder:addVertices(vertexCount, vertexMapLength)

Returns the pointer to vertices, pointer to vertex map and the index offset. Make sure to fill all requested vertices and build the vertex map accordingly.

Arguments

vertexCount (number)

vertexMapLength (number)


MutableMeshBuilder:remove(id)

remove a chunk previously added

Arguments

id (number)


MutableMeshBuilder:getVertexIntegrity()

Returns the fraction of data in use

Returns

(number)


MutableMeshBuilder:getIndexIntegrity()

Returns the fraction of data in use for the index buffer

Returns

(number)


MutableMeshBuilder:getLastChunkId()

The last added chunk id is required if you want to remove added content later on

Returns

(number)


MutableMeshBuilder:defragment()

Defragment mesh now, shifting all data to the very left and updating the chunk pointers


MeshBuilder:clear()

Resets the buffer


MeshBuilder:updateBoundingSphere()


MeshBuilder:addMesh(mesh, transform)

Adds a mesh with given transform to the builder

Arguments

mesh (Mesh)

transform (Mat4)


MeshBuilder:addVertices(vertexCount, vertexMapLength)

Returns the pointer to vertices, pointer to vertex map and the index offset. Make sure to fill all requested vertices and build the vertex map accordingly.

Arguments

vertexCount (number)

vertexMapLength (number)


MeshBuilder:addTriangle()

Allocates an triangle and returns the pointer to the first vertex


MeshBuilder:addQuad()

Allocates an quad and returns the pointer to the first vertex


Mesh:setMaterial(material)

Sets the meshes material

Arguments

material (Material)


Mesh:getMaterial()

Returns

(Material)


Mesh:setVisible(visibility)

Arguments

visibility (boolean)


Mesh:setRenderVisibility(visibility)

Arguments

visibility (boolean)


Mesh:getRenderVisibility()


Mesh:setShadowVisibility(visibility)

Arguments

visibility (boolean)


Mesh:getShadowVisibility()


Mesh:setSkeleton(skeleton)

Arguments

skeleton (Skeleton)


Mesh:getSkeleton()


Mesh:getPixelShader()


Mesh:getVertexShader()


Mesh:getWorldShader()


Mesh:updateBoundingSphere()

Updates the bounding sphere based on mesh data


Mesh:cleanup()


Mesh:preload(force)

Load textures and similar

Arguments

force (boolean) Bypass threaded loading and immediately load things


Mesh:clearMesh()

Deletes the mesh, will regenerate next time needed


Mesh:getMesh(name)

Get a mesh, load automatically if required

Arguments

name (string) optional, default “mesh”


Mesh:applyTransform(transform)

Apply a transformation matrix to all vertices

Arguments

transform (Mat4)


Mesh:applyBones(skeleton)

Apply joints to mesh data directly

Arguments

skeleton (Skeleton) optional


Mesh:getJointMatrix(skeleton, jointIndex)

Returns the final joint transformation based on vertex weights

Arguments

skeleton (Skeleton)

jointIndex (number)

Returns

(Mat4)


Mesh:recalculateTangents()


Mesh:createVertexMap()


Mesh:getMeshFormat()

Returns the required mesh format set by the current pixel shader

Returns

(MeshFormat)


Mesh:create()

Makes this mesh render-able


Mesh:separate()

Separates by loose parts and returns a list of new meshes

Returns

(Mesh[])


Mesh:setMeshDrawMode(meshDrawMode)

Sets the current meshDrawMode, rarely makes sense to set manually

Arguments

meshDrawMode (MeshDrawMode)


Mesh:getMeshDrawMode()

Gets the current meshDrawMode

Returns

(MeshDrawMode)


Mesh:getOrCreateBuffer(name)

Gets or creates an dynamic, typeless buffer

Arguments

name (string) name of buffer


Clonable:clone()

Slow and deep clone


Clonable:instance()

Creates an fast instance


HasShaders:setPixelShader(shader)

Arguments

shader (Shader)


HasShaders:setVertexShader(shader)

Arguments

shader (Shader)


HasShaders:setWorldShader(shader)

Arguments

shader (Shader)


IsNamed:setName(name)

A name has no influence other than being able to print more nicely

Arguments

name (string)


IsNamed:getName()

Gets the name, or “unnamed”

Returns

(string)