diff --git a/Assets/Shaders/DeferredComposite_CS.glsl b/Assets/Shaders/DeferredComposite_CS.glsl index d28eaec0..50a269ac 100644 --- a/Assets/Shaders/DeferredComposite_CS.glsl +++ b/Assets/Shaders/DeferredComposite_CS.glsl @@ -60,7 +60,7 @@ float CalcShadowValue (sampler2D shadowMap, vec4 worldSpaceFragPos, mat4 lightPV if (fragPosLightPOV.z > sampledDepth && fragPosLightPOV.w > 0.0f) { - return 0.0f; + return 0.7f; } else return 1.0f; diff --git a/Assets/Shaders/DeferredComposite_CS.shshaderb b/Assets/Shaders/DeferredComposite_CS.shshaderb index ceca4e13..7f06b471 100644 Binary files a/Assets/Shaders/DeferredComposite_CS.shshaderb and b/Assets/Shaders/DeferredComposite_CS.shshaderb differ diff --git a/Assets/Shaders/ShadowMap_FS.glsl b/Assets/Shaders/ShadowMap_FS.glsl new file mode 100644 index 00000000..f514c70b --- /dev/null +++ b/Assets/Shaders/ShadowMap_FS.glsl @@ -0,0 +1,10 @@ +#version 450 +#extension GL_ARB_separate_shader_objects : enable +#extension GL_ARB_shading_language_420pack : enable +#extension GL_EXT_nonuniform_qualifier : require + + +void main() +{ + +} \ No newline at end of file diff --git a/Assets/Shaders/ShadowMap_FS.shshaderb b/Assets/Shaders/ShadowMap_FS.shshaderb new file mode 100644 index 00000000..45304832 Binary files /dev/null and b/Assets/Shaders/ShadowMap_FS.shshaderb differ diff --git a/Assets/Shaders/ShadowMap_FS.shshaderb.shmeta b/Assets/Shaders/ShadowMap_FS.shshaderb.shmeta new file mode 100644 index 00000000..902f7f6d --- /dev/null +++ b/Assets/Shaders/ShadowMap_FS.shshaderb.shmeta @@ -0,0 +1,3 @@ +Name: ShadowMap_FS +ID: 45925790 +Type: 2 diff --git a/SHADE_Application/src/Application/SBApplication.cpp b/SHADE_Application/src/Application/SBApplication.cpp index ffc4bacc..e97d9eb4 100644 --- a/SHADE_Application/src/Application/SBApplication.cpp +++ b/SHADE_Application/src/Application/SBApplication.cpp @@ -5,7 +5,6 @@ //#define SHEDITOR #ifdef SHEDITOR #include "Editor/SHEditor.h" -#include "Physics/System/SHPhysicsDebugDrawSystem.h" //#include "Scenes/SBEditorScene.h" #endif // SHEDITOR @@ -32,6 +31,7 @@ #include "Input/SHInputManager.h" #include "Math/Transform/SHTransformSystem.h" #include "Physics/System/SHPhysicsSystem.h" +#include "Physics/System/SHPhysicsDebugDrawSystem.h" #include "Scripting/SHScriptEngine.h" #include "UI/SHUISystem.h" #include "Animation/SHAnimationSystem.h" @@ -74,15 +74,12 @@ namespace Sandbox #endif window.Create(hInstance, hPrevInstance, lpCmdLine, nCmdShow, wndData); - - SHAssetManager::Load(); - // Create Systems SHSystemManager::CreateSystem(); SHSystemManager::CreateSystem(); SHSystemManager::CreateSystem(); -#ifdef SHEDITOR +#ifndef _PUBLISH SHSystemManager::CreateSystem(); #endif @@ -125,7 +122,7 @@ namespace Sandbox SHSystemManager::RegisterRoutine(); SHSystemManager::RegisterRoutine(); -#ifdef SHEDITOR +#ifndef _PUBLISH SHSystemManager::RegisterRoutine(); #endif @@ -158,6 +155,7 @@ namespace Sandbox SHComponentManager::CreateComponentSparseSet(); //SHComponentManager::CreateComponentSparseSet(); + SHAssetManager::Load(); //auto font = SHAssetManager::GetData(176667660); SHSystemManager::RegisterRoutine(); diff --git a/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h b/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h index d02ba3d5..995a1cf5 100644 --- a/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h +++ b/SHADE_Engine/src/ECS_Base/Managers/SHSystemManager.h @@ -94,7 +94,7 @@ namespace SHADE if (systemContainer.find(id) == systemContainer.end()) { - std::cout << "System Manager error: System Version " << typeid(T).name() << ", " << version << " does not exist." << std::endl; + std::cout << "System Manager error: System Version " << version << " does not exit." << std::endl; return nullptr; } diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp index 6734a77e..99685585 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.cpp @@ -128,6 +128,7 @@ namespace SHADE SHFreetypeInstance::Init(); //SHAssetManager::CompileAsset("../../Assets/Shaders/DeferredComposite_CS.glsl", false); + //SHAssetManager::CompileAsset("../../Assets/Shaders/ShadowMap_FS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/SSAO_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/SSAOBlur_CS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/PureCopy_CS.glsl", false); @@ -137,6 +138,7 @@ namespace SHADE //SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false); //SHAssetManager::CompileAsset("../../Assets/Shaders/Text_VS.glsl", false); + // Load Built In Shaders static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet(VS_DEFAULT); static constexpr AssetID VS_ANIM = 47911992; animtVertShader = SHResourceManager::LoadOrGet(VS_ANIM); @@ -151,7 +153,8 @@ namespace SHADE static constexpr AssetID TEXT_FS = 38024754; textFS = SHResourceManager::LoadOrGet(TEXT_FS); static constexpr AssetID RENDER_SC_VS = 48082949; renderToSwapchainVS = SHResourceManager::LoadOrGet(RENDER_SC_VS); static constexpr AssetID RENDER_SC_FS = 36869006; renderToSwapchainFS = SHResourceManager::LoadOrGet(RENDER_SC_FS); - static constexpr AssetID SHADOW_MAP_VS = 44646107; shadowMapVS = SHResourceManager::LoadOrGet(SHADOW_MAP_VS); + static constexpr AssetID SHADOW_MAP_VS = 44646107; shadowMapVS = SHResourceManager::LoadOrGet(SHADOW_MAP_VS); + static constexpr AssetID SHADOW_MAP_FS = 45925790; shadowMapFS = SHResourceManager::LoadOrGet(SHADOW_MAP_FS); } @@ -583,14 +586,21 @@ namespace SHADE #endif } - //if (SHInputManager::GetKeyDown(SHInputManager::SH_KEYCODE::B)) - //{ - // auto& lightComps = SHComponentManager::GetDense(); - // for (auto& comp : lightComps) - // { - // comp.SetEnableShadow(true); - // } - //} + static bool shadowAdded = false; + + if (shadowAdded == false/* && SHInputManager::GetKey(SHInputManager::SH_KEYCODE::B)*/) + { + shadowAdded = true; + auto& lightComps = SHComponentManager::GetDense(); + if (lightComps.size() > 2) + { + lightComps[2].SetEnableShadow(true); + } + //for (auto& comp : lightComps) + //{ + // comp.SetEnableShadow(true); + //} + } renderGraph->Begin(frameIndex); auto cmdBuffer = renderGraph->GetCommandBuffer(frameIndex); @@ -809,11 +819,11 @@ namespace SHADE tempLibrary.Init(device); tempLibrary.CreateGraphicsPipelines ( - { shadowMapVS, {} }, shadowMapNode->GetRenderpass(), newSubpass, + { shadowMapVS, shadowMapFS }, shadowMapNode->GetRenderpass(), newSubpass, SHGraphicsPredefinedData::SystemType::BATCHING, SHGraphicsPredefinedData::GetShadowMapViState(), rasterState ); - shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, {} }); + shadowMapPipeline = tempLibrary.GetGraphicsPipeline({ shadowMapVS, shadowMapFS }); } newSubpass->SetCompanionSubpass(companionSubpass, shadowMapPipeline); // set companion subpass and pipeline diff --git a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h index d72dfcbd..a35065bd 100644 --- a/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h +++ b/SHADE_Engine/src/Graphics/MiddleEnd/Interface/SHGraphicsSystem.h @@ -469,6 +469,7 @@ namespace SHADE Handle renderToSwapchainVS; Handle renderToSwapchainFS; Handle shadowMapVS; + Handle shadowMapFS; // Fonts Handle testFont; diff --git a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h index c80e5d5c..312c3625 100644 --- a/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h +++ b/SHADE_Engine/src/Physics/System/SHPhysicsSystem.h @@ -169,8 +169,11 @@ namespace SHADE SHPhysicsObjectManager objectManager; SHCollisionListener collisionListener; SHRaycaster raycaster; - + + // For the debug drawer to draw rays + #ifdef SHEDITOR std::vector raycastHits; + #endif /*---------------------------------------------------------------------------------*/ /* Function Members */ diff --git a/SHADE_Engine/src/Scripting/SHScriptEngine.cpp b/SHADE_Engine/src/Scripting/SHScriptEngine.cpp index 2bdeaa5c..8b836d2a 100644 --- a/SHADE_Engine/src/Scripting/SHScriptEngine.cpp +++ b/SHADE_Engine/src/Scripting/SHScriptEngine.cpp @@ -62,9 +62,9 @@ namespace SHADE loadFunctions(); // Generate script assembly if it hasn't been before - #ifndef _PUBLISH +#ifndef _PUBLISH BuildScriptAssembly(); - #endif +#endif // Initialise the CSharp Engine csEngineInit(); diff --git a/SHADE_Managed/src/Engine/Application.cxx b/SHADE_Managed/src/Engine/Application.cxx index 5bde66d2..06ad632f 100644 --- a/SHADE_Managed/src/Engine/Application.cxx +++ b/SHADE_Managed/src/Engine/Application.cxx @@ -28,32 +28,25 @@ namespace SHADE /*---------------------------------------------------------------------------------*/ bool Application::IsPlaying::get() { -#ifdef SHEDITOR auto editor = SHSystemManager::GetSystem(); if (editor) return editor->editorState == SHEditor::State::PLAY || editor->editorState == SHEditor::State::PAUSE; -#endif return true; } bool Application::IsPaused::get() { -#ifdef SHEDITOR auto editor = SHSystemManager::GetSystem(); if (editor) return editor->editorState == SHEditor::State::PAUSE; -#endif + return false; } bool Application::IsEditor::get() { -#ifdef SHEDITOR return SHSystemManager::GetSystem() != nullptr; -#else - return false; -#endif } int Application::WindowWidth::get() {