Camera.cpp
Go to the documentation of this file.
50 * glm::ortho( 0.0f, geometry.size.x / geometry.density, 0.0f, geometry.size.y / geometry.density, 1.0f, -1001.0f );
52 this->state.pixelizing_projection = glm::scale( float4x4( 1 ), float3( 1.0f, -1.0f, 1.0f ) ) // Y inversion
77 //==================================================================================================
78 //--------------------- math -----------------------------------------------------------------------
91 screen_point.y = view_size.y - screen_point.y; // Flip Y coordinate, because natively 3D Y coordinate begins at bottom but we have it on top (to match gui construction).
108 screen_point.y = view_size.y - screen_point.y; // Flip Y coordinate, because natively 3D Y coordinate begins at bottom but we have it on top (to match gui construction).
127 float4 local_space = glm::inverse( mvp ) * float4( camera_space.x, camera_space.y, camera_space.z, 1.0f );
137 float3 camera_lorigin = this->WNormalized( mvp * local_lorigin ); // local origin seen by camera-relative observer
140 float3 camera_in = this->FromViewportSpaceToCameraSpace( float3( in.x, in.y, 0.0 ) ); // input point seen by camera-relative observer
141 float3 camera_move( camera_in.x - camera_lorigin.x, camera_in.y - camera_lorigin.y, 0.0 ); // distance between input point and local origin seen by camera-relative observer
144 camera_move.z = ( -1.0f * mvp_inv[ 0 ][ 2 ] * camera_move.x - mvp_inv[ 1 ][ 2 ] * camera_move.y ) / mvp_inv[ 2 ][ 2 ];