Sp3 141 camera system #108

Merged
maverickdgg merged 8 commits from SP3-141-Camera-System into main 2022-10-23 12:52:37 +08:00
2 changed files with 19 additions and 2 deletions
Showing only changes of commit 31ad8b8c87 - Show all commits

View File

@ -178,6 +178,20 @@ namespace SHADE
{
system->UpdateCameraComponent(cam);
}
for (auto& handle : system->directorHandleList)
{
handle->UpdateMatrix();
}
}
Handle<SHCameraDirector> SHCameraSystem::CreateDirector() noexcept
{
auto handle = directorLibrary.Create();
directorHandleList.emplace_back(handle);
return handle;
}
}

View File

@ -4,7 +4,8 @@
#include "SHCameraComponent.h"
#include "ECS_Base/System/SHSystemRoutine.h"
#include "Resource/ResourceLibrary.h"
#include "SHCameraDirector.h"
#include "Resource/Handle.h"
#include "SH_API.h"
namespace SHADE
@ -16,7 +17,8 @@ namespace SHADE
//This is not tied to any entity. Hence this EID should not be used.
SHCameraComponent editorCamera;
ResourceLibrary<SHCameraDirector> directorLibrary;
std::vector<Handle<SHCameraDirector>> directorHandleList;
public:
SHCameraSystem(void) = default;
@ -46,6 +48,7 @@ namespace SHADE
SHCameraComponent* GetEditorCamera (void) noexcept;
void GetCameraAxis(SHCameraComponent const& camera, SHVec3& forward, SHVec3& right, SHVec3& up) const noexcept;
Handle<SHCameraDirector> CreateDirector() noexcept;
protected:
void UpdateCameraComponent(SHCameraComponent& camera) noexcept;