Elevate Engine 1
Loading...
Searching...
No Matches
Model.h
Go to the documentation of this file.
1#pragma once
2#include <vector>
3#include <string>
4
5#include <assimp/scene.h>
6#include <assimp/postprocess.h>
7#include <assimp/Importer.hpp>
8
15
16namespace Elevate
17{
18 class Model : public Component
19 {
20 public:
22 EECATEGORY("Rendering")
23
24 Model() = default;
25 Model(PrimitiveType type);
26 Model(std::string path, MaterialPtr material = nullptr);
27
28 void SetMaterial(MaterialPtr material) { m_material = material; }
29
30 void Render() override;
31
32 // todo change this to material and also make a setter
33 //const inline std::shared_ptr<Shader>& GetShader() const { return m_shader; }
34
35 RenderState& GetRenderState() { return m_attributes; }
36
37 //virtual Component* Clone() override;
38 private:
39 void LoadModel(std::string path);
40 void ProcessNode(std::string basePath, aiNode* node, const aiScene* scene, MeshData& data);
41 void ProcessMesh(std::string basePath, aiMesh* mesh, const aiScene* scene, MeshData& data);
42 void ExtractMeshVertex(aiMesh* mesh, Vertex& vertex, int index);
43 void LoadMaterialTextures(std::string basePath, aiMaterial* mat, aiTextureType type, TextureType texType, MeshData& data);
44 private:
45 MaterialPtr m_material;
46 // model data
47 Mesh m_batchedMesh;
48 std::string m_Directory;
49 RenderState m_attributes;
50
52 };
53}
#define EECATEGORY(name)
#define BEGIN_COMPONENT(T,...)
#define END_COMPONENT()
void SetMaterial(MaterialPtr material)
Definition Model.h:28
RenderState & GetRenderState()
Definition Model.h:35
void Render() override
Definition Model.cpp:211
std::shared_ptr< Material > MaterialPtr
Definition Material.h:24
TextureType
Definition Texture.h:29
PrimitiveType
Definition Mesh.h:28