Fixed RTTR registration. Added back Camera Clamp

This commit is contained in:
maverickdgg 2022-10-27 10:33:54 +08:00
parent 0c2d020f89
commit dee4e9acbd
3 changed files with 9 additions and 9 deletions

View File

@ -103,7 +103,7 @@ namespace SHADE
}
dirtyView = true;
}
void SHCameraComponent::SetPosition(SHVec3& pos) noexcept
void SHCameraComponent::SetPosition(SHVec3 pos) noexcept
{
this->position = pos;
if (SHComponentManager::HasComponent<SHTransformComponent>(GetEID()))
@ -152,7 +152,7 @@ namespace SHADE
dirtyProj = true;
}
SHVec3 const& SHCameraComponent::GetPosition() const noexcept
SHVec3 SHCameraComponent::GetPosition() const noexcept
{
return position;
}
@ -233,7 +233,7 @@ RTTR_REGISTRATION
using namespace rttr;
registration::class_<SHCameraComponent>("Camera Component")
.property("Position", &SHCameraComponent::GetPosition, select_overload<void(SHVec3&)>(&SHCameraComponent::SetPosition))
.property("Position", &SHCameraComponent::GetPosition, select_overload<void(SHVec3)>(&SHCameraComponent::SetPosition))
.property("Pitch", &SHCameraComponent::GetPitch, &SHCameraComponent::SetPitch)
.property("Yaw", &SHCameraComponent::GetYaw, &SHCameraComponent::SetYaw)
.property("Roll", &SHCameraComponent::GetRoll, &SHCameraComponent::SetRoll)

View File

@ -52,7 +52,7 @@ namespace SHADE
void SetPositionY(float y) noexcept;
void SetPositionZ(float z) noexcept;
void SetPosition(float x, float y, float z) noexcept;
void SetPosition(SHVec3& pos) noexcept;
void SetPosition(SHVec3 pos) noexcept;
void SetWidth(float width) noexcept;
void SetHeight(float height) noexcept;
@ -62,7 +62,7 @@ namespace SHADE
void SetIsPerspective(bool persp) noexcept;
SHVec3 const& GetPosition() const noexcept;
SHVec3 GetPosition() const noexcept;
float GetYaw() const noexcept;
float GetPitch() const noexcept;
float GetRoll() const noexcept;
@ -84,12 +84,12 @@ namespace SHADE
float movementSpeed;
SHVec3 turnSpeed;
RTTR_ENABLE()
protected:
RTTR_ENABLE()
};

View File

@ -154,7 +154,7 @@ namespace SHADE
SHVec3 view, right, UP;
//ClampCameraRotation(camera);
ClampCameraRotation(camera);
GetCameraAxis(camera, view, right, UP);
@ -221,8 +221,8 @@ namespace SHADE
SHVec3 up = { 0.0f,1.0f,0.0f };
target = SHVec3::RotateX(target, SHMath::DegreesToRadians(camera.pitch));
target = SHVec3::RotateY(target, SHMath::DegreesToRadians(camera.yaw));
target =SHVec3::RotateX(target, SHMath::DegreesToRadians(camera.pitch));
target += camera.position;
////SHVec3::RotateZ(target, SHMath::DegreesToRadians(camera.roll));