In this recipe, we'll build a small framework to generate optimized cube meshes, which can be used to create large-scale worlds. This framework will consist of an
AppState object to handle user actions, a class called
CubeWorld that will store the terrain data, and a class called
CubeCell that will store the data for individual cells. In addition, there is a
CubeUtil class that will help us to generate meshes.
This is an advanced recipe that requires an understanding the generation of a basic terrain, which can be found earlier in the chapter, and the building blocks of meshes and how to create custom meshes.
Before we begin, we will create a class called
CubeUtil and populate it with some shaped ...