From 8ab459b4da335efc0674435808ed2f6c14b57388 Mon Sep 17 00:00:00 2001 From: T-rvw <429601557@qq.com> Date: Fri, 15 Sep 2023 18:55:14 +0800 Subject: [PATCH] add wireframe mode --- .../shaders/{fs_debug.sc => fs_whiteModel.sc} | 0 .../shaders/{vs_debug.sc => vs_whiteModel.sc} | 0 .../Source/Editor/ECWorld/ECWorldConsumer.cpp | 1 + Engine/Source/Editor/EditorApp.cpp | 15 ++-- Engine/Source/Editor/EditorApp.h | 2 +- Engine/Source/Editor/UILayers/EntityList.cpp | 2 + Engine/Source/Editor/UILayers/SceneView.cpp | 13 +++- Engine/Source/Editor/UILayers/SceneView.h | 9 ++- Engine/Source/Game/GameApp.cpp | 12 +-- .../Runtime/ECWorld/StaticMeshComponent.cpp | 74 +++++++++++++------ .../Runtime/ECWorld/StaticMeshComponent.h | 9 +++ .../Source/Runtime/Rendering/AABBRenderer.cpp | 10 +-- ...bugRenderer.cpp => WhiteModelRenderer.cpp} | 27 +++---- .../{DebugRenderer.h => WhiteModelRenderer.h} | 2 +- Engine/Source/ThirdParty/AssetPipeline | 2 +- 15 files changed, 106 insertions(+), 72 deletions(-) rename Engine/BuiltInShaders/shaders/{fs_debug.sc => fs_whiteModel.sc} (100%) rename Engine/BuiltInShaders/shaders/{vs_debug.sc => vs_whiteModel.sc} (100%) rename Engine/Source/Runtime/Rendering/{DebugRenderer.cpp => WhiteModelRenderer.cpp} (57%) rename Engine/Source/Runtime/Rendering/{DebugRenderer.h => WhiteModelRenderer.h} (90%) diff --git a/Engine/BuiltInShaders/shaders/fs_debug.sc b/Engine/BuiltInShaders/shaders/fs_whiteModel.sc similarity index 100% rename from Engine/BuiltInShaders/shaders/fs_debug.sc rename to Engine/BuiltInShaders/shaders/fs_whiteModel.sc diff --git a/Engine/BuiltInShaders/shaders/vs_debug.sc b/Engine/BuiltInShaders/shaders/vs_whiteModel.sc similarity index 100% rename from Engine/BuiltInShaders/shaders/vs_debug.sc rename to Engine/BuiltInShaders/shaders/vs_whiteModel.sc diff --git a/Engine/Source/Editor/ECWorld/ECWorldConsumer.cpp b/Engine/Source/Editor/ECWorld/ECWorldConsumer.cpp index c6db5f13..36dfcae2 100644 --- a/Engine/Source/Editor/ECWorld/ECWorldConsumer.cpp +++ b/Engine/Source/Editor/ECWorld/ECWorldConsumer.cpp @@ -199,6 +199,7 @@ void ECWorldConsumer::AddStaticMesh(engine::Entity entity, const cd::Mesh& mesh, staticMeshComponent.SetMeshData(&mesh); staticMeshComponent.SetRequiredVertexFormat(&vertexFormat); staticMeshComponent.Build(); + staticMeshComponent.Submit(); } void ECWorldConsumer::AddSkinMesh(engine::Entity entity, const cd::Mesh& mesh, const cd::VertexFormat& vertexFormat) diff --git a/Engine/Source/Editor/EditorApp.cpp b/Engine/Source/Editor/EditorApp.cpp index bba08d91..c09098bd 100644 --- a/Engine/Source/Editor/EditorApp.cpp +++ b/Engine/Source/Editor/EditorApp.cpp @@ -16,7 +16,7 @@ #ifdef ENABLE_DDGI #include "Rendering/DDGIRenderer.h" #endif -#include "Rendering/DebugRenderer.h" +#include "Rendering/WhiteModelRenderer.h" #include "Rendering/ImGuiRenderer.h" #include "Rendering/PBRSkyRenderer.h" #include "Rendering/BloomRenderer.h" @@ -169,7 +169,7 @@ void EditorApp::InitEditorUILayers() m_pSceneView = pSceneView.get(); pSceneView->SetCameraController(m_pViewportCameraController.get()); pSceneView->SetSceneRenderer(m_pSceneRenderer); - pSceneView->SetDebugRenderer(m_pDebugRenderer); + pSceneView->SetWhiteModelRenderer(m_pWhiteModelRenderer); pSceneView->SetAABBRenderer(m_pAABBRenderer); m_pEditorImGuiContext->AddDynamicLayer(cd::MoveTemp(pSceneView)); @@ -319,6 +319,7 @@ void EditorApp::InitSkyEntity() meshComponent.SetMeshData(&optMesh.value()); meshComponent.SetRequiredVertexFormat(&vertexFormat); meshComponent.Build(); + meshComponent.Submit(); } void EditorApp::InitShaderVariantCollectionEntity() @@ -403,11 +404,11 @@ void EditorApp::InitEngineRenderers() pAnimationRenderer->SetSceneWorld(m_pSceneWorld.get()); AddEngineRenderer(cd::MoveTemp(pAnimationRenderer)); - auto pDebugRenderer = std::make_unique(m_pRenderContext->CreateView(), pSceneRenderTarget); - m_pDebugRenderer = pDebugRenderer.get(); - pDebugRenderer->SetSceneWorld(m_pSceneWorld.get()); - pDebugRenderer->SetEnable(false); - AddEngineRenderer(cd::MoveTemp(pDebugRenderer)); + auto pWhiteModelRenderer = std::make_unique(m_pRenderContext->CreateView(), pSceneRenderTarget); + m_pWhiteModelRenderer = pWhiteModelRenderer.get(); + pWhiteModelRenderer->SetSceneWorld(m_pSceneWorld.get()); + pWhiteModelRenderer->SetEnable(false); + AddEngineRenderer(cd::MoveTemp(pWhiteModelRenderer)); auto pAABBRenderer = std::make_unique(m_pRenderContext->CreateView(), pSceneRenderTarget); m_pAABBRenderer = pAABBRenderer.get(); diff --git a/Engine/Source/Editor/EditorApp.h b/Engine/Source/Editor/EditorApp.h index d28f2754..88cb5a76 100644 --- a/Engine/Source/Editor/EditorApp.h +++ b/Engine/Source/Editor/EditorApp.h @@ -92,7 +92,7 @@ class EditorApp final : public engine::IApplication std::unique_ptr m_pSceneWorld; editor::SceneView* m_pSceneView = nullptr; engine::Renderer* m_pSceneRenderer = nullptr; - engine::Renderer* m_pDebugRenderer = nullptr; + engine::Renderer* m_pWhiteModelRenderer = nullptr; engine::Renderer* m_pPBRSkyRenderer = nullptr; engine::Renderer* m_pIBLSkyRenderer = nullptr; engine::Renderer* m_pTerrainRenderer = nullptr; diff --git a/Engine/Source/Editor/UILayers/EntityList.cpp b/Engine/Source/Editor/UILayers/EntityList.cpp index 03b10e8c..98193dfc 100644 --- a/Engine/Source/Editor/UILayers/EntityList.cpp +++ b/Engine/Source/Editor/UILayers/EntityList.cpp @@ -51,6 +51,7 @@ void EntityList::AddEntity(engine::SceneWorld* pSceneWorld) staticMeshComponent.SetMeshData(&mesh); staticMeshComponent.SetRequiredVertexFormat(&pMaterialType->GetRequiredVertexFormat()); staticMeshComponent.Build(); + staticMeshComponent.Submit(); mesh.SetName(pSceneWorld->GetNameComponent(entity)->GetName()); mesh.SetID(cd::MeshID(pSceneDatabase->GetMeshCount())); @@ -113,6 +114,7 @@ void EntityList::AddEntity(engine::SceneWorld* pSceneWorld) meshComponent.SetMeshData(&mesh); meshComponent.SetRequiredVertexFormat(&pTerrainMaterialType->GetRequiredVertexFormat());//to do : modify vertexFormat meshComponent.Build(); + meshComponent.Submit(); mesh.SetName(pSceneWorld->GetNameComponent(entity)->GetName()); mesh.SetID(cd::MeshID(pSceneDatabase->GetMeshCount())); diff --git a/Engine/Source/Editor/UILayers/SceneView.cpp b/Engine/Source/Editor/UILayers/SceneView.cpp index 423f6e25..a541b3e8 100644 --- a/Engine/Source/Editor/UILayers/SceneView.cpp +++ b/Engine/Source/Editor/UILayers/SceneView.cpp @@ -134,14 +134,19 @@ void SceneView::UpdateDebugCombo() { if (DebugModeType::NoDebug == m_debugMode) { - m_pSceneRenderer->SetEnable(true); - m_pDebugRenderer->SetEnable(false); + m_pWhiteModelRenderer->SetEnable(false); } else if (DebugModeType::WhiteModel == m_debugMode) { - m_pSceneRenderer->SetEnable(false); - m_pDebugRenderer->SetEnable(true); + m_pWhiteModelRenderer->SetEnable(true); } + else if (DebugModeType::Wireframe == m_debugMode) + { + + } + + // white model + m_pSceneRenderer->SetEnable(!m_pWhiteModelRenderer->IsEnable()); } ImGui::PushItemWidth(130); } diff --git a/Engine/Source/Editor/UILayers/SceneView.h b/Engine/Source/Editor/UILayers/SceneView.h index 689c37af..957e7bbb 100644 --- a/Engine/Source/Editor/UILayers/SceneView.h +++ b/Engine/Source/Editor/UILayers/SceneView.h @@ -3,7 +3,7 @@ #include "ECWorld/Entity.h" #include "ImGui/ImGuiBaseLayer.h" #include "Rendering/AABBRenderer.h" -#include "Rendering/DebugRenderer.h" +#include "Rendering/WhiteModelRenderer.h" #include #define IMGUI_DEFINE_MATH_OPERATORS @@ -27,6 +27,7 @@ enum class DebugModeType { NoDebug, WhiteModel, + Wireframe, Count, }; @@ -34,7 +35,7 @@ enum class DebugModeType constexpr const char* DebugModes[] = { "NoDebug", "WhiteModel", - //"WireFrame" + "Wireframe", }; static_assert(static_cast(DebugModeType::Count) == sizeof(DebugModes) / sizeof(char*), @@ -76,7 +77,7 @@ class SceneView : public engine::ImGuiBaseLayer AABBModeType GetAABBMode() const { return m_AABBMode; } void SetSceneRenderer(engine::Renderer* pSceneRenderer) { m_pSceneRenderer = pSceneRenderer; } - void SetDebugRenderer(engine::Renderer* pDebugRenderer) { m_pDebugRenderer = pDebugRenderer; } + void SetWhiteModelRenderer(engine::Renderer* pWhiteModelRenderer) { m_pWhiteModelRenderer = pWhiteModelRenderer; } void SetAABBRenderer(engine::Renderer* pAABBRenderer) { m_pAABBRenderer = pAABBRenderer; } bool IsTerrainEditMode() const { return m_isTerrainEditMode; } @@ -106,7 +107,7 @@ class SceneView : public engine::ImGuiBaseLayer AABBModeType m_AABBMode = AABBModeType::NoAABB; engine::Renderer* m_pSceneRenderer = nullptr; - engine::Renderer* m_pDebugRenderer = nullptr; + engine::Renderer* m_pWhiteModelRenderer = nullptr; engine::Renderer* m_pAABBRenderer = nullptr; engine::RenderTarget* m_pRenderTarget = nullptr; diff --git a/Engine/Source/Game/GameApp.cpp b/Engine/Source/Game/GameApp.cpp index 3ec84f97..48fe7e29 100644 --- a/Engine/Source/Game/GameApp.cpp +++ b/Engine/Source/Game/GameApp.cpp @@ -13,7 +13,7 @@ #ifdef ENABLE_DDGI #include "Rendering/DDGIRenderer.h" #endif -#include "Rendering/DebugRenderer.h" +#include "Rendering/WhiteModelRenderer.h" #include "Rendering/ImGuiRenderer.h" #include "Rendering/PBRSkyRenderer.h" #include "Rendering/PostProcessRenderer.h" @@ -251,11 +251,11 @@ void GameApp::InitEngineRenderers() pAnimationRenderer->SetSceneWorld(m_pSceneWorld.get()); AddEngineRenderer(cd::MoveTemp(pAnimationRenderer)); - auto pDebugRenderer = std::make_unique(m_pRenderContext->CreateView(), pSceneRenderTarget); - m_pDebugRenderer = pDebugRenderer.get(); - pDebugRenderer->SetSceneWorld(m_pSceneWorld.get()); - pDebugRenderer->SetEnable(false); - AddEngineRenderer(cd::MoveTemp(pDebugRenderer)); + auto pWhiteModelRenderer = std::make_unique(m_pRenderContext->CreateView(), pSceneRenderTarget); + m_pWhiteModelRenderer = pWhiteModelRenderer.get(); + pWhiteModelRenderer->SetSceneWorld(m_pSceneWorld.get()); + pWhiteModelRenderer->SetEnable(false); + AddEngineRenderer(cd::MoveTemp(pWhiteModelRenderer)); #ifdef ENABLE_DDGI auto pDDGIRenderer = std::make_unique(m_pRenderContext->CreateView(), pSceneRenderTarget); diff --git a/Engine/Source/Runtime/ECWorld/StaticMeshComponent.cpp b/Engine/Source/Runtime/ECWorld/StaticMeshComponent.cpp index e4694f83..bee07247 100644 --- a/Engine/Source/Runtime/ECWorld/StaticMeshComponent.cpp +++ b/Engine/Source/Runtime/ECWorld/StaticMeshComponent.cpp @@ -22,6 +22,11 @@ void StaticMeshComponent::Reset() m_indexBuffer.clear(); m_indexBufferHandle = UINT16_MAX; + +#ifdef EDITOR_MODE + m_wireframeIndexBuffer.clear(); + m_wireframeIndexBufferHandle = UINT16_MAX; +#endif } void StaticMeshComponent::Build() @@ -50,13 +55,12 @@ void StaticMeshComponent::Build() m_vertexBuffer.resize(vertexCount * vertexFormatStride); - uint32_t currentDataSize = 0U; - auto currentDataPtr = m_vertexBuffer.data(); - - auto FillVertexBuffer = [¤tDataPtr, ¤tDataSize](const void* pData, uint32_t dataSize) + uint32_t vbDataSize = 0U; + auto vbDataPtr = m_vertexBuffer.data(); + auto FillVertexBuffer = [&vbDataPtr, &vbDataSize](const void* pData, uint32_t dataSize) { - std::memcpy(¤tDataPtr[currentDataSize], pData, dataSize); - currentDataSize += dataSize; + std::memcpy(&vbDataPtr[vbDataSize], pData, dataSize); + vbDataSize += dataSize; }; for (uint32_t vertexIndex = 0; vertexIndex < vertexCount; ++vertexIndex) @@ -128,25 +132,18 @@ void StaticMeshComponent::Build() } } - // Create vertex buffer. - bgfx::VertexLayout vertexLayout; - VertexLayoutUtility::CreateVertexLayout(vertexLayout, m_pRequiredVertexFormat->GetVertexLayout()); - const bgfx::Memory* pVertexBufferRef = bgfx::makeRef(m_vertexBuffer.data(), static_cast(m_vertexBuffer.size())); - bgfx::VertexBufferHandle vertexBufferHandle = bgfx::createVertexBuffer(pVertexBufferRef, vertexLayout); - assert(bgfx::isValid(vertexBufferHandle)); - m_vertexBufferHandle = vertexBufferHandle.idx; - // Fill index buffer data. bool useU16Index = vertexCount <= static_cast(std::numeric_limits::max()) + 1U; uint32_t indexTypeSize = useU16Index ? sizeof(uint16_t) : sizeof(uint32_t); - m_indexBuffer.resize(m_pMeshData->GetPolygonCount() * 3 * indexTypeSize); + uint32_t indicesCount = m_pMeshData->GetPolygonCount() * 3U; + m_indexBuffer.resize(indicesCount* indexTypeSize); - currentDataSize = 0U; - currentDataPtr = m_indexBuffer.data(); - auto FillIndexBuffer = [¤tDataPtr, ¤tDataSize](const void* pData, uint32_t dataSize) + uint32_t ibDataSize = 0U; + auto ibDataPtr = m_indexBuffer.data(); + auto FillIndexBuffer = [&ibDataPtr, &ibDataSize](const void* pData, uint32_t dataSize) { - std::memcpy(¤tDataPtr[currentDataSize], pData, dataSize); - currentDataSize += dataSize; + std::memcpy(&ibDataPtr[ibDataSize], pData, dataSize); + ibDataSize += dataSize; }; for (const auto& polygon : m_pMeshData->GetPolygons()) @@ -166,11 +163,40 @@ void StaticMeshComponent::Build() } } +#ifdef EDITOR_MODE + uint32_t wireframeIndicesCount = bgfx::topologyConvert(bgfx::TopologyConvert::TriListToLineList, nullptr, 0U, + m_indexBuffer.data(), indicesCount, !useU16Index); + m_wireframeIndexBuffer.resize(indicesCount * indexTypeSize); + bgfx::topologyConvert(bgfx::TopologyConvert::TriListToLineList, m_wireframeIndexBuffer.data(), static_cast(m_wireframeIndexBuffer.size()), + m_indexBuffer.data(), indicesCount, !useU16Index); +#endif +} + +void StaticMeshComponent::Submit() +{ + // Create vertex buffer. + bgfx::VertexLayout vertexLayout; + VertexLayoutUtility::CreateVertexLayout(vertexLayout, m_pRequiredVertexFormat->GetVertexLayout()); + const bgfx::Memory* pVertexBufferRef = bgfx::makeRef(m_vertexBuffer.data(), static_cast(m_vertexBuffer.size())); + bgfx::VertexBufferHandle vertexBufferHandle = bgfx::createVertexBuffer(pVertexBufferRef, vertexLayout); + assert(bgfx::isValid(vertexBufferHandle)); + m_vertexBufferHandle = vertexBufferHandle.idx; + + bool useU16Index = m_pMeshData->GetVertexCount() <= static_cast(std::numeric_limits::max()) + 1U; + auto SubmitIndexBuffer = [&useU16Index](const std::vector& indexBuffer) -> uint16_t + { + const bgfx::Memory* pIndexBufferRef = bgfx::makeRef(indexBuffer.data(), static_cast(indexBuffer.size())); + bgfx::IndexBufferHandle indexBufferHandle = bgfx::createIndexBuffer(pIndexBufferRef, useU16Index ? 0U : BGFX_BUFFER_INDEX32); + assert(bgfx::isValid(indexBufferHandle)); + return indexBufferHandle.idx; + }; + // Create index buffer. - const bgfx::Memory* pIndexBufferRef = bgfx::makeRef(m_indexBuffer.data(), static_cast(m_indexBuffer.size())); - bgfx::IndexBufferHandle indexBufferHandle = bgfx::createIndexBuffer(pIndexBufferRef, useU16Index ? 0U : BGFX_BUFFER_INDEX32); - assert(bgfx::isValid(indexBufferHandle)); - m_indexBufferHandle = indexBufferHandle.idx; + m_indexBufferHandle = SubmitIndexBuffer(m_indexBuffer); + +#ifdef EDITOR_MODE + m_wireframeIndexBufferHandle = SubmitIndexBuffer(m_wireframeIndexBuffer); +#endif } } \ No newline at end of file diff --git a/Engine/Source/Runtime/ECWorld/StaticMeshComponent.h b/Engine/Source/Runtime/ECWorld/StaticMeshComponent.h index 4460a7db..bd18c3cf 100644 --- a/Engine/Source/Runtime/ECWorld/StaticMeshComponent.h +++ b/Engine/Source/Runtime/ECWorld/StaticMeshComponent.h @@ -43,9 +43,13 @@ class StaticMeshComponent final uint16_t GetVertexBuffer() const { return m_vertexBufferHandle; } uint16_t GetIndexBuffer() const { return m_indexBufferHandle; } +#ifdef EDITOR_MODE + uint16_t GetWireframeIndexBuffer() const { return m_wireframeIndexBufferHandle; } +#endif void Reset(); void Build(); + void Submit(); private: // Input @@ -57,6 +61,11 @@ class StaticMeshComponent final std::vector m_indexBuffer; uint16_t m_vertexBufferHandle = UINT16_MAX; uint16_t m_indexBufferHandle = UINT16_MAX; + +#ifdef EDITOR_MODE + std::vector m_wireframeIndexBuffer; + uint16_t m_wireframeIndexBufferHandle = UINT16_MAX; +#endif }; } \ No newline at end of file diff --git a/Engine/Source/Runtime/Rendering/AABBRenderer.cpp b/Engine/Source/Runtime/Rendering/AABBRenderer.cpp index 8d79c8ff..3a61ddc0 100644 --- a/Engine/Source/Runtime/Rendering/AABBRenderer.cpp +++ b/Engine/Source/Runtime/Rendering/AABBRenderer.cpp @@ -24,20 +24,15 @@ void AABBRenderer::UpdateView(const float* pViewMatrix, const float* pProjection void AABBRenderer::RenderAll(float deltaTime) { - for (Entity entity : m_pCurrentSceneWorld->GetStaticMeshEntities()) + for (Entity entity : m_pCurrentSceneWorld->GetCollisionMeshEntities()) { - auto* pCollisionMesh = m_pCurrentSceneWorld->GetCollisionMeshComponent(entity); - if (!pCollisionMesh) - { - continue; - } - if (auto* pTransformComponent = m_pCurrentSceneWorld->GetTransformComponent(entity)) { pTransformComponent->Build(); bgfx::setTransform(pTransformComponent->GetWorldMatrix().Begin()); } + auto* pCollisionMesh = m_pCurrentSceneWorld->GetCollisionMeshComponent(entity); bgfx::setVertexBuffer(0, bgfx::VertexBufferHandle{ pCollisionMesh->GetVertexBuffer() }); bgfx::setIndexBuffer(bgfx::IndexBufferHandle{ pCollisionMesh->GetIndexBuffer() }); @@ -47,7 +42,6 @@ void AABBRenderer::RenderAll(float deltaTime) constexpr StringCrc AABBAllProgram("AABBProgram"); bgfx::submit(GetViewID(), GetRenderContext()->GetProgram(AABBAllProgram)); - } } diff --git a/Engine/Source/Runtime/Rendering/DebugRenderer.cpp b/Engine/Source/Runtime/Rendering/WhiteModelRenderer.cpp similarity index 57% rename from Engine/Source/Runtime/Rendering/DebugRenderer.cpp rename to Engine/Source/Runtime/Rendering/WhiteModelRenderer.cpp index 0635143a..eaca198e 100644 --- a/Engine/Source/Runtime/Rendering/DebugRenderer.cpp +++ b/Engine/Source/Runtime/Rendering/WhiteModelRenderer.cpp @@ -1,4 +1,4 @@ -#include "DebugRenderer.h" +#include "WhiteModelRenderer.h" #include "Core/StringCrc.h" #include "ECWorld/SceneWorld.h" @@ -10,19 +10,19 @@ namespace engine { -void DebugRenderer::Init() +void WhiteModelRenderer::Init() { - GetRenderContext()->CreateProgram("DebugProgram", "vs_debug.bin", "fs_debug.bin"); - bgfx::setViewName(GetViewID(), "DebugRenderer"); + GetRenderContext()->CreateProgram("WhiteModelProgram", "vs_whiteModel.bin", "fs_whiteModel.bin"); + bgfx::setViewName(GetViewID(), "WhiteModelRenderer"); } -void DebugRenderer::UpdateView(const float* pViewMatrix, const float* pProjectionMatrix) +void WhiteModelRenderer::UpdateView(const float* pViewMatrix, const float* pProjectionMatrix) { UpdateViewRenderTarget(); bgfx::setViewTransform(GetViewID(), pViewMatrix, pProjectionMatrix); } -void DebugRenderer::Render(float deltaTime) +void WhiteModelRenderer::Render(float deltaTime) { for (Entity entity : m_pCurrentSceneWorld->GetStaticMeshEntities()) { @@ -37,27 +37,22 @@ void DebugRenderer::Render(float deltaTime) continue; } - StaticMeshComponent* pMeshComponent = m_pCurrentSceneWorld->GetStaticMeshComponent(entity); - if (!pMeshComponent) - { - continue; - } - if (TransformComponent* pTransformComponent = m_pCurrentSceneWorld->GetTransformComponent(entity)) { pTransformComponent->Build(); bgfx::setTransform(pTransformComponent->GetWorldMatrix().Begin()); } - bgfx::setVertexBuffer(0, bgfx::VertexBufferHandle{ pMeshComponent->GetVertexBuffer() }); - bgfx::setIndexBuffer(bgfx::IndexBufferHandle{ pMeshComponent->GetIndexBuffer() }); + StaticMeshComponent* pStaticMesh = m_pCurrentSceneWorld->GetStaticMeshComponent(entity); + bgfx::setVertexBuffer(0, bgfx::VertexBufferHandle{ pStaticMesh->GetVertexBuffer() }); + bgfx::setIndexBuffer(bgfx::IndexBufferHandle{ pStaticMesh->GetIndexBuffer() }); constexpr uint64_t state = BGFX_STATE_WRITE_MASK | BGFX_STATE_MSAA | BGFX_STATE_DEPTH_TEST_LESS | BGFX_STATE_BLEND_FUNC(BGFX_STATE_BLEND_SRC_ALPHA, BGFX_STATE_BLEND_INV_SRC_ALPHA); bgfx::setState(state); - constexpr StringCrc debugProgram("DebugProgram"); - bgfx::submit(GetViewID(), GetRenderContext()->GetProgram(debugProgram)); + constexpr StringCrc whiteModelProgram("WhiteModelProgram"); + bgfx::submit(GetViewID(), GetRenderContext()->GetProgram(whiteModelProgram)); } } diff --git a/Engine/Source/Runtime/Rendering/DebugRenderer.h b/Engine/Source/Runtime/Rendering/WhiteModelRenderer.h similarity index 90% rename from Engine/Source/Runtime/Rendering/DebugRenderer.h rename to Engine/Source/Runtime/Rendering/WhiteModelRenderer.h index c13a14f0..62325dec 100644 --- a/Engine/Source/Runtime/Rendering/DebugRenderer.h +++ b/Engine/Source/Runtime/Rendering/WhiteModelRenderer.h @@ -9,7 +9,7 @@ namespace engine class SceneWorld; -class DebugRenderer final : public Renderer +class WhiteModelRenderer final : public Renderer { public: using Renderer::Renderer; diff --git a/Engine/Source/ThirdParty/AssetPipeline b/Engine/Source/ThirdParty/AssetPipeline index 1e4b58f9..88373377 160000 --- a/Engine/Source/ThirdParty/AssetPipeline +++ b/Engine/Source/ThirdParty/AssetPipeline @@ -1 +1 @@ -Subproject commit 1e4b58f964f8adeff84038fb4f3be89eb26e6514 +Subproject commit 883733779ad37219e7b246710c33c26fc5d4d71c