new BBMOD_DynamicBatch(_model, _size)
A dynamic batch is a structure that allows you to render multiple instances of a single model at once, each with its own position, scale and rotation. Compared to BBMOD_Model.submit, this drastically reduces draw calls and increases performance, but requires more memory. Current limitations are that the model must not have bones (it cannot be animated) and it can use only a single material. Number of model instances per batch is also affected by maximum number of uniforms that a vertex shader can accept.
||The model to create a dynamic batch of. Must use a single material and must not have bones.|
||Number of model instances in the batch.|
|default_fn||The default function used in BBMOD_DynamicBatch.render_object. Uses instance's variables
|freeze||Freezes the dynamic batch. This makes it render faster.|
|render||Enqueues the dynamic batch for rendering.|
|render_object||Enqueues all instances of an object for rendering in batches of BBMOD_DynamicBatch.size.|
|submit||Immediately submits the dynamic batch for rendering.|
|submit_object||Immediately submits all instances of an object for rendering in batches of BBMOD_DynamicBatch.size.|
Following code renders all instances of a car object in batches of 64.
/// @desc Create event modCar = new BBMOD_Model("Car.bbmod"); matCar = new BBMOD_DefaultMaterial(BBMOD_ShDefaultBatched, sprite_get_texture(SprCar, 0)); carBatch = new BBMOD_DynamicBatch(modCar, 64); /// @desc Draw event carBatch.render_object(OCar, matCar);
Copyright © 2022, BlueBurn. Built on September 19, 2022 using GMDoc.