kick.mesh.Mesh Class
A Mesh object allows you to bind and render a MeshData object
Constructor
kick.mesh.Mesh
-
config
Parameters:
-
configObject
Item Index
Methods
bind
-
shader
Bind the vertex attributes of the mesh to the shader
Parameters:
-
shaderkick.material.Shader
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:
-
configObjectconfiguration 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:
-
submeshIndexNumber
setDataURI
-
newValue -
automaticGetMeshData -
resourceTracker
Parameters:
-
newValueString -
automaticGetMeshDataBooleanoptional. if true the mesh data is attempted to be loaded by resourceLoader.getMeshData
-
resourceTrackerResourceTrackerOptional
toJSON
()
Object
Returns:
data object
updateData
-
updateVertexData -
updateIndices -
updateVertexStructure
Copy data to the vertex buffer object (VBO)
Parameters:
-
updateVertexDataBoolean -
updateIndicesBoolean -
updateVertexStructureBoolean
updateMeshData
-
meshData -
updateVertexData -
updateIndices -
updateVertexStructure -
updateBoundingbox
Gives more control over what parts of mesh data is uploaded to the GPU.
Parameters:
-
meshDatakick.mesh.MeshData -
updateVertexDataBoolean -
updateIndicesBoolean -
updateVertexStructureBoolean -
updateBoundingboxBoolean
Example:
// Usual use case: Only update vertex data when updating an existing mesh
mesh.setMeshData(meshData, true);
verify
-
shader
This function verifies that the mesh has the vertex attributes (normals, uvs, tangents) that the shader uses.
Parameters:
-
shaderkick.material.Shader
Returns:
list of missing vertex attributes in mesh or null if no missing attributes
Properties
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.
