First time Vulkan can render a map without light interactions

This commit is contained in:
Robert Beckebans 2018-11-03 12:01:03 +01:00
parent 2f8413b2ee
commit 49eb54d1ad
12 changed files with 167 additions and 134 deletions

View file

@ -454,7 +454,7 @@ void R_SetupProjectionMatrix( viewDef_t* viewDef )
ymax += jittery * height;
// RB: IMPORTANT - the projectionMatrix has a few changes to make it work with Vulkan
// In Vulkan is the y-axis flipped
// for a detailed explanation see https://matthewwellings.com/blog/the-new-vulkan-coordinate-system/
viewDef->projectionMatrix[0 * 4 + 0] = 2.0f * zNear / width;
viewDef->projectionMatrix[1 * 4 + 0] = 0.0f;
@ -462,6 +462,8 @@ void R_SetupProjectionMatrix( viewDef_t* viewDef )
viewDef->projectionMatrix[3 * 4 + 0] = 0.0f;
viewDef->projectionMatrix[0 * 4 + 1] = 0.0f;
// RB: Y axis now points down the screen
#if defined(USE_VULKAN)
viewDef->projectionMatrix[1 * 4 + 1] = -2.0f * zNear / height;
#else
@ -476,7 +478,10 @@ void R_SetupProjectionMatrix( viewDef_t* viewDef )
viewDef->projectionMatrix[0 * 4 + 2] = 0.0f;
viewDef->projectionMatrix[1 * 4 + 2] = 0.0f;
viewDef->projectionMatrix[2 * 4 + 2] = -0.999f; // adjust value to prevent imprecision issues
viewDef->projectionMatrix[3 * 4 + 2] = -1.0f * zNear; // RB: was -2.0f * zNear
// RB: was -2.0f * zNear
// the transformation into window space has changed from [-1 .. -1] to [0 .. -1]
viewDef->projectionMatrix[3 * 4 + 2] = -1.0f * zNear;
viewDef->projectionMatrix[0 * 4 + 3] = 0.0f;
viewDef->projectionMatrix[1 * 4 + 3] = 0.0f;