feat: basic improvements, unused includes
This commit is contained in:
@ -1,8 +1,6 @@
|
||||
#ifndef APPLICATION_H_
|
||||
#define APPLICATION_H_
|
||||
|
||||
#include "window/event.h"
|
||||
|
||||
class IApplication {
|
||||
public:
|
||||
virtual ~IApplication() = default;
|
||||
|
@ -1,8 +1,6 @@
|
||||
#ifndef RENDERER_DEBUG_
|
||||
#define RENDERER_DEBUG_
|
||||
|
||||
#include <iostream>
|
||||
|
||||
#include <GL/glew.h>
|
||||
|
||||
void MessageCallback(GLenum source,
|
||||
|
@ -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;
|
||||
|
@ -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:
|
||||
|
@ -1,10 +1,8 @@
|
||||
#ifndef SHADER_H
|
||||
#define SHADER_H
|
||||
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include <GL/glew.h>
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
class Shader
|
||||
|
@ -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_
|
||||
|
@ -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_
|
@ -6,7 +6,6 @@
|
||||
#include <typeindex>
|
||||
#include <unordered_map>
|
||||
#include <vector>
|
||||
#include <typeindex>
|
||||
|
||||
class EventDispatcher {
|
||||
using Type = std::type_index;
|
||||
|
Reference in New Issue
Block a user