continued with asset loader
This commit is contained in:
5
default_assets/shaders/phong.shader
Normal file
5
default_assets/shaders/phong.shader
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"name": "phong",
|
||||
"vertex": "phong.vert",
|
||||
"fragment": "phong.frag"
|
||||
}
|
||||
|
Before Width: | Height: | Size: 8.3 MiB After Width: | Height: | Size: 8.3 MiB |
@@ -1,12 +0,0 @@
|
||||
# Blender 3.6.0 MTL File: 'None'
|
||||
# www.blender.org
|
||||
|
||||
newmtl 01_-_Default.001
|
||||
Ns 10.000005
|
||||
Ka 1.000000 1.000000 1.000000
|
||||
Ks 0.000000 0.000000 0.000000
|
||||
Ke 0.000000 0.000000 0.000000
|
||||
Ni 1.450000
|
||||
d 1.000000
|
||||
illum 1
|
||||
map_Kd Corvette_C4_Base_Color.png
|
||||
@@ -1,46 +0,0 @@
|
||||
# Blender v2.76 (sub 0) OBJ File: ''
|
||||
# www.blender.org
|
||||
mtllib cube.mtl
|
||||
o Cube
|
||||
v 1.000000 -1.000000 -1.000000
|
||||
v 1.000000 -1.000000 1.000000
|
||||
v -1.000000 -1.000000 1.000000
|
||||
v -1.000000 -1.000000 -1.000000
|
||||
v 1.000000 1.000000 -0.999999
|
||||
v 0.999999 1.000000 1.000001
|
||||
v -1.000000 1.000000 1.000000
|
||||
v -1.000000 1.000000 -1.000000
|
||||
vt 1.000000 0.333333
|
||||
vt 1.000000 0.666667
|
||||
vt 0.666667 0.666667
|
||||
vt 0.666667 0.333333
|
||||
vt 0.666667 0.000000
|
||||
vt 0.000000 0.333333
|
||||
vt 0.000000 0.000000
|
||||
vt 0.333333 0.000000
|
||||
vt 0.333333 1.000000
|
||||
vt 0.000000 1.000000
|
||||
vt 0.000000 0.666667
|
||||
vt 0.333333 0.333333
|
||||
vt 0.333333 0.666667
|
||||
vt 1.000000 0.000000
|
||||
vn 0.000000 -1.000000 0.000000
|
||||
vn 0.000000 1.000000 0.000000
|
||||
vn 1.000000 0.000000 0.000000
|
||||
vn -0.000000 0.000000 1.000000
|
||||
vn -1.000000 -0.000000 -0.000000
|
||||
vn 0.000000 0.000000 -1.000000
|
||||
usemtl Material
|
||||
s off
|
||||
f 2/1/1 3/2/1 4/3/1
|
||||
f 8/1/2 7/4/2 6/5/2
|
||||
f 5/6/3 6/7/3 2/8/3
|
||||
f 6/8/4 7/5/4 3/4/4
|
||||
f 3/9/5 7/10/5 8/11/5
|
||||
f 1/12/6 4/13/6 8/11/6
|
||||
f 1/4/1 2/1/1 4/3/1
|
||||
f 5/14/2 8/1/2 6/5/2
|
||||
f 1/12/3 5/6/3 2/8/3
|
||||
f 2/12/4 6/8/4 3/4/4
|
||||
f 4/13/5 3/9/5 8/11/5
|
||||
f 5/6/6 1/12/6 8/11/6
|
||||
73398
resources/male.obj
73398
resources/male.obj
File diff suppressed because it is too large
Load Diff
@@ -9,7 +9,8 @@
|
||||
#include <fstream>
|
||||
#include <unordered_set>
|
||||
|
||||
#include "ModelManager.h"
|
||||
#include "MeshManager.h"
|
||||
#include "ModelImporter.h"
|
||||
#include "TextureManager.h"
|
||||
#include "uuid.h"
|
||||
#include "nlohmann/json.hpp"
|
||||
@@ -99,8 +100,7 @@ void AssetRegistry::read_directory(const Path& path) {
|
||||
}
|
||||
|
||||
std::optional<AssetRecord> record = read_meta_file(entry.path());
|
||||
if (!record)
|
||||
{
|
||||
if (!record) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -183,17 +183,28 @@ bool AssetRegistry::generate_meta_file(const Path& path)
|
||||
return true;
|
||||
}
|
||||
|
||||
void AssetRegistry::load_asset(AssetRecord* asset) {
|
||||
void AssetRegistry::load_asset(const AssetRecord* asset) {
|
||||
switch (asset->assetType) {
|
||||
case AssetType::SHADER:
|
||||
break;
|
||||
case AssetType::TEXTURE:
|
||||
TextureManager::textures[asset->uuid] = TextureManager::load_from_file(asset->sourcePath);
|
||||
break;
|
||||
case AssetType::MODEL:
|
||||
ModelManager::models[asset->uuid] = ModelManager::load_from_file(asset->sourcePath);
|
||||
break;
|
||||
default:
|
||||
return;
|
||||
case AssetType::TEXTURE: {
|
||||
ResourceHandle handle;
|
||||
handle.assetUUID = asset->uuid;
|
||||
TextureManager::textures[handle] = TextureManager::load_from_file(asset->sourcePath);
|
||||
return;
|
||||
}
|
||||
case AssetType::MODEL: {
|
||||
std::vector<Mesh> meshes = ModelImporter::load_from_file(asset->sourcePath);
|
||||
for (int i = 0; i < meshes.size(); i++) {
|
||||
ResourceHandle meshHandle;
|
||||
meshHandle.assetUUID = asset->uuid;
|
||||
meshHandle.localId = i + 1;
|
||||
MeshManager::meshes[meshHandle] = std::make_unique<Mesh>(meshes[i]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
case AssetType::DIRECTORY:
|
||||
case AssetType::UNKNOWN:
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ private:
|
||||
static bool does_meta_exist(const Path& path);
|
||||
static std::optional<AssetRecord> read_meta_file(const Path& path);
|
||||
static bool generate_meta_file(const Path& path);
|
||||
static void load_asset(AssetRecord* asset);
|
||||
static void load_asset(const AssetRecord* asset);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
#define B_ENGINE_COMPONENTS_H
|
||||
|
||||
#include "Model.h"
|
||||
#include "ResourceHandle.h"
|
||||
|
||||
#include "entt/entt.hpp"
|
||||
#include "glm/glm.hpp"
|
||||
@@ -27,8 +28,8 @@ namespace Components {
|
||||
entt::entity next_sibling {entt::null};
|
||||
};
|
||||
|
||||
struct Drawable {
|
||||
std::shared_ptr<Model> model {nullptr};
|
||||
struct Mesh {
|
||||
ResourceHandle handle;
|
||||
};
|
||||
|
||||
struct DirectionalLight {
|
||||
@@ -41,6 +42,10 @@ namespace Components {
|
||||
struct Tag {
|
||||
std::string name;
|
||||
};
|
||||
|
||||
struct Material {
|
||||
ResourceHandle handle;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,11 +5,9 @@
|
||||
#ifndef B_ENGINE_MATERIAL_H
|
||||
#define B_ENGINE_MATERIAL_H
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
|
||||
#include "Texture.h"
|
||||
#include "ResourceHandle.h"
|
||||
|
||||
typedef struct
|
||||
{
|
||||
@@ -21,12 +19,9 @@ typedef struct
|
||||
|
||||
typedef struct
|
||||
{
|
||||
std::shared_ptr<Texture> diffuse;
|
||||
std::shared_ptr<Texture> specular;
|
||||
std::shared_ptr<Texture> normal;
|
||||
|
||||
std::string name;
|
||||
|
||||
ResourceHandle diffuse;
|
||||
ResourceHandle specular;
|
||||
ResourceHandle normal;
|
||||
PhongProperties phong;
|
||||
} Material;
|
||||
|
||||
|
||||
7
src/MaterialManager.cpp
Normal file
7
src/MaterialManager.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
//
|
||||
// Created by slinky on 5/17/26.
|
||||
//
|
||||
|
||||
#include "MaterialManager.h"
|
||||
|
||||
std::unordered_map<ResourceHandle, std::unique_ptr<Material>> MaterialManager::materials = {};
|
||||
17
src/MaterialManager.h
Normal file
17
src/MaterialManager.h
Normal file
@@ -0,0 +1,17 @@
|
||||
//
|
||||
// Created by slinky on 5/17/26.
|
||||
//
|
||||
|
||||
#ifndef B_ENGINE_MATERIALMANAGER_H
|
||||
#define B_ENGINE_MATERIALMANAGER_Hs
|
||||
#include <unordered_map>
|
||||
|
||||
#include "Material.h"
|
||||
#include "ResourceHandle.h"
|
||||
|
||||
class MaterialManager {
|
||||
public:
|
||||
static std::unordered_map<ResourceHandle, std::unique_ptr<Material>> materials;
|
||||
};
|
||||
|
||||
#endif //B_ENGINE_MATERIALMANAGER_H
|
||||
@@ -21,7 +21,6 @@ public:
|
||||
GLuint vao = 0;
|
||||
GLuint ebo = 0;
|
||||
unsigned int numIndices = 0;
|
||||
unsigned int materialId = 0;
|
||||
};
|
||||
|
||||
#endif //B_ENGINE_MESH_H
|
||||
7
src/MeshManager.cpp
Normal file
7
src/MeshManager.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
//
|
||||
// Created by slinky on 5/17/26.
|
||||
//
|
||||
|
||||
#include "MeshManager.h"
|
||||
|
||||
std::unordered_map<ResourceHandle, std::unique_ptr<Mesh>> MeshManager::meshes;
|
||||
18
src/MeshManager.h
Normal file
18
src/MeshManager.h
Normal file
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// Created by slinky on 5/17/26.
|
||||
//
|
||||
|
||||
#ifndef B_ENGINE_MESHMANAGER_H
|
||||
#define B_ENGINE_MESHMANAGER_H
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "ResourceHandle.h"
|
||||
#include "Mesh.h"
|
||||
|
||||
class MeshManager {
|
||||
public:
|
||||
static std::unordered_map<ResourceHandle, std::unique_ptr<Mesh>> meshes;
|
||||
};
|
||||
|
||||
#endif //B_ENGINE_MESHMANAGER_H
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
#include <spdlog/spdlog.h>
|
||||
|
||||
#include "ModelManager.h"
|
||||
#include "ModelImporter.h"
|
||||
|
||||
#include <assimp/Importer.hpp>
|
||||
#include <assimp/postprocess.h>
|
||||
@@ -15,8 +15,6 @@
|
||||
#include "TextureManager.h"
|
||||
#include "glm/ext/matrix_transform.hpp"
|
||||
|
||||
std::unordered_map<uuids::uuid, std::unique_ptr<Model>> ModelManager::models;
|
||||
|
||||
void process_ai_node(aiNode* node, const aiScene* scene, glm::mat4 transform, ModelNode& model);
|
||||
void process_ai_mesh(const aiMesh* aiMesh, Mesh& mesh);
|
||||
|
||||
@@ -31,7 +29,7 @@ auto zUpMatrix = glm::mat4(
|
||||
0.0f, 0.0f, 0.0f, 1.0f // Column 3
|
||||
);
|
||||
|
||||
std::unique_ptr<Model> ModelManager::load_from_file(std::string_view _path, bool zUp)
|
||||
std::vector<Mesh> ModelImporter::load_from_file(std::string_view _path, bool zUp)
|
||||
{
|
||||
Assimp::Importer importer;
|
||||
|
||||
@@ -43,39 +41,19 @@ std::unique_ptr<Model> ModelManager::load_from_file(std::string_view _path, bool
|
||||
if (!scene || scene->mFlags & AI_SCENE_FLAGS_INCOMPLETE || !scene->mRootNode)
|
||||
{
|
||||
spdlog::error("failed to load model {}: {}", _path, importer.GetErrorString());
|
||||
return nullptr;
|
||||
return {};
|
||||
}
|
||||
|
||||
auto model = std::make_unique<Model>();
|
||||
|
||||
const std::filesystem::path modelPath = {_path};
|
||||
/*for (unsigned int i = 0; i < scene->mNumMaterials; i++) {
|
||||
aiMaterial* aiMat = scene->mMaterials[i];
|
||||
aiString matName;
|
||||
if (aiMat->Get(AI_MATKEY_NAME, matName) && strcmp(matName.data, "DefaultMaterial") == 0) {
|
||||
continue;
|
||||
}
|
||||
Material mat{};
|
||||
process_ai_material(aiMat, mat, modelPath.parent_path());
|
||||
model->materials.push_back(std::make_shared<Material>(mat));
|
||||
}*/
|
||||
auto meshes = std::vector<Mesh>{};
|
||||
|
||||
for (unsigned int i = 0; i < scene->mNumMeshes; i++) {
|
||||
aiMesh* aiMesh = scene->mMeshes[i];
|
||||
Mesh mesh{};
|
||||
mesh.materialId = aiMesh->mMaterialIndex;
|
||||
process_ai_mesh(aiMesh, mesh);
|
||||
model->meshes.push_back(std::make_shared<Mesh>(mesh));
|
||||
meshes.push_back(mesh);
|
||||
}
|
||||
|
||||
auto transform = glm::identity<glm::mat4>();
|
||||
if (zUp) {
|
||||
transform = zUpMatrix;
|
||||
}
|
||||
|
||||
process_ai_node(scene->mRootNode, scene, transform, model->root);
|
||||
|
||||
return model;
|
||||
return meshes;
|
||||
}
|
||||
|
||||
void process_ai_node(aiNode* aiNode, const aiScene* scene, glm::mat4 transform, ModelNode& node)
|
||||
19
src/ModelImporter.h
Normal file
19
src/ModelImporter.h
Normal file
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// Created by lbmas on 4/29/2026.
|
||||
//
|
||||
|
||||
#ifndef B_ENGINE_MODELIMPORTER_H
|
||||
#define B_ENGINE_MODELIMPORTER_H
|
||||
|
||||
#include <string_view>
|
||||
|
||||
#include "Model.h"
|
||||
|
||||
class ModelImporter
|
||||
{
|
||||
public:
|
||||
static std::vector<Mesh> load_from_file(std::string_view _path, bool zUp = false);
|
||||
};
|
||||
|
||||
|
||||
#endif //B_ENGINE_MODELIMPORTER_H
|
||||
@@ -1,23 +0,0 @@
|
||||
//
|
||||
// Created by lbmas on 4/29/2026.
|
||||
//
|
||||
|
||||
#ifndef B_ENGINE_MODELLOADER_H
|
||||
#define B_ENGINE_MODELLOADER_H
|
||||
|
||||
#include <memory>
|
||||
#include <string_view>
|
||||
|
||||
#include "Model.h"
|
||||
#include "uuid.h"
|
||||
|
||||
class ModelManager
|
||||
{
|
||||
public:
|
||||
static std::unordered_map<uuids::uuid, std::unique_ptr<Model>> models;
|
||||
|
||||
static std::unique_ptr<Model> load_from_file(std::string_view _path, bool zUp = false);
|
||||
};
|
||||
|
||||
|
||||
#endif //B_ENGINE_MODELLOADER_H
|
||||
32
src/ResourceHandle.h
Normal file
32
src/ResourceHandle.h
Normal file
@@ -0,0 +1,32 @@
|
||||
//
|
||||
// Created by slinky on 5/17/26.
|
||||
//
|
||||
|
||||
#ifndef B_ENGINE_RESOURCEHANDLE_H
|
||||
#define B_ENGINE_RESOURCEHANDLE_H
|
||||
|
||||
#include "uuid.h"
|
||||
|
||||
struct ResourceHandle {
|
||||
uuids::uuid assetUUID;
|
||||
uint32_t localId = 0;
|
||||
|
||||
bool operator==(const ResourceHandle& other) const {
|
||||
return assetUUID == other.assetUUID && localId == other.localId;
|
||||
}
|
||||
};
|
||||
|
||||
namespace std {
|
||||
template<>
|
||||
struct hash<ResourceHandle> {
|
||||
size_t operator()(const ResourceHandle& handle) const noexcept {
|
||||
// Use the UUID library's native hash function
|
||||
size_t h1 = std::hash<uuids::uuid>{}(handle.assetUUID);
|
||||
size_t h2 = std::hash<uint32_t>{}(handle.localId);
|
||||
|
||||
return h1 ^ h2 + 0x9e3779b9 + (h1 << 6) + (h1 >> 2);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
#endif //B_ENGINE_RESOURCEHANDLE_H
|
||||
@@ -5,6 +5,10 @@
|
||||
#include "Scene.h"
|
||||
|
||||
#include "Components.h"
|
||||
|
||||
#include "MeshManager.h"
|
||||
#include "MaterialManager.h"
|
||||
|
||||
#include "fmt/format.h"
|
||||
|
||||
Scene::Scene() {
|
||||
@@ -84,7 +88,7 @@ void Scene::update_transforms(entt::entity entity) {
|
||||
}
|
||||
}
|
||||
|
||||
void Scene::draw_scene(ShaderProgram *program) {
|
||||
void Scene::draw_scene() {
|
||||
program->bind();
|
||||
program->setMat4("projection", activeCamera->projection());
|
||||
program->setMat4("view", activeCamera->view());
|
||||
@@ -100,20 +104,16 @@ void Scene::draw_scene(ShaderProgram *program) {
|
||||
break;
|
||||
}
|
||||
|
||||
auto view = _registry.view<Components::Transform, Components::Drawable>();
|
||||
auto view = _registry.view<Components::Transform, Components::Mesh, Components::Material>();
|
||||
for (const auto e : view) {
|
||||
const auto& transform = view.get<Components::Transform>(e);
|
||||
program->setMat4("model", transform.model);
|
||||
|
||||
const auto& drawable = view.get<Components::Drawable>(e);
|
||||
const Model* model = drawable.model.get();
|
||||
for (const auto& mesh: drawable.model->meshes) {
|
||||
unsigned int materialId = mesh->materialId;
|
||||
if (materialId >= model->materials.size()) {
|
||||
materialId = 0;
|
||||
}
|
||||
const auto&[meshHandle] = view.get<Components::Mesh>(e);
|
||||
const auto* mesh = MeshManager::meshes[meshHandle].get();
|
||||
|
||||
const std::shared_ptr<Material> mat = model->materials[materialId];
|
||||
const auto&[matHandle] = view.get<Components::Material>(e);
|
||||
const auto* mat = MaterialManager::materials[matHandle].get();
|
||||
|
||||
program->setVec3("phongAmbient", mat->phong.ambient);
|
||||
program->setVec3("phongDiffuse", mat->phong.diffuse);
|
||||
@@ -130,10 +130,9 @@ void Scene::draw_scene(ShaderProgram *program) {
|
||||
specular->bind();
|
||||
program->setInt("specularMap", 1);
|
||||
|
||||
glBindVertexArray(mesh.get()->vao);
|
||||
glBindVertexArray(mesh->vao);
|
||||
glDrawElements(GL_TRIANGLES, mesh->numIndices, GL_UNSIGNED_INT, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
entt::entity Scene::get_root() const {
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
}
|
||||
|
||||
void update_transforms();
|
||||
void draw_scene(ShaderProgram* program);
|
||||
void draw_scene();
|
||||
|
||||
[[nodiscard]] entt::entity get_root() const;
|
||||
[[nodiscard]] std::vector<entt::entity> get_children(entt::entity parent);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
void log_shader_compile_errors(GLuint shader, std::string_view shaderType);
|
||||
void log_program_compile_errors(GLuint program);
|
||||
|
||||
std::unordered_map<uuids::uuid, std::unique_ptr<ShaderProgram>> ShaderManager::shaders;
|
||||
std::unordered_map<ResourceHandle, std::unique_ptr<ShaderProgram>> ShaderManager::shaders;
|
||||
|
||||
std::unique_ptr<ShaderProgram> ShaderManager::load(std::string_view vertexPath, std::string_view fragmentPath)
|
||||
{
|
||||
@@ -68,7 +68,7 @@ std::unique_ptr<ShaderProgram> ShaderManager::load(std::string_view vertexPath,
|
||||
glDeleteShader(vertex);
|
||||
glDeleteShader(fragment);
|
||||
|
||||
return std::make_shared<ShaderProgram>(ShaderProgram(shaderId));
|
||||
return std::make_unique<ShaderProgram>(shaderId);
|
||||
}
|
||||
|
||||
void log_shader_compile_errors(GLuint shader, std::string_view shaderType)
|
||||
|
||||
@@ -5,16 +5,15 @@
|
||||
#ifndef B_ENGINE_SHADERMANAGER_H
|
||||
#define B_ENGINE_SHADERMANAGER_H
|
||||
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <memory>
|
||||
|
||||
#include "ResourceHandle.h"
|
||||
#include "ShaderProgram.h"
|
||||
#include "uuid.h"
|
||||
|
||||
class ShaderManager {
|
||||
public:
|
||||
static std::unordered_map<uuids::uuid, std::unique_ptr<ShaderProgram>> shaders;
|
||||
static std::unordered_map<ResourceHandle, std::unique_ptr<ShaderProgram>> shaders;
|
||||
static std::unique_ptr<ShaderProgram> load(std::string_view vertexPath, std::string_view fragmentPath);
|
||||
|
||||
};
|
||||
|
||||
@@ -5,16 +5,14 @@
|
||||
#include "TextureManager.h"
|
||||
|
||||
#include "stb_image.h"
|
||||
#include "uuid.h"
|
||||
|
||||
#include "spdlog/spdlog.h"
|
||||
|
||||
#include "glad/gl.h"
|
||||
|
||||
std::unordered_map<uuids::uuid, std::unique_ptr<Texture>> TextureManager::textures;
|
||||
std::unordered_map<ResourceHandle, std::unique_ptr<Texture>> TextureManager::textures;
|
||||
|
||||
std::unique_ptr<Texture> TextureManager::load_from_file(const std::string_view filePath)
|
||||
{
|
||||
std::unique_ptr<Texture> TextureManager::load_from_file(const std::string_view filePath) {
|
||||
int width, height, channels;
|
||||
unsigned char *data = stbi_load(filePath.data(), &width, &height, &channels, 0);
|
||||
|
||||
|
||||
@@ -5,16 +5,15 @@
|
||||
#ifndef B_ENGINE_TEXTUREMANAGER_H
|
||||
#define B_ENGINE_TEXTUREMANAGER_H
|
||||
|
||||
#include <filesystem>
|
||||
#include <memory>
|
||||
#include <unordered_map>
|
||||
|
||||
#include "ResourceHandle.h"
|
||||
#include "Texture.h"
|
||||
#include "uuid.h"
|
||||
|
||||
class TextureManager {
|
||||
public:
|
||||
static std::unordered_map<uuids::uuid, std::unique_ptr<Texture>> textures;
|
||||
static std::unordered_map<ResourceHandle, std::unique_ptr<Texture>> textures;
|
||||
|
||||
static std::unique_ptr<Texture> load_from_file(std::string_view filePath);
|
||||
static std::unique_ptr<Texture> load_from_data(unsigned char* data, int width, int height, int channels);
|
||||
|
||||
@@ -11,11 +11,9 @@
|
||||
#include "stb_image.h"
|
||||
|
||||
#include "Camera.h"
|
||||
#include "Components.h"
|
||||
#include "EditorContext.h"
|
||||
#include "FreeCameraController.h"
|
||||
#include "InputManager.h"
|
||||
#include "ModelManager.h"
|
||||
#include "ProjectManifest.h"
|
||||
#include "ProjectManifestFile.h"
|
||||
#include "Scene.h"
|
||||
@@ -31,6 +29,8 @@
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#include "MeshManager.h"
|
||||
|
||||
const char* B_ENGINE_VERSION = "v0.0.3";
|
||||
|
||||
GLFWwindow* gWindow = nullptr;
|
||||
@@ -106,7 +106,7 @@ int main() {
|
||||
|
||||
ShaderManager::shaders.clear();
|
||||
TextureManager::textures.clear();
|
||||
ModelManager::models.clear();
|
||||
MeshManager::meshes.clear();
|
||||
|
||||
glfwDestroyWindow(gWindow);
|
||||
glfwTerminate();
|
||||
@@ -212,8 +212,7 @@ void loop() {
|
||||
glClearColor(0.2f, 0.3f, 0.3f, 1.0f);
|
||||
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
||||
|
||||
// const auto shader = ShaderManager::shaders["phong_shader"];
|
||||
// gScene.draw_scene(shader.get());
|
||||
gScene.draw_scene(shader.get());
|
||||
|
||||
glBindVertexArray(0);
|
||||
ShaderProgram::unbind();
|
||||
|
||||
Reference in New Issue
Block a user