mirror of
https://github.com/HowestDAE/dae16-VerhulstBram.git
synced 2025-12-17 07:01:49 +01:00
Remove Point2f, replace with Vector2f
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
Camera::Camera() : m_Position { 0, 0 }, m_Scale { 1.0f } {
|
||||
}
|
||||
|
||||
Camera::Camera(const Point2f& position, float scale) : m_Position { position }, m_Scale { scale } {
|
||||
Camera::Camera(const Vector2f& position, float scale) : m_Position { position }, m_Scale { scale } {
|
||||
}
|
||||
|
||||
|
||||
@@ -19,14 +19,14 @@ void Camera::EndRendering() const {
|
||||
glPopMatrix();
|
||||
}
|
||||
|
||||
Point2f Camera::TransformMouse(const Point2f& mousePos) const {
|
||||
Point2f worldPos = mousePos;
|
||||
Vector2f Camera::TransformMouse(const Vector2f& mousePos) const {
|
||||
Vector2f worldPos = mousePos;
|
||||
worldPos.x = ( worldPos.x + m_Position.x ) / m_Scale;
|
||||
worldPos.y = Viewport.height - worldPos.y + m_Position.y / m_Scale;
|
||||
return worldPos;
|
||||
}
|
||||
Point2f Camera::TransformWorld(const Point2f& worldPos) const {
|
||||
Point2f screenPos = worldPos;
|
||||
Vector2f Camera::TransformWorld(const Vector2f& worldPos) const {
|
||||
Vector2f screenPos = worldPos;
|
||||
screenPos.x = screenPos.x * m_Scale - m_Position.x;
|
||||
screenPos.y = Viewport.height - screenPos.y * m_Scale - m_Position.y;
|
||||
return screenPos;
|
||||
|
||||
Reference in New Issue
Block a user