Immediate mode vertex submission attempt 1

This commit is contained in:
wheremyfoodat 2023-03-06 01:43:39 +02:00
parent 6ecdf71dbc
commit 922424b8d0
4 changed files with 61 additions and 10 deletions

View file

@ -51,9 +51,9 @@ const char* fragmentShader = R"(
fragColour = colour;
}
// Get original depth value pre-perspective by converting from [near, far] = [0, 1] to [-1, 1]
// Get original depth value by converting from [near, far] = [0, 1] to [-1, 1]
// We do this by converting to [0, 2] first and subtracting 1 to go to [-1, 1]
float z_over_w = gl_FragCoord.z * 2.0f - 1.0;
float z_over_w = gl_FragCoord.z * 2.0f - 1.0f;
float depth = z_over_w * u_depthScale + u_depthOffset;
if (!u_depthmapEnable) // Divide z by w if depthmap enable == 0 (ie using W-buffering)