Skip to content

Commit

Permalink
#5338: CamWnd is no longer implementing the ICameraView interface, th…
Browse files Browse the repository at this point in the history
…is is implemented by the Camera class
  • Loading branch information
codereader committed Sep 26, 2020
1 parent 40da556 commit 65eb3cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 30 deletions.
25 changes: 5 additions & 20 deletions radiant/camera/CamWnd.cpp
Expand Up @@ -396,7 +396,7 @@ void CamWnd::jumpToObject(SelectionTest& selectionTest)

// Focus the view at the center of the found AABB
// Set the camera and the views to the given point
GlobalCameraManager().focusCamera(found.origin, getCameraAngles());
GlobalCameraManager().focusCamera(found.origin, _camera.getCameraAngles());
GlobalXYWndManager().setOrigin(found.origin);
}
}
Expand Down Expand Up @@ -810,7 +810,7 @@ void CamWnd::benchmark()
angles[camera::CAMERA_ROLL] = 0;
angles[camera::CAMERA_PITCH] = 0;
angles[camera::CAMERA_YAW] = static_cast<double>(i * (360.0 / 100.0));
setCameraAngles(angles);
_camera.setCameraAngles(angles);
}

double dEnd = clock() / 1000.0;
Expand Down Expand Up @@ -877,21 +877,6 @@ void CamWnd::setCameraOrigin(const Vector3& origin)
_camera.setCameraOrigin(origin);
}

const Vector3& CamWnd::getRightVector() const
{
return _camera.vright;
}

const Vector3& CamWnd::getUpVector() const
{
return _camera.vup;
}

const Vector3& CamWnd::getForwardVector() const
{
return _camera.vpn;
}

const Vector3& CamWnd::getCameraAngles() const
{
return _camera.getCameraAngles();
Expand Down Expand Up @@ -961,12 +946,12 @@ void CamWnd::onMouseScroll(wxMouseEvent& ev)
if (ev.GetWheelRotation() > 0)
{
getCamera().freemoveUpdateAxes();
setCameraOrigin(getCameraOrigin() + getCamera().forward * movementSpeed);
_camera.setCameraOrigin(_camera.getCameraOrigin() + getCamera().forward * movementSpeed);
}
else if (ev.GetWheelRotation() < 0)
{
getCamera().freemoveUpdateAxes();
setCameraOrigin(getCameraOrigin() + getCamera().forward * -movementSpeed);
_camera.setCameraOrigin(_camera.getCameraOrigin() + getCamera().forward * -movementSpeed);
}
}

Expand All @@ -978,7 +963,7 @@ CameraMouseToolEvent CamWnd::createMouseEvent(const Vector2& point, const Vector
Vector2 normalisedDeviceCoords = device_constrained(
window_to_normalised_device(actualPoint, _camera.width, _camera.height));

return CameraMouseToolEvent(*this, normalisedDeviceCoords, delta);
return CameraMouseToolEvent(_camera, normalisedDeviceCoords, delta);
}

MouseTool::Result CamWnd::processMouseDownEvent(const MouseToolPtr& tool, const Vector2& point)
Expand Down
13 changes: 4 additions & 9 deletions radiant/camera/CamWnd.h
Expand Up @@ -37,7 +37,6 @@ namespace ui

class CamWnd :
public wxEvtHandler,
public ICameraView,
public IFreeMoveView,
public scene::Graph::Observer,
public util::Noncopyable,
Expand Down Expand Up @@ -113,15 +112,11 @@ class CamWnd :

Camera& getCamera();

const Vector3& getCameraOrigin() const override;
void setCameraOrigin(const Vector3& origin) override;
const Vector3& getCameraOrigin() const;
void setCameraOrigin(const Vector3& origin);

const Vector3& getRightVector() const override;
const Vector3& getUpVector() const override;
const Vector3& getForwardVector() const override;

const Vector3& getCameraAngles() const override;
void setCameraAngles(const Vector3& angles) override;
const Vector3& getCameraAngles() const;
void setCameraAngles(const Vector3& angles);

const Frustum& getViewFrustum() const;

Expand Down
2 changes: 1 addition & 1 deletion radiant/camera/GlobalCameraWndManager.cpp
Expand Up @@ -315,7 +315,7 @@ ICameraView& GlobalCameraWndManager::getActiveView()

if (!camWnd) throw std::runtime_error("No active camera view present");

return *camWnd;
return camWnd->getCamera();
}

// --------------- Keyboard movement methods ------------------------------------------
Expand Down

0 comments on commit 65eb3cd

Please sign in to comment.