X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Frender%2Fcamera.cpp;h=9ecb79cd80643d4ce4e4d77f045d4354aebb37af;hb=99ca354f18119f82f1adeca100cd665a8f640317;hp=8f681a74bd19d843130e8bdccea6272e5808d506;hpb=38712d8ecc57d043a2419ffbaeeb57f7a6586f14;p=libs%2Fgl.git diff --git a/source/render/camera.cpp b/source/render/camera.cpp index 8f681a74..9ecb79cd 100644 --- a/source/render/camera.cpp +++ b/source/render/camera.cpp @@ -13,6 +13,23 @@ Camera::Camera() update_object_matrix(); } +void Camera::copy_parameters(const Camera &source) +{ + fov = source.fov; + height = source.height; + aspect = source.aspect; + clip_near = source.clip_near; + clip_far = source.clip_far; + frustum_x = source.frustum_x; + frustum_y = source.frustum_y; + rotate = source.rotate; + position = source.position; + look_dir = source.look_dir; + up_dir = source.up_dir; + update_projection_matrix(); + update_object_matrix(); +} + void Camera::set_field_of_view(const Geometry::Angle &f) { fov = f; @@ -122,6 +139,8 @@ void Camera::update_projection_matrix() proj_matrix = Matrix::ortho(left, right, bottom, top, clip_near, clip_far); proj_matrix = Matrix::rotation(rotate, Vector3(0, 0, 1))*proj_matrix; + adjust_projection_matrix(proj_matrix); + shdata.uniform("clip_eye_matrix", proj_matrix); shdata.uniform("eye_clip_matrix", invert(proj_matrix)); }