-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #91 from Christof/camera-node
Add camera node which is stored in scene.
- Loading branch information
Showing
23 changed files
with
336 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,55 @@ | ||
#include "./camera_controller.h" | ||
#include <QDebug> | ||
#include "./camera.h" | ||
|
||
CameraController::CameraController(Camera &camera) : camera(camera) | ||
CameraController::CameraController(std::shared_ptr<Camera> camera) | ||
: camera(camera) | ||
{ | ||
} | ||
|
||
CameraController::~CameraController() | ||
{ | ||
} | ||
|
||
void CameraController::setFrameTime(double frameTime) | ||
void CameraController::update(std::shared_ptr<Camera> camera, double frameTime) | ||
{ | ||
this->camera = camera; | ||
this->frameTime = frameTime; | ||
} | ||
|
||
void CameraController::moveForward() | ||
{ | ||
camera.moveForward(frameTime * cameraSpeed); | ||
camera->moveForward(frameTime * cameraSpeed); | ||
} | ||
|
||
void CameraController::moveBackward() | ||
{ | ||
camera.moveBackward(frameTime * cameraSpeed); | ||
camera->moveBackward(frameTime * cameraSpeed); | ||
} | ||
|
||
void CameraController::strafeLeft() | ||
{ | ||
camera.strafeLeft(frameTime * cameraSpeed); | ||
camera->strafeLeft(frameTime * cameraSpeed); | ||
} | ||
|
||
void CameraController::strafeRight() | ||
{ | ||
camera.strafeRight(frameTime * cameraSpeed); | ||
camera->strafeRight(frameTime * cameraSpeed); | ||
} | ||
|
||
void CameraController::azimuthLeft() | ||
{ | ||
camera.changeAzimuth(frameTime); | ||
camera->changeAzimuth(frameTime); | ||
} | ||
|
||
void CameraController::azimuthRight() | ||
{ | ||
camera.changeAzimuth(-frameTime); | ||
camera->changeAzimuth(-frameTime); | ||
} | ||
|
||
void CameraController::increaseDeclination() | ||
{ | ||
camera.changeDeclination(-frameTime); | ||
camera->changeDeclination(-frameTime); | ||
} | ||
|
||
void CameraController::decreaseDeclination() | ||
{ | ||
camera.changeDeclination(frameTime); | ||
camera->changeDeclination(frameTime); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,16 @@ | ||
#include "./camera_move_controller.h" | ||
#include "./camera.h" | ||
|
||
CameraMoveController::CameraMoveController(Camera &camera) : camera(camera) | ||
CameraMoveController::CameraMoveController(std::shared_ptr<Camera> camera) | ||
: MouseDraggingController(camera, 0.2) | ||
{ | ||
} | ||
|
||
void CameraMoveController::update(Eigen::Vector2f diff) | ||
void CameraMoveController::updateFromDiff(Eigen::Vector2f diff) | ||
{ | ||
Eigen::Vector2f delta = -frameTime * speedFactor * diff; | ||
|
||
camera.strafe(delta.x()); | ||
camera.moveVertical(delta.y()); | ||
camera->strafe(delta.x()); | ||
camera->moveVertical(delta.y()); | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "./camera_node.h" | ||
|
||
CameraNode::CameraNode() | ||
{ | ||
camera = std::make_shared<Camera>(); | ||
} | ||
|
||
CameraNode::CameraNode(std::shared_ptr<Camera> camera) | ||
: camera(camera) | ||
{ | ||
} | ||
|
||
void CameraNode::render(Graphics::Gl *gl, | ||
std::shared_ptr<Graphics::Managers> managers, | ||
RenderData renderData) | ||
{ | ||
} | ||
|
||
std::shared_ptr<Camera> CameraNode::getCamera() | ||
{ | ||
return camera; | ||
} |
Oops, something went wrong.