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.render, 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
|destroy||Frees memory used by the dynamic batch. Use this in combination with
|freeze||Freezes the dynamic batch. This makes it render faster.|
|render||Submits the dynamic batch for rendering.|
|render_object||Renders all instances of an object in batches of BBMOD_DynamicBatch.size.|
Following code renders all instances of a car object in batches of 64.
/// @desc Create event mod_car = new BBMOD_Model("Car.bbmod"); mat_car = new BBMOD_Material(BBMOD_ShDefaultBatched, sprite_get_texture(SprCar, 0)); car_batch = new BBMOD_DynamicBatch(mod_car, 64); /// @desc Draw event car_batch.render_object(OCar, mat_car);
Copyright © 2020, BlueBurn. Built on November 30, 2020 using GMDoc.