feat: basic improvements, unused includes

This commit is contained in:
2025-10-05 16:39:20 +02:00
parent 431d723afc
commit 6cef3efbbc
13 changed files with 25 additions and 33 deletions

View File

@ -1,8 +1,6 @@
#ifndef RENDERER_DEBUG_
#define RENDERER_DEBUG_
#include <iostream>
#include <GL/glew.h>
void MessageCallback(GLenum source,

View File

@ -12,8 +12,6 @@
class Engine {
public:
static void Run(std::unique_ptr<IApplication> app);
private:
void HandleWindowResized(const WindowResized& event);
private:
static std::unique_ptr<IApplication> s_app;
static std::shared_ptr<Window> s_window;

View File

@ -13,9 +13,9 @@ public: // TODO: abstract away
std::vector<Vertex> m_vertexBuffer;
std::vector<unsigned int> m_indexBuffer;
public: // TODO: abstract away
void Bind() { glBindVertexArray(m_vao); }
void Bind() const { glBindVertexArray(m_vao); }
void Unbind() { glBindVertexArray(0); }
void Upload();
void Upload() const;
public:
std::string materialName;
public:

View File

@ -1,10 +1,8 @@
#ifndef SHADER_H
#define SHADER_H
#include <iostream>
#include <string>
#include <GL/glew.h>
#include <glm/glm.hpp>
class Shader

View File

@ -4,14 +4,13 @@
#include <memory>
class Texture {
private:
unsigned int m_id;
private:
public:
Texture() {}
Texture() : m_id(0) {}
static std::unique_ptr<Texture> LoadFile(const std::string& filename);
public:
inline const unsigned int GetID() const { return m_id; }
[[nodiscard]] unsigned int GetID() const { return m_id; }
private:
unsigned int m_id;
};
#endif // TEXTURE_H_

View File

@ -8,24 +8,13 @@
#include <memory>
#include "shader.h"
#include "texture.h"
#include "renderer/material.h"
#include "renderer/basics.h"
#include "renderer/mesh.h"
enum ObjElement { OHASH, MTLLIB, USEMTL, O, V, VN, VT, F, OUNKNOWN };
enum MtlElement { MHASH, NEWMTL, NS, KA, KS, KD, NI, D, ILLUM, MAP_KD, MAP_KA, MUNKNOWN };
class Object {
private:
std::string m_name;
std::vector<glm::vec3> m_vertices;
std::vector<glm::vec3> m_normals;
std::vector<glm::vec2> m_texCoords;
std::vector<Mesh> m_meshes;
std::unordered_map<std::string, std::shared_ptr<Material>> m_materials;
private:
static inline int NormalizeIndex(int idx, int baseCount);
@ -46,6 +35,15 @@ private:
void CreateNewMesh(const std::string& materialName);
public:
void Render(Shader& shader);
private:
std::string m_name;
std::vector<glm::vec3> m_vertices;
std::vector<glm::vec3> m_normals;
std::vector<glm::vec2> m_texCoords;
std::vector<Mesh> m_meshes;
std::unordered_map<std::string, std::shared_ptr<Material>> m_materials;
};
#endif // MODEL_H_