Merge remote-tracking branch 'origin/SP3-1-Rendering' into SP3-1-Rendering
This commit is contained in:
commit
23fe51b483
|
@ -370,6 +370,27 @@ namespace SHADE
|
|||
resourceManager.Free(materialInstance);
|
||||
}
|
||||
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
/* Mesh Registration Functions */
|
||||
/*---------------------------------------------------------------------------------*/
|
||||
SHADE::Handle<SHADE::SHMesh> SHGraphicsSystem::AddMesh(uint32_t vertexCount, const SHMesh::VertexPosition* const positions, const SHMesh::VertexTexCoord* const texCoords, const SHMesh::VertexTangent* const tangents, const SHMesh::VertexNormal* const normals, uint32_t indexCount, const SHMesh::Index* const indices)
|
||||
{
|
||||
return meshLibrary.AddMesh(vertexCount, positions, texCoords, tangents, normals, indexCount, indices);
|
||||
}
|
||||
|
||||
void SHGraphicsSystem::RemoveMesh(Handle<SHMesh> mesh)
|
||||
{
|
||||
meshLibrary.RemoveMesh(mesh);
|
||||
}
|
||||
|
||||
void SHGraphicsSystem::BuildMeshBuffers()
|
||||
{
|
||||
transferCmdBuffer->BeginRecording();
|
||||
meshLibrary.BuildBuffers(device, transferCmdBuffer);
|
||||
transferCmdBuffer->EndRecording();
|
||||
queue->SubmitCommandBuffer({ transferCmdBuffer });
|
||||
}
|
||||
|
||||
void SHGraphicsSystem::SetWindow(SHWindow* wind) noexcept
|
||||
{
|
||||
window = wind;
|
||||
|
|
|
@ -27,6 +27,7 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "Graphics/RenderGraph/SHRenderGraph.h"
|
||||
#include "Graphics/MiddleEnd/Shaders/SHShaderSourceLibrary.h"
|
||||
#include "Graphics/MiddleEnd/Shaders/SHShaderModuleLibrary.h"
|
||||
#include "SHMeshLibrary.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
|
@ -122,6 +123,67 @@ namespace SHADE
|
|||
Handle<SHMaterialInstance> AddMaterialInstance(Handle<SHMaterial> material);
|
||||
void RemoveMaterialInstance(Handle<SHMaterialInstance> materialInstance);
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Mesh Registration Functions */
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
|
||||
\brief
|
||||
Adds a mesh to the Mesh Library. But this does not mean that the meshes have
|
||||
been added yet. A call to "BuildBuffers()" is required to transfer all
|
||||
meshes into the GPU.
|
||||
|
||||
\param vertexCount
|
||||
Number of vertices in this Mesh.
|
||||
\param positions
|
||||
Pointer to the first in a contiguous array of SHMathVec3s that define vertex
|
||||
positions.
|
||||
\param texCoords
|
||||
Pointer to the first in a contiguous array of SHMathVec2s that define vertex
|
||||
texture coordinates.
|
||||
\param tangents
|
||||
Pointer to the first in a contiguous array of SHMathVec3s that define vertex
|
||||
tangents.
|
||||
\param normals
|
||||
Pointer to the first in a contiguous array of SHMathVec3s that define vertex
|
||||
normals.
|
||||
\param indexCount
|
||||
Number of indices in this mesh.
|
||||
\param indices
|
||||
Pointer to the first in a contiguous array of uint32_ts that define mesh
|
||||
indices.
|
||||
|
||||
\return
|
||||
Handle to the created Mesh. This is not valid to be used until a call to
|
||||
BuildBuffers().
|
||||
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
Handle<SHMesh> AddMesh(uint32_t vertexCount, const SHMesh::VertexPosition* const positions, const SHMesh::VertexTexCoord* const texCoords, const const SHMesh::VertexTangent* const tangents, const SHMesh::VertexNormal* const normals, uint32_t indexCount, const SHMesh::Index* const indices);
|
||||
/*******************************************************************************/
|
||||
/*!
|
||||
|
||||
\brief
|
||||
Removes a mesh from the MeshLibrary. But this does not mean that the meshes
|
||||
have been removed yet. A call to "BuildBuffers()" is required to finalise all
|
||||
changes.
|
||||
|
||||
\param mesh
|
||||
Handle to the mesh to remove.
|
||||
|
||||
*/
|
||||
/*******************************************************************************/
|
||||
void RemoveMesh(Handle<SHMesh> mesh);
|
||||
/***************************************************************************/
|
||||
/*!
|
||||
|
||||
\brief
|
||||
Finalises all changes to the MeshLibrary into the GPU buffers.
|
||||
|
||||
*/
|
||||
/***************************************************************************/
|
||||
void BuildMeshBuffers();
|
||||
|
||||
/*-----------------------------------------------------------------------------*/
|
||||
/* Setters */
|
||||
|
@ -157,16 +219,14 @@ namespace SHADE
|
|||
Handle<SHVkCommandBuffer> transferCmdBuffer;
|
||||
SHRenderContext renderContext;
|
||||
std::array<Handle<SHVkSemaphore>, 2> graphSemaphores;
|
||||
|
||||
// Not Owned Resources
|
||||
SHWindow* window;
|
||||
|
||||
// Global descriptor set layouts
|
||||
std::vector<Handle<SHVkDescriptorSetLayout>> globalDescSetLayouts;
|
||||
|
||||
// Middle End Resources
|
||||
ResourceManager resourceManager;
|
||||
|
||||
SHMeshLibrary meshLibrary;
|
||||
// Viewports
|
||||
Handle<SHViewport> defaultViewport; // Whole screen
|
||||
std::vector<Handle<SHViewport>> viewports; // Additional viewports
|
||||
|
|
|
@ -13,6 +13,8 @@ of DigiPen Institute of Technology is prohibited.
|
|||
#include "SHpch.h"
|
||||
#include "SHPrimitiveGenerator.h"
|
||||
|
||||
#include "Graphics/MiddleEnd/Interface/SHGraphicsSystem.h"
|
||||
|
||||
namespace SHADE
|
||||
{
|
||||
SHMeshData SHPrimitiveGenerator::Cube() noexcept
|
||||
|
@ -203,4 +205,18 @@ namespace SHADE
|
|||
);
|
||||
}
|
||||
|
||||
Handle<SHADE::SHMesh> SHPrimitiveGenerator::Cube(SHGraphicsSystem& gfxSystem) noexcept
|
||||
{
|
||||
SHMeshData meshData = Cube();
|
||||
return gfxSystem.AddMesh
|
||||
(
|
||||
meshData.VertexPositions.size(),
|
||||
meshData.VertexPositions.data(),
|
||||
meshData.VertexTexCoords.data(),
|
||||
meshData.VertexTangents.data(),
|
||||
meshData.VertexNormals.data(),
|
||||
meshData.Indices.size(),
|
||||
meshData.Indices.data()
|
||||
);
|
||||
}
|
||||
}
|
|
@ -56,5 +56,18 @@ namespace SHADE
|
|||
*/
|
||||
/***********************************************************************************/
|
||||
[[nodiscard]] static Handle<SHMesh> Cube(SHMeshLibrary& meshLibrary) noexcept;
|
||||
/***********************************************************************************/
|
||||
/*!
|
||||
\brief
|
||||
Produces a cube and constructs a SHMesh using the SHGraphicsSystem provided.
|
||||
|
||||
\param gfxSystem
|
||||
Reference to the SHGraphicsSystem to produce and store a cube mesh in.
|
||||
|
||||
\return
|
||||
SHMesh object that points to the generated cube mesh in the SHGraphicsSystem.
|
||||
*/
|
||||
/***********************************************************************************/
|
||||
[[nodiscard]] static Handle<SHMesh> Cube(SHGraphicsSystem& gfxSystem) noexcept;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue