This commit is contained in:
2026-02-27 19:02:52 +03:00
parent e92104e41b
commit 5434239b47
6 changed files with 368 additions and 335 deletions

48
src/render/model.h Normal file
View File

@@ -0,0 +1,48 @@
#ifndef MODEL_H
#define MODEL_H
#include <vector>
#include "boundingbox.h"
#include "render_shared.h"
#include <glm/glm.hpp>
#include <glm/gtc/type_ptr.hpp>
class GPUBuffer;
class Texture2D;
struct ModelData_t
{
GPUBuffer* vb;
GPUBuffer* ib;
uint32_t vbcount;
uint32_t ibcount;
};
void ReleaseModelData(ModelData_t& data);
class Render;
class Model
{
friend class Render;
public:
Model();
~Model();
void LoadObj(const char* filename);
void LoadMtl(const char* filename);
void Draw(const glm::mat4& model, bool isTransparent = false);
const BoundingBox& GetBoundingBox() { return m_boundingBox; }
private:
std::vector<StaticMeshVertex> m_Vertices;
ModelData_t m_data;
BoundingBox m_boundingBox;
Texture2D* m_AlbedoTexture;
};
#endif // !MODEL_H