Adding LOD to the Model Class
The Model class is being slightly restructured to add support for built-in LOD without the need for separate entities. Previously, a list of surfaces was included in the Model class itself:
class Model { std::vector<shared_ptr<Surface> > surfaces; };
This is being replaced with a new LOD class, which allows multiple lists of surfaces containing less detail to be stored in the same model:
class LOD { std::vector<shared_ptr<Surface> > surfaces; }; class Model { std::vector<LOD> lods; };
To iterate through all surfaces in the first LOD, you do this:
for (int i = 0; i < model->lods[0].surfaces.size(); ++i) { auto surf = lods[0].surfaces[i]; }
To iterate through all LODs and all surfaces, you do this:
for (int n = 0; n < model->lods.size(); ++n) { for (int i = 0; i < model->lods[n].surfaces.size(); ++i) { auto surf = lods[n].surfaces[i]; } }
In the future editor, I plan to add a feature to automatically reduce the detail of a mesh, adding the simplified mesh as an additional LOD level so you can automatically generate these.
How this will work with our super-efficient batching system, I am not sure of yet.
- 1
4 Comments
Recommended Comments