From cb34cfbaedaeee7aebe137582be15cf7c5827577 Mon Sep 17 00:00:00 2001 From: Deamon87 Date: Wed, 3 Jul 2024 12:48:45 +0300 Subject: [PATCH] temp commit --- .../vulkan/FrontendUIRenderForwardVLK.cpp | 7 ++-- .../vulkan/FrontendUIRenderForwardVLK.h | 4 ++- .../src/engine/objects/scenes/map.cpp | 33 ++++++++++++------- .../descriptorSets/GDescriptorSetLayout.cpp | 4 +-- .../vulkan/shaders/GShaderPermutationVLK.cpp | 4 +-- wowViewerLib/src/include/database/dbStructs.h | 2 ++ 6 files changed, 34 insertions(+), 20 deletions(-) diff --git a/src/ui/renderer/uiScene/vulkan/FrontendUIRenderForwardVLK.cpp b/src/ui/renderer/uiScene/vulkan/FrontendUIRenderForwardVLK.cpp index f956bb72..4799eb9b 100644 --- a/src/ui/renderer/uiScene/vulkan/FrontendUIRenderForwardVLK.cpp +++ b/src/ui/renderer/uiScene/vulkan/FrontendUIRenderForwardVLK.cpp @@ -26,7 +26,8 @@ void FrontendUIRenderForwardVLK::createBuffers() { vboBuffer = m_device->createVertexBuffer("UI_Vbo_Buffer", 1024*1024); uboBuffer = m_device->createUniformBuffer("UI_UBO", sizeof(ImgUI::modelWideBlockVS)*IDevice::MAX_FRAMES_IN_FLIGHT); - m_imguiUbo = std::make_shared>(uboBuffer); + m_imguiUboVLK = std::make_shared>(uboBuffer); + m_imguiUbo = m_imguiUboVLK; } HGVertexBuffer FrontendUIRenderForwardVLK::createVertexBuffer(int sizeInBytes) { @@ -58,7 +59,7 @@ std::shared_ptr FrontendUIRenderForwardVLK::createUIMaterial(const } } - auto &l_imguiUbo = m_imguiUbo; + auto &l_imguiUbo = m_imguiUboVLK; auto material = MaterialBuilderVLK::fromShader(m_device, {"imguiShader", !opaque?"imguiShader":"imguiShader_opaque"}, {"forwardRendering","forwardRendering"}, {}) .createPipeline(m_emptyImguiVAO, m_lastRenderPass, s_imguiPipelineTemplate) .createDescriptorSet(0, [&l_imguiUbo](std::shared_ptr &ds) { @@ -92,7 +93,7 @@ std::shared_ptr FrontendUIRenderForwardVLK::createUIMaterialDepth(c } } - auto &l_imguiUbo = m_imguiUbo; + auto &l_imguiUbo = m_imguiUboVLK; auto material = MaterialBuilderVLK::fromShader(m_device, {"imguiShader", "imguiShaderDepth"}, {"forwardRendering", "forwardRendering"}, {}) .createPipeline(m_emptyImguiVAO, m_lastRenderPass, s_imguiPipelineTemplate) .createDescriptorSet(0, [&l_imguiUbo](std::shared_ptr &ds) { diff --git a/src/ui/renderer/uiScene/vulkan/FrontendUIRenderForwardVLK.h b/src/ui/renderer/uiScene/vulkan/FrontendUIRenderForwardVLK.h index 67c0c671..cd521ea1 100644 --- a/src/ui/renderer/uiScene/vulkan/FrontendUIRenderForwardVLK.h +++ b/src/ui/renderer/uiScene/vulkan/FrontendUIRenderForwardVLK.h @@ -5,7 +5,6 @@ #ifndef AWEBWOWVIEWERCPP_FRONTENDUIRENDERFORWARDVLK_H #define AWEBWOWVIEWERCPP_FRONTENDUIRENDERFORWARDVLK_H - #include #include #include "../FrontendUIRenderer.h" @@ -16,6 +15,7 @@ #include "../../../../../wowViewerLib/src/renderer/vulkan/IRenderFunctionVLK.h" #include "../../../../../wowViewerLib/src/gapi/vulkan/meshes/GMeshVLK.h" #include "../../../../../wowViewerLib/src/engine/objects/scenes/EntityActorsFactory.h" +#include "../../../../../wowViewerLib/src/gapi/vulkan/buffers/CBufferChunkVLK.h" class FrontendUIRenderForwardVLK : public FrontendUIRenderer { public: @@ -54,6 +54,8 @@ class FrontendUIRenderForwardVLK : public FrontendUIRenderer { std::shared_ptr m_lastRenderPass; std::shared_ptr> m_previousMeshes = nullptr; + std::shared_ptr> m_imguiUboVLK = nullptr; + HGVertexBufferBindings m_emptyImguiVAO = nullptr; }; diff --git a/wowViewerLib/src/engine/objects/scenes/map.cpp b/wowViewerLib/src/engine/objects/scenes/map.cpp index bf9ccd42..5ad5d0e0 100644 --- a/wowViewerLib/src/engine/objects/scenes/map.cpp +++ b/wowViewerLib/src/engine/objects/scenes/map.cpp @@ -997,12 +997,17 @@ void Map::getLightResultsFromDB(mathfu::vec3 &cameraVec3, const Config *config, } } - uint8_t currentLightParamId = 0; + uint8_t currentLightParamIdIndex = 0; + + int selectedLightParam = 0; + int selectedLightId = 0; if (zoneLightFound) { + selectedLightId = LightId; m_api->databaseHandler->getLightById(LightId, config->currentTime, zoneLightResult); if (stateForConditions != nullptr) { - stateForConditions->currentZoneLights.push_back(zoneLightResult.lightParamId[currentLightParamId]); + selectedLightParam = zoneLightResult.lightParamId[currentLightParamIdIndex]; + stateForConditions->currentZoneLights.push_back(zoneLightResult.lightParamId[currentLightParamIdIndex]); } } @@ -1017,27 +1022,31 @@ void Map::getLightResultsFromDB(mathfu::vec3 &cameraVec3, const Config *config, return a.blendAlpha > b.blendAlpha; }); - int selectedLightParam = 0; + for (auto it = lightResults.begin(); it != lightResults.end(); it++) { if (feq(it->pos[0], 0.0) && feq(it->pos[1], 0.0) && feq(it->pos[2], 0.0)) { //This is default record. If zoneLight was selected -> skip it. if (!zoneLightFound) { - + selectedLightParam = it->lightParamId[currentLightParamIdIndex]; + selectedLightId = it->id; } + } else { + selectedLightParam = it->lightParamId[currentLightParamIdIndex]; + selectedLightId = it->id; + break; } - selectedLightParam = it->lightParamId[currentLightParamId]; } - config->currentTime, - - if (stateForConditions != nullptr) { - for (auto &_light : lightResults) { - stateForConditions->currentZoneLights.push_back(_light.lightParamId[currentLightParamId]); - stateForConditions->currentLightIds.push_back(_light.id); - } + stateForConditions->currentZoneLights.push_back(selectedLightParam); + stateForConditions->currentLightIds.push_back(selectedLightId); } + LightParamData lightParamData; + if (m_api->databaseHandler->getLightParamData(selectedLightParam, config->currentTime, lightParamData)) { + //Blend two times using certain rules + + } } void Map::getPotentialEntities(const MathHelper::FrustumCullingData &frustumData, const mathfu::vec4 &cameraPos, diff --git a/wowViewerLib/src/gapi/vulkan/descriptorSets/GDescriptorSetLayout.cpp b/wowViewerLib/src/gapi/vulkan/descriptorSets/GDescriptorSetLayout.cpp index 96c9143c..22f7e862 100644 --- a/wowViewerLib/src/gapi/vulkan/descriptorSets/GDescriptorSetLayout.cpp +++ b/wowViewerLib/src/gapi/vulkan/descriptorSets/GDescriptorSetLayout.cpp @@ -202,8 +202,8 @@ void GDescriptorSetLayout::fillUbo(int setIndex, const DescTypeOverride &typeOve void GDescriptorSetLayout::fillSSBO(int setIndex, const DescTypeOverride &typeOverrides, std::unordered_map &shaderLayoutBindings, const shaderMetaData *p_metaData, const VkShaderStageFlagBits &vkStageFlag) { - for (int i = 0; i < p_metaData->ssboBindings.size(); i++) { - auto &ssboBinding = p_metaData->ssboBindings[i]; + for (int i = 0; i < p_metaData->m_ssboBindings.size(); i++) { + auto &ssboBinding = p_metaData->m_ssboBindings[i]; if (ssboBinding.set != setIndex) continue; diff --git a/wowViewerLib/src/gapi/vulkan/shaders/GShaderPermutationVLK.cpp b/wowViewerLib/src/gapi/vulkan/shaders/GShaderPermutationVLK.cpp index 5cf2511a..2cf9cc79 100644 --- a/wowViewerLib/src/gapi/vulkan/shaders/GShaderPermutationVLK.cpp +++ b/wowViewerLib/src/gapi/vulkan/shaders/GShaderPermutationVLK.cpp @@ -132,8 +132,8 @@ void GShaderPermutationVLK::createShaderLayout() { } } - for (int i = 0; i < shaderMeta->ssboBindings.size(); i++) { - auto &ssboBinding = shaderMeta->ssboBindings[i]; + for (int i = 0; i < shaderMeta->m_ssboBindings.size(); i++) { + auto &ssboBinding = shaderMeta->m_ssboBindings[i]; auto &setLayout = combinedShaderLayout.setLayouts[ssboBinding.set]; diff --git a/wowViewerLib/src/include/database/dbStructs.h b/wowViewerLib/src/include/database/dbStructs.h index 3a39aa0b..555d4531 100644 --- a/wowViewerLib/src/include/database/dbStructs.h +++ b/wowViewerLib/src/include/database/dbStructs.h @@ -82,6 +82,8 @@ struct LightParamData { float oceanDeepAlpha; int lightParamFlags = 0; + + std::array lightTimedData; };