Grouping Meshes

Sub-Meshes

When you have 50 wall blocks in your room, if you use a mesh foreach instance, the engine has to cycle each mesh and render each shadow for each light.

To avoid this issue, you can group meshes to have a single big mesh.

In Glare a mesh, can contain multiple sub-meshes. When you call glr_mesh_update, they will be grouped into a single one.

For example:

//create a static mesh
mesh = glr_mesh_create(x, y, true);
//Add a box
//glr_mesh_submesh_add_box(mesh, width, height, xoffset, yoffset);
glr_mesh_submesh_add_box(mesh, 32, 32, 0, 0);
//Add a circle
//glr_mesh_submesh_add_circle(mesh, radius, num_vertices, xoffset, yoffset);
glr_mesh_submesh_add_circle(mesh, 16, 10, 64, 16);
//finalize the mesh
glr_mesh_update(mesh);
note

You can use all glr_mesh_submesh_* functions to add submeshes to your mesh.

tip

Take advantage of submeshes and group as many static meshes as you can.