Eliminate block of useless indices from EllipsoidTilesetLoader.

EllipsoidTilesetLoader was passing a size to the constructor for the
std::vector used to store the indices, and then it was also adding the
indices by calling `insert`. That resulted in a giant block of useless
(0,0,0) indices, followed by the useful ones created by the insert.

This change uses `reserve` instead of passing a size to the constructor.
This commit is contained in:
Kevin Ring 2024-11-19 20:45:27 +11:00
parent e56c5d776c
commit a6e2c8b05f
1 changed files with 3 additions and 1 deletions

View File

@ -122,7 +122,9 @@ EllipsoidTilesetLoader::Geometry
EllipsoidTilesetLoader::createGeometry(const Tile& tile) const {
static constexpr uint16_t resolution = 24;
std::vector<uint16_t> indices(6 * (resolution - 1) * (resolution - 1));
std::vector<uint16_t> indices;
indices.reserve(6 * (resolution - 1) * (resolution - 1));
std::vector<glm::vec3> vertices(resolution * resolution);
std::vector<glm::vec3> normals(vertices.size());