BBMOD_StaticBatch

constructor

new BBMOD_StaticBatch(_vformat)

Description

A static batch is a structure that allows you to compose static models into a single one. Compared to BBMOD_Model.render, this drastically reduces draw calls and increases performance, but requires more memory. Current limitation is that the added models must use the same single material.

Arguments

Name Type Description
_vformat BBMOD_VertexFormat The vertex format of the static batch. All models added to the same static batch must have the same vertex format. This vertex format must not contain bone data!

Methods

Name Description
add Adds a model to the static batch.
destroy Frees memory used by the static batch. Use this in combination with delete to destroy a static batch struct.
finish Ends adding models into the static batch.
freeze Freezes the static batch. This makes it render faster, but disables adding more models.
render Submits the static batch for rendering.
start Begins adding models into the static batch.

Example

mod_tree = new BBMOD_Model("Tree.bbmod");
var _vformat = mod_tree.get_vertex_format();
batch = new BBMOD_StaticBatch(_vformat);
batch.start();
with (OTree)
{
    var _transform = matrix_build(x, y, z, 0, 0, direction, 1, 1, 1);
    other.batch.add(other.mod_tree, _transform);
}
batch.finish();
batch.freeze();

See

BBMOD_DynamicBatch, BBMOD_Model.get_vertex_format

Do you find this page helpful?

Copyright © 2020, BlueBurn. Built on September 14, 2020 using GMDoc.