twn_camera: fix aspect of ortho projection
This commit is contained in:
@ -59,15 +59,15 @@ Matrix4 camera_orthographic(const Camera *const camera) {
|
||||
|
||||
Matrix4 result = {0};
|
||||
|
||||
const float rl = 1.0f / (camera->viewbox[0].y - camera->viewbox[0].x);
|
||||
const float tb = 1.0f / (camera->viewbox[1].x - camera->viewbox[1].y);
|
||||
const float rl = 1.0f / (camera->viewbox.y - camera->viewbox.x);
|
||||
const float tb = 1.0f / (camera->viewbox.z - camera->viewbox.w);
|
||||
const float fn = -1.0f / (camera->far_z - -camera->far_z);
|
||||
|
||||
result.row[0].x = 2.0f * rl;
|
||||
result.row[1].y = 2.0f * tb;
|
||||
result.row[2].z = 2.0f * fn;
|
||||
result.row[3].x = -(camera->viewbox[0].y + camera->viewbox[0].x) * rl;
|
||||
result.row[3].y = -(camera->viewbox[1].x + camera->viewbox[1].y) * tb;
|
||||
result.row[3].x = -(camera->viewbox.y + camera->viewbox.x) * rl;
|
||||
result.row[3].y = -(camera->viewbox.z + camera->viewbox.w) * tb;
|
||||
result.row[3].z = (camera->far_z + -camera->far_z) * fn;
|
||||
result.row[3].w = 1.0f;
|
||||
|
||||
|
Reference in New Issue
Block a user