-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Merged mesh factory branch to main * Working Vertex buffer class that replaces vk::VulkanModel to contains the vertices of the mesh * Working index buffers and added mesh class that contains both the vertex and index buffers * Working mesh class can also now load 3D models and work with new vertex and index buffers as well
- Loading branch information
Showing
35 changed files
with
627 additions
and
528 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
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
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
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
8 changes: 5 additions & 3 deletions
8
TestApp/Scenes/Assets/Components/Graphics/Meshes/MeshContainer.hpp
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,18 +1,20 @@ | ||
#pragma once | ||
#include <Core/Core.hpp> | ||
#include <engine3d/Core/GraphicDrivers/VertexBuffer.hpp> | ||
#include <glm/glm.hpp> | ||
#include <vector> | ||
#include <engine3d/Core/internal/Vulkan2Showcase/VulkanModel.hpp> | ||
|
||
//! @brief Factory | ||
class MeshContainer | ||
{ | ||
public: | ||
MeshContainer() = default; | ||
std::vector<engine3d::vk::VulkanModel::Vertex>* GetVertices(){return vertices;} | ||
engine3d::Ref<engine3d::VertexBuffer> GetVertices(){return vertices;} | ||
std::vector<glm::vec3> GetNormals(){return normals;} | ||
std::vector<glm::vec2> GettexCoords(){return texCoords;} | ||
|
||
protected: | ||
std::vector<engine3d::vk::VulkanModel::Vertex>* vertices; | ||
engine3d::Ref<engine3d::VertexBuffer> vertices; | ||
std::vector<glm::vec3> normals; | ||
std::vector<glm::vec2> texCoords; | ||
}; |
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#pragma once | ||
#include <Core/Core.hpp> | ||
#include <vector> | ||
#include <vulkan/vulkan_core.h> | ||
|
||
namespace engine3d{ | ||
class IndexBuffer{ | ||
public: | ||
static Ref<IndexBuffer> Create(std::vector<uint32_t> p_Indices); | ||
|
||
void Bind(VkCommandBuffer p_CommandBuffer); | ||
void Draw(VkCommandBuffer p_CommandBuffer); | ||
|
||
bool HasIndicesPresent() const; | ||
|
||
protected: | ||
virtual void BindToIndexBuffer(VkCommandBuffer p_CommandBuffer) = 0; | ||
virtual void RenderIndexBuffer(VkCommandBuffer p_CommandBuffer) = 0; | ||
virtual bool HasIndices() const = 0; | ||
}; | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
#pragma once | ||
|
||
#include <Core/Core.hpp> | ||
#include <Core/GraphicDrivers/VertexBuffer.hpp> | ||
#include <Core/GraphicDrivers/IndexBuffer.hpp> | ||
|
||
#define TINYOBJLOADER_IMPLEMENTATION | ||
#include <tiny_obj_loader.h> | ||
|
||
namespace engine3d{ | ||
|
||
class Mesh{ | ||
public: | ||
Mesh() = default; | ||
Mesh(const Ref<VertexBuffer>& p_Vb, const Ref<IndexBuffer>& p_Ib); | ||
|
||
static Mesh LoadModel(const std::string& p_Filename); | ||
|
||
Ref<VertexBuffer>& GetVertices() { return m_Vertices; } | ||
|
||
Ref<IndexBuffer>& GetIndices() { return m_Indices; } | ||
|
||
private: | ||
Ref<VertexBuffer> m_Vertices; | ||
Ref<IndexBuffer> m_Indices; | ||
}; | ||
|
||
}; |
Oops, something went wrong.