
.. _program_listing_file_Src_GraphicsEngineOpenGL_scene_Model.ixx:

Program Listing for File Model.ixx
==================================

|exhale_lsh| :ref:`Return to documentation for file <file_Src_GraphicsEngineOpenGL_scene_Model.ixx>` (``Src/GraphicsEngineOpenGL/scene/Model.ixx``)

.. |exhale_lsh| unicode:: U+021B0 .. UPWARDS ARROW WITH TIP LEFTWARDS

.. code-block:: cpp

   module;
   
   #include <memory>
   #include <vector>
   #include <string>
   #include <glad/glad.h>
   #include <glm/glm.hpp>
   
   export module kataglyphis.opengl.model;
   
   import kataglyphis.opengl.vertex;
   import kataglyphis.opengl.obj_loader;
   import kataglyphis.opengl.aabb;
   import kataglyphis.opengl.mesh;
   import kataglyphis.opengl.obj_material;
   import kataglyphis.opengl.texture;
   
   export class Model
   {
     public:
       Model();
   
       void load_model_in_ram(const std::string &model_path);
   
       void create_render_context();
   
       void bind_ressources();
   
       void unbind_resources();
   
       std::shared_ptr<AABB> get_aabb();
       std::vector<ObjMaterial> get_materials() const;
       int get_texture_count() const;
   
       void render();
   
       ~Model();
   
     private:
       // buffer for material id's
       GLuint ssbo{};
   
       ObjLoader loader;
   
       std::shared_ptr<AABB> aabb;
   
       std::shared_ptr<Mesh> mesh;
       std::vector<Vertex> vertices;
       std::vector<unsigned int> indices;
       std::vector<std::shared_ptr<Texture>> texture_list;
       std::vector<ObjMaterial> materials;
       std::vector<glm::vec4> materialIndex;
       std::vector<std::string> textures;
   };
