Brenta Engine 1.2
Loading...
Searching...
No Matches
model.hpp
1// SPDX-License-Identifier: MIT
2// Author: Giovanni Santini
3// Mail: giovanni.santini@proton.me
4// Github: @San7o
5
6#pragma once
7
8#include <assimp/Importer.hpp>
9#include <assimp/postprocess.h>
10#include <assimp/scene.h>
11#include <brenta/mesh.hpp>
12#include <brenta/shader.hpp>
13#include <glad/glad.h>
14#include <string>
15#include <vector>
16
17namespace brenta
18{
19
25class model
26{
27public:
28
29 GLint wrapping;
30 GLint filtering_min;
31 GLint filtering_mag;
32 GLboolean has_mipmap;
33 GLint mipmap_min;
34 GLint mipmap_mag;
35 bool flip;
36
37 struct config;
38 class builder;
39
40 static const config default_config;
41
48 {
49 }
50
51 model(config conf);
52
53 void draw(types::shader_name_t shader);
54
55private:
56
57 std::vector<mesh> meshes;
58 std::vector<types::texture> textures_loaded;
59 std::string directory;
60
61 void load_model(std::string path);
62 void process_node(aiNode *node, const aiScene *scene);
63 mesh process_mesh(aiMesh *mesh, const aiScene *scene);
64 std::vector<types::texture> load_material_textures(aiMaterial *mat,
65 aiTextureType type,
66 std::string type_name);
67};
68
70{
71 std::string path;
72 GLint wrapping;
73 GLint filtering_min;
74 GLint filtering_mag;
75 GLboolean has_mipmap;
76 GLint mipmap_min;
77 GLint mipmap_mag;
78 bool flip;
79};
80
85{
86private:
87
88 model::config conf = model::default_config;
89
90public:
91 builder &path(std::string path);
92 builder &wrapping(GLint wrapping);
93 builder &filtering_min(GLint filtering_min);
94 builder &filtering_mag(GLint filtering_mag);
95 builder &has_mipmap(GLboolean has_mipmap);
96 builder &mipmap_min(GLint mipmap_min);
97 builder &mipmap_mag(GLint mipmap_mag);
98 builder &flip(bool flip);
99
100 model build();
101};
102
103} // namespace brenta
The Mesh class represents a 3D model.
Definition mesh.hpp:62
Builder class for Model.
Definition model.hpp:85
Model class.
Definition model.hpp:26
model()
Empty constructor.
Definition model.hpp:47
Shader class.
Definition shader.hpp:43