daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Jan 23rd, 2014 8 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include "CameraController.cuh"
  2.  
  3. __device__
  4. CameraController::CameraController(Camera& camera, const float& speed)
  5.         : m_camera(&camera)
  6.         , movementSpeed(speed)
  7. {
  8. }
  9.  
  10. __device__
  11. Vector CameraController::forward()
  12. {
  13.         // Vector(0, 0, 0) - Vector(0, 0, 1)  
  14.         //return Vector(0, 0, -1);
  15.         return m_camera->frontDir;
  16. }
  17.  
  18. __device__
  19. Vector CameraController::backward()
  20. {
  21.         //return Vector(0, 0, 1);
  22.         return -m_camera->frontDir;
  23. }
  24.  
  25. __device__
  26. Vector CameraController::right()
  27. {
  28.         //return Vector(-1, 0, 0);
  29.         return m_camera->rightDir;
  30. }
  31.  
  32. __device__
  33. Vector CameraController::left()
  34. {
  35.         //return Vector(1, 0, 0);
  36.         return -m_camera->rightDir;
  37. }
  38.  
  39. __device__
  40. void CameraController::moveForward()
  41. {
  42.         m_camera->pos += forward() * movementSpeed;
  43. }
  44.  
  45. __device__
  46. void CameraController::moveBackward()
  47. {
  48.         m_camera->pos += backward() * movementSpeed;
  49. }
  50.  
  51. __device__
  52. void CameraController::strafeRight()
  53. {
  54.         m_camera->pos += right() * movementSpeed;
  55. }
  56.  
  57. __device__
  58. void CameraController::strafeLeft()
  59. {
  60.         m_camera->pos += left() * movementSpeed;
  61. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top