♻️ (engine): store Mesh3D objects as unique_ptr for safer memory handling

This commit is contained in:
Djalim Simaila 2025-10-24 09:50:00 +02:00
parent 0ffaffc83e
commit 646efa9383
2 changed files with 3 additions and 1 deletions

View File

@ -13,6 +13,7 @@ namespace djalim {
Mesh3D(const std::string& filepath);
std::vector<float> meshVertices;
int numMeshVertices = 0;
int numFaces = 0;
void loadOBJFile(const std::string& filepath);
Texture2D texture;
GLuint VBO;

View File

@ -6,6 +6,7 @@
#include "ShaderProgram.h"
#include "Texture2D.h"
#include <map>
#include <memory>
#include <sstream>
#include <string>
#include <vector>
@ -21,7 +22,7 @@ struct Object3D {
GLuint VAO;
};
typedef std::map<std::string,djalim::Mesh3D> Objects3D;
typedef std::map<std::string,std::unique_ptr<djalim::Mesh3D>> Objects3D;
static bool gWireframe = false;