BBMOD_Model

Extends BBMOD_Resource
Implements BBMOD_IRenderable

constructor

new BBMOD_Model([_file[, _sha1]])

Description

A model.

Arguments

Name Type Description
_file String The "*.bbmod" model file to load or undefined. Defaults to undefined.
_sha1 String Expected SHA1 of the file. If the actual one does not match with this, then the model will not be loaded. Use undefined if you do not want to check the SHA1 of the file. Defaults to undefined.

Properties

Name Description
BoneCount Number of bones.
Frozen If true then the model is frozen.
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.
Meshes Array of meshes.
NodeCount Number of nodes.
RootNode The root node.
VersionMajor The major version of the model file.
VersionMinor The minor version of the model file.
VertexFormat OBSOLETE The vertex format of the model.

Methods

Name Description
clone Creates a clone of the model.
copy Copies model data into another model.
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 DEPRECATED Used to retrieve or create a vertex format compatible with the model.
render Enqueues the model for rendering.
set_material Sets a material.
submit Immediately submits the model for rendering.
to_buffer Writes model data to a buffer.

Throws

Example

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

Copyright © 2023, BlueBurn. Built on March 24, 2023 using GMDoc.