API Docs for: 0.5.5
Show:

kick.mesh.Mesh Class

A Mesh object allows you to bind and render a MeshData object

Constructor

kick.mesh.Mesh

(
  • config
)

Parameters:

  • config Object

Methods

bind

(
  • shader
)

Bind the vertex attributes of the mesh to the shader

Parameters:

destroy

()

Destroys the mesh data and deletes the associated resources After this the mesh cannot be bound

init

(
  • config
  • [resourceTracker]
)

Configures the object using the configuration data.

Parameters:

  • config Object

    configuration data in JSON format

  • [resourceTracker] ResourceTracker optional

render

(
  • submeshIndex
)

Renders the current mesh. Assumes that the Mesh.bind(shader) has been called prior to this, to setup the mesh with the shader.

Parameters:

  • submeshIndex Number

setDataURI

(
  • newValue
  • automaticGetMeshData
  • resourceTracker
)

Parameters:

  • newValue String
  • automaticGetMeshData Boolean

    optional. if true the mesh data is attempted to be loaded by resourceLoader.getMeshData

  • resourceTracker ResourceTracker

    Optional

toJSON

() Object

Inherited from kick.core.ProjectAsset but overwritten in kick/mesh/Mesh.js:402

Returns:

Object:

data object

updateData

(
  • updateVertexData
  • updateIndices
  • updateVertexStructure
)
private

Copy data to the vertex buffer object (VBO)

Parameters:

  • updateVertexData Boolean
  • updateIndices Boolean
  • updateVertexStructure Boolean

updateMeshData

(
  • meshData
  • updateVertexData
  • updateIndices
  • updateVertexStructure
  • updateBoundingbox
)

Gives more control over what parts of mesh data is uploaded to the GPU.

Parameters:

  • meshData kick.mesh.MeshData
  • updateVertexData Boolean
  • updateIndices Boolean
  • updateVertexStructure Boolean
  • updateBoundingbox Boolean

Example:

 // Usual use case: Only update vertex data when updating an existing mesh
 mesh.setMeshData(meshData, true);

verify

(
  • shader
)
Array_String

This function verifies that the mesh has the vertex attributes (normals, uvs, tangents) that the shader uses.

Parameters:

Returns:

Array_String:

list of missing vertex attributes in mesh or null if no missing attributes

Properties

aabb

kick.math.Aabb

Axis aligned bounding box. Readonly.

dataURI

String

The resource url of the mesh. Setting this property will try to load the meshData.

meshData

kick.mesh.MeshData

Setting this property to something will update the data in WebGL. Note that changing a MeshData object will not itself update anything.

name

String