Changeset 1350
- Timestamp:
- May 8, 2012, 10:04:00 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/orbital/orbital.cpp
r1349 r1350 70 70 //Ticker::Ref(m_particlesystem); 71 71 72 m_camera = new Camera(vec3(0, 300, 300), 72 /* Create a camera that matches the settings of XNA Orbital */ 73 m_camera = new Camera(vec3(0, 50, 0), 73 74 vec3(0, 0, 0), 74 vec3(0, 1, 0)); 75 vec3(0, 0, -1)); 76 m_camera->SetOrtho(1280.f / 3, 960.f / 3, -1000.f, 1000.f); 75 77 Ticker::Ref(m_camera); 76 78 -
trunk/src/camera.cpp
r1348 r1350 32 32 m_drawgroup = DRAWGROUP_CAMERA; 33 33 34 /* Create a default perspective */ 35 SetPerspective(45.f, 800.f, 600.f, -1000.f, 1000.f); 34 36 SetPosition(position); 35 37 } … … 42 44 { 43 45 m_position = pos; 46 } 47 48 void Camera::SetOrtho(float width, float height, float near, float far) 49 { 50 m_proj_matrix = mat4::ortho(width, height, near, far); 51 } 52 53 void Camera::SetPerspective(float fov, float width, float height, 54 float near, float far) 55 { 56 m_proj_matrix = mat4::perspective(fov, width, height, near, far); 44 57 } 45 58 … … 82 95 83 96 m_view_matrix = mat4::lookat(m_position, m_target, m_up); 84 m_proj_matrix = mat4::perspective(45.0f, 640.0f, 480.0f, 1.f, 10000.0f);85 //m_proj_matrix = mat4::ortho(-160, 160, -120, 120, .1f, 2000.0f);86 97 } 87 98 -
trunk/src/camera.h
r1310 r1350 31 31 32 32 void SetPosition(vec3 const &pos); 33 void SetOrtho(float width, float height, float near, float far); 34 void SetPerspective(float fov, float width, float height, 35 float near, float far); 33 36 34 37 mat4 const &GetViewMatrix(); -
trunk/src/lol/math/vector.h
r1349 r1350 1815 1815 /* Helpers for projection matrices */ 1816 1816 static Mat4<T> ortho(T left, T right, T bottom, T top, T near, T far); 1817 static Mat4<T> ortho(T width, T height, T near, T far); 1817 1818 static Mat4<T> frustum(T left, T right, T bottom, T top, T near, T far); 1818 1819 static Mat4<T> perspective(T fov_y, T width, T height, T near, T far); -
trunk/src/math/vector.cpp
r1349 r1350 659 659 } 660 660 661 template<> mat4 mat4::ortho(float width, float height, 662 float near, float far) 663 { 664 return mat4::ortho(-0.5f * width, 0.5f * width, 665 -0.5f * height, 0.5f * height, near, far); 666 } 667 661 668 template<> mat4 mat4::frustum(float left, float right, float bottom, 662 669 float top, float near, float far)
Note: See TracChangeset
for help on using the changeset viewer.