change near z for orthographic proj
This commit is contained in:
parent
d84e5f8610
commit
6ef3cf1a3a
@ -61,14 +61,14 @@ Matrix4 camera_orthographic(const Camera *const camera) {
|
|||||||
|
|
||||||
const float rl = 1.0f / (camera->viewbox[0].y - camera->viewbox[0].x);
|
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 tb = 1.0f / (camera->viewbox[1].x - camera->viewbox[1].y);
|
||||||
const float fn = -1.0f / (CAMERA_FAR_Z - CAMERA_NEAR_Z);
|
const float fn = -1.0f / (CAMERA_FAR_Z - -CAMERA_FAR_Z);
|
||||||
|
|
||||||
result.row[0].x = 2.0f * rl;
|
result.row[0].x = 2.0f * rl;
|
||||||
result.row[1].y = 2.0f * tb;
|
result.row[1].y = 2.0f * tb;
|
||||||
result.row[2].z = 2.0f * fn;
|
result.row[2].z = 2.0f * fn;
|
||||||
result.row[3].x = -(camera->viewbox[0].y + camera->viewbox[0].x) * rl;
|
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].y = -(camera->viewbox[1].x + camera->viewbox[1].y) * tb;
|
||||||
result.row[3].z = (CAMERA_FAR_Z + CAMERA_NEAR_Z) * fn;
|
result.row[3].z = (CAMERA_FAR_Z + -CAMERA_FAR_Z) * fn;
|
||||||
result.row[3].w = 1.0f;
|
result.row[3].w = 1.0f;
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user