A function defined in BBMOD_DynamicBatch.gml
submit_object(_object[, _materials[, _fn]])
Immediately submits all instances of an object for rendering in batches of BBMOD_DynamicBatch.size.
Name | Type | Description |
---|---|---|
_object | Real |
An object to submit. |
_materials | Array<Struct.BBMOD_Materials> |
An array of materials to use. |
_fn | Function |
A function that writes instance data to an array which is then passed to the material's shader. Defaults to BBMOD_DynamicBatch.default_fn if undefined . |
Struct.BBMOD_DynamicBatch
Returns self
.
carBatch.submit_object(OCar, [matCar], function (_data, _index) {
// Position
_data[@ _index] = x;
_data[@ _index + 1] = y;
_data[@ _index + 2] = z;
// Uniform scale
_data[@ _index + 3] = image_xscale;
// Rotation
new BBMOD_Quaternion()
.FromAxisAngle(BBMOD_VEC3_UP, image_angle)
.ToArray(_data, _index + 4);
// ID
_data[@ _index + 8] = ((id & $000000FF) >> 0) / 255;
_data[@ _index + 9] = ((id & $0000FF00) >> 8) / 255;
_data[@ _index + 10] = ((id & $00FF0000) >> 16) / 255;
_data[@ _index + 11] = ((id & $FF000000) >> 24) / 255;
});
The function defined in this example is actually the implementation of BBMOD_DynamicBatch.DataWriter. You can use this to create you own variation of it.
BBMOD_DynamicBatch.DataWriter, BBMOD_DynamicBatch.render, BBMOD_DynamicBatch.render_object, BBMOD_DynamicBatch.submit
Copyright © 2024, BlueBurn. Built on September 07, 2024 using GMDoc.