Fireworks Engine  v2.0
Lightweight Sandbox Game Engine using OpenGL for additional Customisation and Quick Prototyping
model.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "mesh.h"
4 
5 // Assimp
6 #include <assimp/Importer.hpp> // C++ importer interface
7 #include <assimp/scene.h> // Output data structure
8 #include <assimp/postprocess.h> // Post processing flags
9 
10 namespace fireworks { namespace graphics {
11 
13  struct SubMesh
14  {
15  std::vector<VertexData3D> vertices;
16  std::vector<GLushort> indices;
17  std::vector<Texture> material_textures;
18  };
19 
21  class Model : public Renderable3D
22  {
23  public:
25  GLuint vertexCount;
27  GLuint trisCount;
29  std::vector<SubMesh> subMeshes;
32  private:
33  Mesh m_RootMesh;
34  std::string m_Directory;
35  std::vector<Texture> m_LoadedTextures;
36  Transform m_Transform;
37  Shader* m_Shader;
38  public:
44  Model(std::string path, Transform transform, Shader* shader);
45  ~Model();
46 
48  inline Mesh& getMasterMesh() { return m_RootMesh; }
49  private:
50  void submit(Renderer3D* renderer) const override;
51  void loadModel(std::string path);
52  Mesh processNode(aiNode* node, const aiScene* scene);
53  SubMesh processMesh(aiMesh* mesh, const aiScene* scene);
54  std::vector<Texture> loadMaterialTextures(aiMaterial* material, aiTextureType texType, std::string typeName);
55  };
56 
57 } }
GLuint trisCount
The triangles count of the 3d model.
Definition: model.h:27
The spacial orientation of an object in 3D space denoted by it&#39;s position, rotation and scale...
Definition: renderable3d.h:38
std::vector< Texture > material_textures
Definition: model.h:17
Creates Index Buffers.
Definition: indexbuffer.h:11
The 3D mesh of a 3d renderable object.
Definition: mesh.h:15
std::vector< SubMesh > subMeshes
Collections of sub-meshes that make up the 3d models.
Definition: model.h:29
Mesh & getMasterMesh()
Returns the root mesh that is a congregation of all sub-meshes.
Definition: model.h:48
The Class responsible for drawing the basic 3D Renderable objects onto the screen.
Definition: renderable3d.h:66
Definition: audioclip.cpp:3
The class responsible for creating amazing shaders.
Definition: Shader.h:22
std::vector< GLushort > indices
Definition: model.h:16
Forward declaration of the graphics::Renderable3D.
Definition: renderer3d.h:16
GLuint vertexCount
The vertex count of the 3d model.
Definition: model.h:25
IndexBuffer * modelIBO
The index buffer of the 3d model.
Definition: model.h:31
A 3D model object loaded externally.
Definition: model.h:21
std::vector< VertexData3D > vertices
Definition: model.h:15
A struct denoting the sub-meshes of a 3d Model.
Definition: model.h:13