Introduce perspective projection matrix.

Also correct a bug where the view matrix was not being used.
This commit is contained in:
2020-10-13 10:57:30 -04:00
parent 49927568e4
commit 6ff09dc375
3 changed files with 30 additions and 5 deletions

View File

@@ -19,9 +19,12 @@ struct Matrices {
auto aspect = (float) screen.width() / (float) screen.height();
auto pheight = 1.4f;
auto pwidth = aspect * pheight;
mat4 proj = ortho(-pwidth, pwidth, -pheight, pheight, -10.0f, 10.0f);
// auto proj = orthographic(-pwidth, pwidth, -pheight, pheight, -10.0f, 10.0f);
// auto proj = perspective(-pwidth, pwidth, pheight, -pheight, 10.0f, 0.01f);
auto proj = perspective(0.4, aspect, 0.1, 10.0);
auto view = translation(0, 0, -4);
auto view = mat4::Identity();
return Matrices(proj, view);
}
};