Skip to content

Commit

Permalink
don't allocate point and spot light uniforms
Browse files Browse the repository at this point in the history
  • Loading branch information
NeusFear committed Feb 28, 2021
1 parent 146b84a commit 8974459
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 20 deletions.
19 changes: 0 additions & 19 deletions src/main/resources/assets/modelviewer/shaders/default.frag
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@

#include "terminalvelocitycabbage:materials.frag";
#include "terminalvelocitycabbage:lights_base.frag";
#include "terminalvelocitycabbage:point_lights.frag";
#include "terminalvelocitycabbage:spot_lights.frag";
#include "terminalvelocitycabbage:directional_lights.frag";

in vec2 vertTextureCoord;
Expand All @@ -12,13 +10,6 @@ in vec3 vertVertexPosition;

out vec4 fragColor;

const int MAX_POINT_LIGHTS = 256;
const int MAX_SPOT_LIGHTS = 256;

uniform int pointLightsNum;
uniform PointLight pointLights[MAX_POINT_LIGHTS];
uniform int spotLightsNum;
uniform SpotLight spotLights[MAX_SPOT_LIGHTS];
uniform DirectionalLight directionalLight;

void main() {
Expand All @@ -27,16 +18,6 @@ void main() {
//the color of the fragment multiplied by the ambient light
vec4 color = materialAmbientColor * vec4(ambientLight, 1);
color += calcDirectionalLight(directionalLight, vertVertexPosition, vertVertexNormal);
for (int i = 0; i < pointLightsNum; i++) {
if (pointLights[i].intensity > 0) {
color += calcPointLight(pointLights[i], vertVertexPosition, vertVertexNormal);
}
}
for (int i = 0; i < spotLightsNum; i++) {
if (spotLights[i].intensity > 0) {
color += calcSpotLight(spotLights[i], vertVertexPosition, vertVertexNormal);
}
}
if (color.a == 0) {
discard;
} else {
Expand Down

0 comments on commit 8974459

Please sign in to comment.