Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exclude abstract Mesh class because of issues(TM)
- Loading branch information
Showing
6 changed files
with
52 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,28 @@ | ||
#pragma once | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
#include "Mesh.hpp" | ||
struct Vertex; | ||
|
||
class Vertex; | ||
|
||
class CubeMesh : public Mesh { | ||
class CubeMesh { | ||
public: | ||
CubeMesh(): m_ebo(nullptr), m_vbo(nullptr) { } | ||
CubeMesh(): m_ebo(nullptr), m_vao(nullptr), m_vbo(nullptr) { } | ||
CubeMesh(std::vector<Vertex>* vertices, std::vector<unsigned int>* indices); | ||
|
||
virtual void Bind() const override; | ||
virtual void Draw() const override; | ||
virtual void Unbind() const override; | ||
void Bind() const; | ||
void Draw() const; | ||
std::string GetName() const; | ||
void SetName(std::string name); | ||
void Unbind() const; | ||
|
||
private: | ||
void Load(std::vector<Vertex>* vertices, std::vector<unsigned int>* indices); | ||
void Unload(); | ||
|
||
class ElementBufferObject* m_ebo; | ||
bool m_isLoaded = false; | ||
std::string m_name = "unnamed"; | ||
class VertexArrayObject* m_vao; | ||
class VertexBufferObject* m_vbo; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,26 @@ | ||
#pragma once | ||
|
||
#include "GLM/vec3.hpp" | ||
#include "GLM/vec4.hpp" | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
class Mesh; | ||
class Vertex; | ||
#include "CubeMesh.hpp" | ||
#include "Vertex.hpp" | ||
|
||
class Loader { | ||
public: | ||
Loader() {} | ||
~Loader(); | ||
|
||
std::vector<unsigned int> GetIndices(); | ||
std::vector<Mesh> GetMeshes(); | ||
std::vector<CubeMesh> GetMeshes(); | ||
std::vector<Vertex> GetVertices(); | ||
bool ParseFile(const std::string& objFilePath); | ||
|
||
private: | ||
void GenerateVerticesFromRawObj(std::vector<Vertex>& vertices, const std::vector<glm::vec3>& positions, const std::vector<glm::vec4>& coordinates, const std::vector<glm::vec3>& normals, std::string currentLine); | ||
void GenerateVerticesFromRawObj(std::vector<Vertex>& vertices, const std::vector<glm::vec3>& positions, const std::vector<glm::vec2>& coordinates, const std::vector<glm::vec3>& normals, std::string currentLine); | ||
void TriangulateVertices(std::vector<unsigned int>& indices, const std::vector<Vertex>& vertices); | ||
|
||
std::vector<unsigned int> m_indices; | ||
std::vector<Mesh> m_meshes; | ||
std::vector<CubeMesh> m_meshes; | ||
std::vector<Vertex> m_vertices; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters