mirror of
https://github.com/cyberarm/i-mic-fps.git
synced 2025-12-15 15:42:35 +00:00
Fixed NVIDIA renderering errors, use 'flat in/out int integerValue' instead of 'in/out float integerValue'
This commit is contained in:
@@ -25,7 +25,7 @@ class IMICFPS
|
|||||||
shader.uniform_vec3("lights[#{i}].specular", light.specular)
|
shader.uniform_vec3("lights[#{i}].specular", light.specular)
|
||||||
end
|
end
|
||||||
|
|
||||||
shader.uniform_float("totalLights", lights.size)
|
shader.uniform_integer("totalLights", lights.size)
|
||||||
|
|
||||||
entities.each do |entity|
|
entities.each do |entity|
|
||||||
next unless entity.visible && entity.renderable
|
next unless entity.visible && entity.renderable
|
||||||
|
|||||||
@@ -2,17 +2,19 @@
|
|||||||
|
|
||||||
@include "light_struct"
|
@include "light_struct"
|
||||||
|
|
||||||
|
layout(location = 0) out vec4 fragColor;
|
||||||
|
|
||||||
in vec3 outPosition;
|
in vec3 outPosition;
|
||||||
in vec3 outColor;
|
in vec3 outColor;
|
||||||
in vec3 outNormal;
|
in vec3 outNormal;
|
||||||
in vec3 outUV;
|
in vec3 outUV;
|
||||||
in float outTextureID;
|
in float outTextureID;
|
||||||
in float outHasTexture;
|
|
||||||
in Light outLights[MAX_LIGHTS];
|
in Light outLights[MAX_LIGHTS];
|
||||||
in float outTotalLights;
|
flat in int outTotalLights;
|
||||||
in vec3 outFragPos;
|
in vec3 outFragPos;
|
||||||
in vec3 outCameraPos;
|
in vec3 outCameraPos;
|
||||||
in float outDisableLighting;
|
flat in int outHasTexture;
|
||||||
|
flat in int outDisableLighting;
|
||||||
|
|
||||||
uniform sampler2D diffuse_texture;
|
uniform sampler2D diffuse_texture;
|
||||||
|
|
||||||
@@ -64,7 +66,7 @@ vec3 calculateBasicLight(Light light) {
|
|||||||
vec3 calculateLighting() {
|
vec3 calculateLighting() {
|
||||||
vec3 result = vec3(0.0, 0.0, 0.0);
|
vec3 result = vec3(0.0, 0.0, 0.0);
|
||||||
|
|
||||||
for (int i = 0; i < min(int(outTotalLights), MAX_LIGHTS); i++) {
|
for (int i = 0; i < min(outTotalLights, MAX_LIGHTS); i++) {
|
||||||
if (int(outLights[i].type) == 0) {
|
if (int(outLights[i].type) == 0) {
|
||||||
result += calculateBasicLight(outLights[i]);
|
result += calculateBasicLight(outLights[i]);
|
||||||
} else if (int(outLights[i].type) == 1) {
|
} else if (int(outLights[i].type) == 1) {
|
||||||
@@ -96,5 +98,5 @@ void main() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
gl_FragColor = vec4(result, 1.0);
|
fragColor = vec4(result, 1.0);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,19 +13,19 @@ out vec3 outColor;
|
|||||||
out vec3 outNormal;
|
out vec3 outNormal;
|
||||||
out vec3 outUV;
|
out vec3 outUV;
|
||||||
out float outTextureID;
|
out float outTextureID;
|
||||||
out float outHasTexture;
|
|
||||||
out Light outLights[MAX_LIGHTS];
|
out Light outLights[MAX_LIGHTS];
|
||||||
out float outTotalLights;
|
flat out int outTotalLights;
|
||||||
out vec3 outFragPos;
|
out vec3 outFragPos;
|
||||||
out vec3 outViewPos;
|
out vec3 outViewPos;
|
||||||
out vec3 outCameraPos;
|
out vec3 outCameraPos;
|
||||||
out float outDisableLighting;
|
flat out int outHasTexture;
|
||||||
|
flat out int outDisableLighting;
|
||||||
|
|
||||||
uniform mat4 projection;
|
uniform mat4 projection;
|
||||||
uniform mat4 view;
|
uniform mat4 view;
|
||||||
uniform mat4 model;
|
uniform mat4 model;
|
||||||
uniform int hasTexture;
|
uniform int hasTexture;
|
||||||
uniform float totalLights;
|
uniform int totalLights;
|
||||||
uniform Light lights[MAX_LIGHTS];
|
uniform Light lights[MAX_LIGHTS];
|
||||||
uniform vec3 cameraPos;
|
uniform vec3 cameraPos;
|
||||||
uniform int disableLighting;
|
uniform int disableLighting;
|
||||||
|
|||||||
Reference in New Issue
Block a user