mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-06-01 09:02:08 +00:00
[vulkan] Use simpler projection and z_up matrices
While both matrices had positive determinants in the first place, I find the projection matrix easier to understand without all the negatives, and having quake-x/vulkan-z positively parallel in the z-up matrix makes that a lot easier to think about.
This commit is contained in:
parent
cd26073b6a
commit
e67ec84db9
2 changed files with 8 additions and 6 deletions
|
@ -77,8 +77,8 @@ QFV_PerspectiveTan (mat4f_t proj, float fov, float aspect)
|
||||||
fard = r_farclip->value;
|
fard = r_farclip->value;
|
||||||
|
|
||||||
proj[0] = (vec4f_t) { f / aspect, 0, 0, 0 };
|
proj[0] = (vec4f_t) { f / aspect, 0, 0, 0 };
|
||||||
proj[1] = (vec4f_t) { 0, -f, 0, 0 };
|
proj[1] = (vec4f_t) { 0, f, 0, 0 };
|
||||||
proj[2] = (vec4f_t) { 0, 0, fard / (neard - fard), -1 };
|
proj[2] = (vec4f_t) { 0, 0, fard / (fard - neard), 1 };
|
||||||
proj[3] = (vec4f_t) { 0, 0, (neard * fard) / (neard - fard), 0 };
|
proj[3] = (vec4f_t) { 0, 0, (neard * fard) / (neard - fard), 0 };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -64,11 +64,13 @@ static void
|
||||||
setup_view (vulkan_ctx_t *ctx)
|
setup_view (vulkan_ctx_t *ctx)
|
||||||
{
|
{
|
||||||
mat4f_t view;
|
mat4f_t view;
|
||||||
|
// Quake's world is z-up, x-forward, y-left, but Vulkan's world is
|
||||||
|
// z-forward, x-right, y-down.
|
||||||
static mat4f_t z_up = {
|
static mat4f_t z_up = {
|
||||||
{ 0, 0, -1, 0},
|
{ 0, 0, 1, 0},
|
||||||
{-1, 0, 0, 0},
|
{-1, 0, 0, 0},
|
||||||
{ 0, 1, 0, 0},
|
{ 0,-1, 0, 0},
|
||||||
{ 0, 0, 0, 1},
|
{ 0, 0, 0, 1},
|
||||||
};
|
};
|
||||||
vec4f_t offset = { 0, 0, 0, 1 };
|
vec4f_t offset = { 0, 0, 0, 1 };
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue