BBMOD_Model

Extends BBMOD_Resource
Implements Struct.BBMOD_IRenderable

constructor

new BBMOD_Model([_file[, _sha1]])

Description

A model.

Arguments

Name Type Description
_file String/Undefined The "*.bbmod" model file to load.
_sha1 String/Undefined Expected SHA1 of the file. If the actual one does not match with this, then the model will not be loaded.

Properties

Name Description
BoneCount Number of bones.
MaterialCount Number of materials that the model uses.
MaterialNames An array of material names.
Materials An array of materials. Each entry defaults to BBMOD_MATERIAL_DEFAULT or BBMOD_MATERIAL_DEFAULT_ANIMATED for animated models.
Meshes Array of meshes.
NodeCount Number of nodes.
RootNode The root node.
Version OBSOLETE The version of the model file.
VersionMajor The major version of the model file.
VersionMinor The minor version of the model file.
VertexFormat The vertex format of the model.

Methods

Name Description
find_node Finds a node by its name or id.
find_node_id Finds id of the model's node by its name.
freeze Freezes all vertex buffers used by the model. This should make its rendering faster, but it disables creating new batches of the model.
from_buffer Loads model data from a buffer.
get_material Retrieves a material by its name.
get_vertex_format Retrieves or creates a vertex format compatible with the model. This can be used when creating a BBMOD_StaticBatch.
render Enqueues the model for rendering.
set_material Sets a material.
submit Immediately submits the model for rendering.

Throws

Example

try
{
    modCharacter = new BBMOD_Model("Character.bbmod");
}
catch (_error)
{
    // The model failed to load!
}
Do you find this page helpful?

Copyright © 2022, BlueBurn. Built on May 18, 2022 using GMDoc.