kick.mesh.Mesh Class
A Mesh object allows you to bind and render a MeshData object
Constructor
kick.mesh.Mesh
-
config
Parameters:
-
config
Object
Item Index
Methods
bind
-
shader
Bind the vertex attributes of the mesh to the shader
Parameters:
-
shader
kick.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:
-
config
Objectconfiguration 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
Booleanoptional. if true the mesh data is attempted to be loaded by resourceLoader.getMeshData
-
resourceTracker
ResourceTrackerOptional
toJSON
()
Object
Returns:
data object
updateData
-
updateVertexData
-
updateIndices
-
updateVertexStructure
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
This function verifies that the mesh has the vertex attributes (normals, uvs, tangents) that the shader uses.
Parameters:
-
shader
kick.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.