mirror of https://github.com/OpenMW/openmw.git
debug draw shader uses the generic functions
renamed files roundabout way to change case with windows noticing fixed type fix filename in cmakelist.txt ported shader and c++ code so glsl 120 can be used instead of 330 new debug shader and old one are almost unified for some reason, even though I get no compilation issue, old debug draws don't work, only the new one implemented by this MR remove useless const castcrashfix_debugdraw
parent
bd1bbc0ab8
commit
21971c08ba
@ -1,15 +0,0 @@
|
||||
#version 330 compatibility
|
||||
|
||||
in vec3 vertexColor;
|
||||
in vec3 vertexNormal;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 lightDir = normalize(vec3(-1., -0.5, -2.));
|
||||
|
||||
float lightAttenuation = dot(-lightDir, vertexNormal) * 0.5 + 0.5;
|
||||
|
||||
fragColor = vec4(vertexColor * lightAttenuation, 1.);
|
||||
}
|
@ -1,22 +0,0 @@
|
||||
#version 330 compatibility
|
||||
|
||||
uniform mat4 projectionMatrix;
|
||||
|
||||
uniform vec3 color;
|
||||
uniform vec3 trans;
|
||||
uniform vec3 scale;
|
||||
uniform int useNormalAsColor;
|
||||
|
||||
layout(location = 0) in vec3 aPos;
|
||||
layout(location = 1) in vec3 aNormal;
|
||||
|
||||
out vec3 vertexColor;
|
||||
out vec3 vertexNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = projectionMatrix * gl_ModelViewMatrix * vec4(aPos * scale + trans, 1.);
|
||||
|
||||
vertexNormal = useNormalAsColor == 1 ? vec3(1., 1., 1.) : aNormal;
|
||||
vertexColor = useNormalAsColor == 1 ? aNormal : color.xyz;
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
#version 120
|
||||
#include "vertexcolors.glsl"
|
||||
|
||||
varying vec3 vertexColor;
|
||||
varying vec3 vertexNormal;
|
||||
|
||||
uniform int useAdvancedShader = 0;
|
||||
|
||||
void main()
|
||||
{
|
||||
vec3 lightDir = normalize(vec3(-1., -0.5, -2.));
|
||||
|
||||
float lightAttenuation = dot(-lightDir, vertexNormal) * 0.5 + 0.5;
|
||||
|
||||
if(useAdvancedShader == 0)
|
||||
{
|
||||
gl_FragData[0] = getDiffuseColor();
|
||||
}
|
||||
else
|
||||
{
|
||||
gl_FragData[0] = vec4(vertexColor * lightAttenuation, 1.);
|
||||
}
|
||||
}
|
@ -0,0 +1,27 @@
|
||||
#version 120
|
||||
#include "openmw_vertex.h.glsl"
|
||||
|
||||
uniform vec3 color;
|
||||
uniform vec3 trans;
|
||||
uniform vec3 scale;
|
||||
uniform int useNormalAsColor;
|
||||
uniform int useAdvancedShader = 0;
|
||||
|
||||
varying vec3 vertexColor;
|
||||
varying vec3 vertexNormal;
|
||||
|
||||
void main()
|
||||
{
|
||||
gl_Position = mw_modelToClip( vec4(gl_Vertex.xyz * scale + trans,1));
|
||||
|
||||
if(useAdvancedShader == 0)
|
||||
{
|
||||
vertexNormal = vec3(1., 1., 1.);
|
||||
vertexColor = gl_Color.xyz;
|
||||
}
|
||||
else
|
||||
{
|
||||
vertexNormal = useNormalAsColor == 1 ? vec3(1., 1., 1.) : gl_Normal.xyz;
|
||||
vertexColor = useNormalAsColor == 1 ? gl_Normal.xyz : color.xyz;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue