Debug draw d3d fix

This commit is contained in:
luboslenco 2018-03-24 11:39:05 +01:00
parent c6bd623a78
commit 98a4d18244
2 changed files with 18 additions and 1 deletions

View file

@ -1,13 +1,21 @@
#version 450
// #include "compiled.glsl"
in vec3 pos;
in vec3 col;
uniform mat4 VP;
out vec3 color;
// #ifdef _InvY
out vec4 wvpposition;
// #endif
void main() {
color = col;
gl_Position = VP * vec4(pos, 1.0);
// #ifdef _InvY
wvpposition = gl_Position;
// #endif
}

View file

@ -1,9 +1,18 @@
#version 450
#include "compiled.glsl"
in vec3 color;
// #ifdef _InvY
vec4 wvpposition;
// #endif
out vec4[2] fragColor;
void main() {
fragColor[0] = vec4(1.0, 1.0, 0.0, 1.0 - gl_FragCoord.z);
// #ifdef _InvY // D3D
fragColor[0] = vec4(1.0, 1.0, 0.0, 1.0 - ((wvpposition.z / wvpposition.w) * 0.5 + 0.5));
// #else
// fragColor[0] = vec4(1.0, 1.0, 0.0, 1.0 - gl_FragCoord.z);
// #endif
fragColor[1] = vec4(color, 1.0);
}