aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/main.cpp b/src/main.cpp
index f2b2c3f..7cefb17 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -8,6 +8,7 @@
#include "../include/ThirdPersonCamera.hpp"
#include "../include/model_loader/ObjModelLoader.hpp"
+#include "../include/ModelLoader.hpp"
#include <cstdio>
#include <chrono>
@@ -96,7 +97,7 @@ int main() {
std::unique_ptr<Shader> vertex_shader = load_shader_from_file("shaders/vertex.vert", Shader::Type::VERTEX);
std::unique_ptr<Shader> pixel_shader = load_shader_from_file("shaders/fragment.frag", Shader::Type::PIXEL);
std::unique_ptr<ShaderProgram> shader_program = build_shader_program_from_shaders({ vertex_shader.get(), pixel_shader.get() });
- Model buddha_model = load_model("/home/dec05eba/Downloads/ELI4OS.obj", shader_program.get());
+ Model buddha_model = load_model("/home/dec05eba/Downloads/ELI4OS.a3d", shader_program.get());
buddha_model.frame.get_uniform_by_name("proj")->set(proj);
Result<Uniform> view_uniform = buddha_model.frame.get_uniform_by_name("view");
Result<Uniform> model_uniform = buddha_model.frame.get_uniform_by_name("model");
@@ -104,7 +105,7 @@ int main() {
std::unique_ptr<Shader> vertex_no_texture_shader = load_shader_from_file("shaders/vertex_no_texture.vert", Shader::Type::VERTEX);
std::unique_ptr<Shader> pixel_no_texture_shader = load_shader_from_file("shaders/fragment_no_texture.frag", Shader::Type::PIXEL);
std::unique_ptr<ShaderProgram> no_texture_shader_program = build_shader_program_from_shaders({ vertex_no_texture_shader.get(), pixel_no_texture_shader.get() });
- Model character_model = load_model("/home/dec05eba/Downloads/FinalBaseMesh.obj", no_texture_shader_program.get());
+ Model character_model = load_model("/home/dec05eba/Downloads/FinalBaseMesh.a3d", no_texture_shader_program.get());
character_model.frame.get_uniform_by_name("proj")->set(proj);
Result<Uniform> char_view_uniform = character_model.frame.get_uniform_by_name("view");
Result<Uniform> char_model_uniform = character_model.frame.get_uniform_by_name("model");
@@ -260,7 +261,9 @@ Model load_model(const char *filepath, ShaderProgram *shader_program) {
std::vector<Triangle3D> triangles;
std::vector<vec2f> texture_coords;
Image *image;
- ObjModelLoader::load_from_file(filepath, triangles, texture_coords, &image);
+ if(!ModelLoader::load_from_file(filepath, triangles, texture_coords, &image)) {
+ fprintf(stderr, "Error: failed to load model from file: %s\n", filepath);
+ }
// TODO: This needs to be done to prevent crash in glDrawArrays, but this should not be used when shader doesn't handle any texture
//if(texture_coords.size() < triangles.size())
// texture_coords.resize(triangles.size());