Implemented improved shadows (still abit whack), trajectory system (untested), and window resize event #352
|
@ -12,6 +12,7 @@
|
||||||
#include "Editor/SHEditor.h"
|
#include "Editor/SHEditor.h"
|
||||||
#include "Math/SHRay.h"
|
#include "Math/SHRay.h"
|
||||||
#include "Physics/System/SHPhysicsSystem.h"
|
#include "Physics/System/SHPhysicsSystem.h"
|
||||||
|
#include "Graphics/Events/SHGraphicsEvents.h"
|
||||||
|
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
@ -122,6 +123,13 @@ namespace SHADE
|
||||||
|
|
||||||
SHComponentManager::CreateComponentSparseSet<SHCameraComponent>();
|
SHComponentManager::CreateComponentSparseSet<SHCameraComponent>();
|
||||||
SHComponentManager::CreateComponentSparseSet<SHCameraArmComponent>();
|
SHComponentManager::CreateComponentSparseSet<SHCameraArmComponent>();
|
||||||
|
|
||||||
|
std::shared_ptr<SHEventReceiverSpec<SHCameraSystem>> thisReceiver
|
||||||
|
{
|
||||||
|
std::make_shared<SHEventReceiverSpec<SHCameraSystem>>(this, &SHCameraSystem::ReceiveWindowResizeEvent)
|
||||||
|
};
|
||||||
|
ReceiverPtr receiver = std::dynamic_pointer_cast<SHEventReceiver>(thisReceiver);
|
||||||
|
SHEventManager::SubscribeTo(SH_WINDOW_RESIZE_EVENT, receiver);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,6 +138,16 @@ namespace SHADE
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SHEventHandle SHCameraSystem::ReceiveWindowResizeEvent(SHEventPtr eventPtr) noexcept
|
||||||
|
{
|
||||||
|
auto const& EVENT_DATA = reinterpret_cast<const SHEventSpec<SHWindowResizeEvent>*>(eventPtr.get())->data;
|
||||||
|
|
||||||
|
//std::cout << EVENT_DATA->resizeWidth << std::endl;
|
||||||
|
//std::cout << EVENT_DATA->resizeHeight << std::endl;
|
||||||
|
|
||||||
|
return eventPtr->handle;
|
||||||
|
}
|
||||||
|
|
||||||
SHCameraComponent* SHCameraSystem::GetEditorCamera(void) noexcept
|
SHCameraComponent* SHCameraSystem::GetEditorCamera(void) noexcept
|
||||||
{
|
{
|
||||||
return &editorCamera;
|
return &editorCamera;
|
||||||
|
|
|
@ -46,6 +46,11 @@ namespace SHADE
|
||||||
};
|
};
|
||||||
friend class CameraSystemUpdate;
|
friend class CameraSystemUpdate;
|
||||||
|
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
/* Light functions */
|
||||||
|
/*-----------------------------------------------------------------------*/
|
||||||
|
SHEventHandle ReceiveWindowResizeEvent(SHEventPtr eventPtr) noexcept;
|
||||||
|
|
||||||
|
|
||||||
SHCameraComponent* GetEditorCamera (void) noexcept;
|
SHCameraComponent* GetEditorCamera (void) noexcept;
|
||||||
void GetCameraAxis(SHCameraComponent const& camera, SHVec3& forward, SHVec3& right, SHVec3& up) const noexcept;
|
void GetCameraAxis(SHCameraComponent const& camera, SHVec3& forward, SHVec3& right, SHVec3& up) const noexcept;
|
||||||
|
|
|
@ -25,4 +25,5 @@ constexpr SHEventIdentifier SH_SCENE_EXIT_POST { 16 };
|
||||||
constexpr SHEventIdentifier SH_GRAPHICS_LIGHT_ENABLE_SHADOW_EVENT { 17 };
|
constexpr SHEventIdentifier SH_GRAPHICS_LIGHT_ENABLE_SHADOW_EVENT { 17 };
|
||||||
constexpr SHEventIdentifier SH_BUTTON_CLICK_EVENT { 18 };
|
constexpr SHEventIdentifier SH_BUTTON_CLICK_EVENT { 18 };
|
||||||
constexpr SHEventIdentifier SH_PHYSICS_COLLIDER_DRAW_EVENT { 19 };
|
constexpr SHEventIdentifier SH_PHYSICS_COLLIDER_DRAW_EVENT { 19 };
|
||||||
|
constexpr SHEventIdentifier SH_WINDOW_RESIZE_EVENT { 20 };
|
||||||
|
|
||||||
|
|
|
@ -14,4 +14,13 @@ namespace SHADE
|
||||||
//! Generate a renderer for the light component
|
//! Generate a renderer for the light component
|
||||||
bool generateRenderer;
|
bool generateRenderer;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct SHWindowResizeEvent
|
||||||
|
{
|
||||||
|
// New width when window resizes
|
||||||
|
uint32_t resizeWidth;
|
||||||
|
|
||||||
|
// New height when window resizes
|
||||||
|
uint32_t resizeHeight;
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,8 +138,8 @@ namespace SHADE
|
||||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_VS.glsl", false);
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_VS.glsl", false);
|
||||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false);
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/UI_FS.glsl", false);
|
||||||
//SHAssetManager::CompileAsset("../../Assets/Shaders/Text_VS.glsl", false);
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/Text_VS.glsl", false);
|
||||||
SHAssetManager::CompileAsset("../../Assets/Shaders/Trajectory_VS.glsl", false);
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/Trajectory_VS.glsl", false);
|
||||||
SHAssetManager::CompileAsset("../../Assets/Shaders/Trajectory_FS.glsl", false);
|
//SHAssetManager::CompileAsset("../../Assets/Shaders/Trajectory_FS.glsl", false);
|
||||||
|
|
||||||
// Load Built In Shaders
|
// Load Built In Shaders
|
||||||
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
|
static constexpr AssetID VS_DEFAULT = 39210065; defaultVertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(VS_DEFAULT);
|
||||||
|
@ -1178,6 +1178,14 @@ namespace SHADE
|
||||||
#ifdef SHEDITOR
|
#ifdef SHEDITOR
|
||||||
cameraSystem->GetEditorCamera()->SetWidth(static_cast<float>(resizeWidth));
|
cameraSystem->GetEditorCamera()->SetWidth(static_cast<float>(resizeWidth));
|
||||||
cameraSystem->GetEditorCamera()->SetHeight(static_cast<float>(resizeHeight));
|
cameraSystem->GetEditorCamera()->SetHeight(static_cast<float>(resizeHeight));
|
||||||
|
|
||||||
|
// Create new event and broadcast it
|
||||||
|
SHWindowResizeEvent newEvent;
|
||||||
|
newEvent.resizeWidth = resizeWidth;
|
||||||
|
newEvent.resizeHeight = resizeHeight;
|
||||||
|
|
||||||
|
SHEventManager::BroadcastEvent<SHWindowResizeEvent>(newEvent, SH_WINDOW_RESIZE_EVENT);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
#include "SHpch.h"
|
||||||
#include "SHParticleSubSustem.h"
|
#include "SHParticleSubSustem.h"
|
||||||
|
|
||||||
namespace SHADE
|
namespace SHADE
|
||||||
|
|
Loading…
Reference in New Issue