mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Enabled wireframes for shader renderer
This commit is contained in:
@@ -67,6 +67,17 @@ class IMICFPS
|
|||||||
glEnableVertexAttribArray(4)
|
glEnableVertexAttribArray(4)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if window.config.get(:debug_options, :wireframe)
|
||||||
|
glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
|
||||||
|
Shader.active_shader.uniform_boolean("disableLighting", true)
|
||||||
|
|
||||||
|
glDrawArrays(GL_TRIANGLES, 0, model.faces.count * 3)
|
||||||
|
window.number_of_vertices += model.faces.count * 3
|
||||||
|
|
||||||
|
Shader.active_shader.uniform_boolean("disableLighting", false)
|
||||||
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL)
|
||||||
|
end
|
||||||
|
|
||||||
glDrawArrays(GL_TRIANGLES, 0, model.faces.count * 3)
|
glDrawArrays(GL_TRIANGLES, 0, model.faces.count * 3)
|
||||||
window.number_of_vertices += model.faces.count * 3
|
window.number_of_vertices += model.faces.count * 3
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ in float outTotalLights;
|
|||||||
in vec3 outFragPos;
|
in vec3 outFragPos;
|
||||||
in vec3 outCameraPos;
|
in vec3 outCameraPos;
|
||||||
in vec3 outInverseNormal;
|
in vec3 outInverseNormal;
|
||||||
|
in float outDisableLighting;
|
||||||
|
|
||||||
// optimizing compilers are annoying at this stage of my understanding of GLSL
|
// optimizing compilers are annoying at this stage of my understanding of GLSL
|
||||||
vec4 lokiVar;
|
vec4 lokiVar;
|
||||||
@@ -76,7 +77,12 @@ void main() {
|
|||||||
lokiVar = vec4(outColor, 1.0) + outNormal + vec4(outUV, 1.0) + vec4(outTextureID, 1.0, 1.0, 1.0);
|
lokiVar = vec4(outColor, 1.0) + outNormal + vec4(outUV, 1.0) + vec4(outTextureID, 1.0, 1.0, 1.0);
|
||||||
lokiVar = normalize(lokiVar);
|
lokiVar = normalize(lokiVar);
|
||||||
|
|
||||||
vec3 result = calculateLighting() * outColor;
|
vec3 result;
|
||||||
|
if (outDisableLighting == 1.0) {
|
||||||
|
result = outColor + 0.25;
|
||||||
|
} else {
|
||||||
|
result = calculateLighting() * outColor;
|
||||||
|
}
|
||||||
|
|
||||||
gl_FragColor = vec4(result, 1.0);
|
gl_FragColor = vec4(result, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ out vec3 outFragPos;
|
|||||||
out vec3 outViewPos;
|
out vec3 outViewPos;
|
||||||
out vec3 outCameraPos;
|
out vec3 outCameraPos;
|
||||||
out vec3 outInverseNormal;
|
out vec3 outInverseNormal;
|
||||||
|
out float outDisableLighting;
|
||||||
|
|
||||||
uniform mat4 projection;
|
uniform mat4 projection;
|
||||||
uniform mat4 view;
|
uniform mat4 view;
|
||||||
@@ -28,6 +29,7 @@ uniform int hasTexture;
|
|||||||
uniform float totalLights;
|
uniform float totalLights;
|
||||||
uniform Light lights[MAX_LIGHTS];
|
uniform Light lights[MAX_LIGHTS];
|
||||||
uniform vec3 cameraPos;
|
uniform vec3 cameraPos;
|
||||||
|
uniform int disableLighting;
|
||||||
|
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
@@ -41,6 +43,7 @@ void main() {
|
|||||||
outLights = lights;
|
outLights = lights;
|
||||||
outTotalLights = totalLights;
|
outTotalLights = totalLights;
|
||||||
outCameraPos = cameraPos;
|
outCameraPos = cameraPos;
|
||||||
|
outDisableLighting = disableLighting;
|
||||||
outInverseNormal = mat3(transpose(inverse(model))) * vec3(inNormal);
|
outInverseNormal = mat3(transpose(inverse(model))) * vec3(inNormal);
|
||||||
|
|
||||||
outFragPos = vec3(model * vec4(inPosition, 1.0));
|
outFragPos = vec3(model * vec4(inPosition, 1.0));
|
||||||
|
|||||||
Reference in New Issue
Block a user