BBMOD_Model

A constructor defined in BBMOD_Model.gml

Extends BBMOD_Resource
Implements BBMOD_IRenderable

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 can be either a material struct or just a texture if you don't wish to use BBMOD's material system. 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.

Inherited properties

Name Description
IsLoaded If false then the resource has not been loaded yet.
Path The path to the file from which was the resource loaded, or undefined if the resource does not come from a file.
Persistent If true then the resource is persistent and it is not destroyed when method free is used. Default value is false.

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.

Inherited methods

Name Description
destroy Frees memory used by the struct.
free Releases a reference to the resource.
from_buffer Loads the resource from a buffer.
from_file Loads the resource from a file.
from_file_async Asynchronnously loads the resource from a file.
ref Retrieves a reference to the resource.
to_buffer Writes the resource to a buffer.
to_file Writes a resource to a file.

Throws

Example

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

Copyright © 2024, BlueBurn. Built on January 21, 2024 using GMDoc.