lower arrays sizes in shaders
This commit is contained in:
parent
449a49102b
commit
7097be100e
@ -9,8 +9,8 @@ uniform vec3 cameraPos;
|
||||
|
||||
uniform vec3 color;
|
||||
|
||||
uniform vec3 lightPositions[100];
|
||||
uniform vec3 lightColors[100];
|
||||
uniform vec3 lightPositions[8];
|
||||
uniform vec3 lightColors[8];
|
||||
|
||||
uniform vec3 spotlightPos;
|
||||
uniform vec3 spotlightColor;
|
||||
@ -29,7 +29,7 @@ out vec4 outColor;
|
||||
|
||||
|
||||
in vec3 viewDirTS;
|
||||
in vec3 lightDirTS[4];
|
||||
in vec3 lightDirTS[8];
|
||||
in vec3 spotlightDirTS;
|
||||
in vec3 sunDirTS;
|
||||
|
||||
@ -99,11 +99,11 @@ void main()
|
||||
|
||||
vec3 viewDir = normalize(cameraPos-worldPos);
|
||||
|
||||
vec3 lightDirs[4];
|
||||
vec3 lightDirs[8];
|
||||
vec3 ambient = AMBIENT * color;
|
||||
vec3 ilumination = ambient;
|
||||
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
lightDirs[i] = normalize(lightPositions[i] - worldPos);
|
||||
vec3 attenuatedlightColor = lightColors[i] / pow(length(lightPositions[i] - worldPos), 2);
|
||||
ilumination = ilumination+PBRLight(lightDirs[i], attenuatedlightColor * 300, normal, viewDir);
|
||||
|
@ -12,12 +12,12 @@ uniform mat4 modelMatrix;
|
||||
out vec3 vecNormal;
|
||||
out vec3 worldPos;
|
||||
|
||||
uniform vec3 lightsPositions[100];
|
||||
uniform vec3 lightsPositions[8];
|
||||
uniform vec3 spotlightPos;
|
||||
uniform vec3 cameraPos;
|
||||
|
||||
out vec3 viewDirTS;
|
||||
out vec3 lightDirTS[100];
|
||||
out vec3 lightDirTS[8];
|
||||
out vec3 spotlightDirTS;
|
||||
|
||||
void main()
|
||||
@ -33,7 +33,7 @@ void main()
|
||||
vec3 V = normalize(cameraPos-worldPos);
|
||||
viewDirTS = TBN*V;
|
||||
|
||||
for (int i = 0; i < 100; ++i) {
|
||||
for (int i = 0; i < 8; ++i) {
|
||||
vec3 L = normalize(lightsPositions[i]-worldPos);
|
||||
lightDirTS[i] = TBN*L;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user