SpiecsEngine
 
Loading...
Searching...
No Matches

◆ MouseRotate()

void Spices::CameraController::MouseRotate ( const glm::vec2 & delta) const
private

Calculate Camera Rotate.

Parameters
[in]deltaMouse position delta on viewport during frames.

Definition at line 135 of file CameraController.cpp.

136 {
138
139 glm::vec3 rot = m_CameraTranComp->GetRotation();
140 const float yawSign = GetUpDirection().y < 0 ? -1.0f : 1.0f;
141
142 rot.y -= glm::degrees(yawSign * delta.x * RotationSpeed());
143 rot.x += glm::degrees(delta.y * RotationSpeed());
144
146 }
#define SPICES_PROFILE_ZONE
glm::vec3 GetUpDirection() const
Get Camera Up(y) Direction.
TransformComponent * m_CameraTranComp
The camera transform component pointer get from owner's transform component.
float RotationSpeed() const
Calculate Camera Rotate speed.
const glm::vec3 & GetRotation() const
Get the rotation variable.
void SetRotation(const glm::vec3 &rotation)
Set the rotation this component handled. Call CalMatrix() during this API.