Game Development Reference
In-Depth Information
How it works...
This recipe is mostly about creating meshes that are as optimized as possible. Cubes are
great building blocks, but each has 12 triangles, and rendering them all for hundreds or
thousands will quickly slow down most systems. In the first part of the recipe, we imple-
mented functionalities to create meshes that only had the exposed sides of the cube's gener-
ated triangles. We found this out by checking which of the positions next to the cube were
occupied by other cubes.
Once all the cubes were generated, we added them to BatchNode and batched it to create
one mesh for all the cubes. Even if the polygon count is the same, decreasing the number of
objects greatly enhances the performance.
Having a single mesh means we can't change a single object in the mesh without regenerat-
ing the whole batch. If we plan to scale this up and generate a whole world, we need to
keep the size of the batch to a size where we can regenerate it without creating slowdowns.
Exploring a way to generate it on a separate thread might be a good next step.
Search WWH ::




Custom Search