Organizing the storage of mesh data
In Chapter 3, Getting Started with OpenGL and Vulkan and Chapter 4, Adding User Interaction and Productivity Tools, we used fixed formats for our meshes, which changed between demos and also implicitly included a description of the material; for example, a hardcoded texture was used to provide color information. Let's define a unified mesh storage format that covers all use cases for the remainder of this book.
A triangle mesh is defined by indices and vertices. Each vertex is defined as a set of floating-point attributes. All of the auxiliary physical properties of an object, such as collision detection data, mass, and moments of inertia, can be represented by a mesh. In comparison, other information, such as surface material properties, can be stored outside of the mesh as external metadata.
Getting ready
This recipe describes the basic data structures that we will use to store mesh data for the remainder of this book. The full corresponding...