#include #include #include #include #include #include #include "../../optional.h" #include "../../vector.h" #include "../../vertex.h" #include "../../renderable.h" #include "../../transformable.h" #include "../../gfx/vao.h" #include "../../gfx/vbo.h" #include "../../gfx/shader.h" #include "../../gfx/texture.h" #include "../../gfx/textured_model.h" namespace simpleengine::objects_3d { class ObjModel : public simpleengine::gfx::TexturedModel { private: std::vector split_string(std::string str, const char delim); static void process_vertex(const std::vector& vertex_data, std::vector& indicies, const std::vector& in_textures, const std::vector& in_normals, std::vector& out_textures, std::vector& out_normals); public: ObjModel(GLFWwindow *window, gfx::Shader shader, gfx::Texture texture, std::string filename); ObjModel(GLFWwindow *window, gfx::Shader shader, gfx::Texture texture, std::ifstream file_stream); virtual void update(const float& delta_time) override; /* virtual void render(GLFWwindow* target) override { shader.use(); shader.set_uniform_matrix_4f("transform_matrix", transform_matrix, false); // When binding to the texture, also tell the shader if the texture is set or not. if (texture.has_value()) { shader.set_uniform_int("texture_is_set", true, false); texture.value().bind(); } else { shader.set_uniform_int("texture_is_set", false, false); } vao.bind(); glDrawElements(GL_TRIANGLES, indicies.size(), GL_UNSIGNED_INT, 0); } */ }; }