@luma.gl/shadertools 9.1.0-alpha.16 → 9.1.0-alpha.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/dist.dev.js +277 -344
- package/dist/dist.min.js +215 -314
- package/dist/index.cjs +276 -346
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -1
- package/dist/lib/shader-module/shader-module.d.ts +24 -14
- package/dist/lib/shader-module/shader-module.d.ts.map +1 -1
- package/dist/lib/shader-module/shader-module.js +11 -15
- package/dist/lib/shader-module/shader-pass.d.ts +4 -2
- package/dist/lib/shader-module/shader-pass.d.ts.map +1 -1
- package/dist/lib/utils/uniform-types.d.ts +11 -0
- package/dist/lib/utils/uniform-types.d.ts.map +1 -0
- package/dist/lib/utils/uniform-types.js +1 -0
- package/dist/modules/engine/picking/picking.d.ts +7 -7
- package/dist/modules/engine/picking/picking.d.ts.map +1 -1
- package/dist/modules/engine/picking/picking.js +2 -2
- package/dist/modules/engine/project/project.d.ts +9 -8
- package/dist/modules/engine/project/project.d.ts.map +1 -1
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +3 -57
- package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -1
- package/dist/modules/lighting/gouraud-material/gouraud-material.js +9 -6
- package/dist/modules/lighting/lights/lighting-uniforms-glsl.d.ts +1 -1
- package/dist/modules/lighting/lights/lighting-uniforms-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/lights/lighting-uniforms-glsl.js +35 -12
- package/dist/modules/lighting/lights/lighting.d.ts +55 -29
- package/dist/modules/lighting/lights/lighting.d.ts.map +1 -1
- package/dist/modules/lighting/lights/lighting.js +46 -35
- package/dist/modules/lighting/no-material/dirlight.d.ts +3 -3
- package/dist/modules/lighting/no-material/dirlight.d.ts.map +1 -1
- package/dist/modules/lighting/no-material/dirlight.js +1 -1
- package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.d.ts +1 -1
- package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.js +56 -60
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts +56 -98
- package/dist/modules/lighting/pbr-material/pbr-material.d.ts.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-material.js +14 -22
- package/dist/modules/lighting/pbr-material/pbr-projection.d.ts +10 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.d.ts.map +1 -0
- package/dist/modules/lighting/pbr-material/pbr-projection.js +24 -0
- package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.d.ts +1 -1
- package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.js +8 -16
- package/dist/modules/lighting/phong-material/phong-material.d.ts +5 -59
- package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -1
- package/dist/modules/lighting/phong-material/phong-material.js +6 -4
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +1 -40
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -1
- package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +8 -87
- package/dist/modules-webgl1/project/project.d.ts +6 -4
- package/dist/modules-webgl1/project/project.d.ts.map +1 -1
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts +1 -1
- package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
- package/dist/passes/postprocessing/fxaa/fxaa.js +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +0 -1
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +0 -1
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +0 -1
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +0 -1
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +3 -0
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +3 -0
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +2 -2
- package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +1 -1
- package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +1 -1
- package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +1 -1
- package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +1 -1
- package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +15 -11
- package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/edgework.js +24 -12
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +1 -1
- package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +2 -2
- package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +1 -1
- package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +9 -3
- package/src/lib/shader-module/shader-module.ts +31 -20
- package/src/lib/shader-module/shader-pass.ts +7 -4
- package/src/lib/utils/uniform-types.ts +66 -0
- package/src/modules/engine/picking/picking.ts +9 -9
- package/src/modules/engine/project/project.ts +10 -9
- package/src/modules/lighting/gouraud-material/gouraud-material.ts +14 -12
- package/src/modules/lighting/lights/lighting-uniforms-glsl.ts +35 -12
- package/src/modules/lighting/lights/lighting.ts +83 -54
- package/src/modules/lighting/no-material/dirlight.ts +3 -3
- package/src/modules/lighting/pbr-material/pbr-fragment-glsl.ts +56 -60
- package/src/modules/lighting/pbr-material/pbr-material.ts +40 -74
- package/src/modules/lighting/pbr-material/pbr-projection.ts +39 -0
- package/src/modules/lighting/pbr-material/pbr-vertex-glsl.ts +8 -16
- package/src/modules/lighting/phong-material/phong-material.ts +12 -12
- package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +8 -88
- package/src/modules-webgl1/project/project.ts +8 -7
- package/src/passes/postprocessing/fxaa/fxaa.ts +2 -2
- package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +0 -1
- package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +0 -1
- package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +3 -0
- package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +2 -2
- package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +1 -1
- package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +1 -1
- package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +1 -1
- package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +1 -1
- package/src/passes/postprocessing/image-fun-filters/edgework.ts +26 -15
- package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +1 -1
- package/src/passes/postprocessing/image-fun-filters/magnify.ts +2 -2
- package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +1 -1
- package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts +0 -42
- package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts.map +0 -1
- package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.js +0 -134
- package/src/modules/lighting/gouraud-material/gouraud-shaders-glsl.ts +0 -137
|
@@ -1,134 +0,0 @@
|
|
|
1
|
-
// luma.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
export const GOURAUD_VS = /* glsl */ `\
|
|
5
|
-
uniform materialUniforms {
|
|
6
|
-
uniform float ambient;
|
|
7
|
-
uniform float diffuse;
|
|
8
|
-
uniform float shininess;
|
|
9
|
-
uniform vec3 specularColor;
|
|
10
|
-
} material;
|
|
11
|
-
`;
|
|
12
|
-
export const GOURAUD_FS = /* glsl */ `\
|
|
13
|
-
uniform materialUniforms {
|
|
14
|
-
uniform float ambient;
|
|
15
|
-
uniform float diffuse;
|
|
16
|
-
uniform float shininess;
|
|
17
|
-
uniform vec3 specularColor;
|
|
18
|
-
} material;
|
|
19
|
-
|
|
20
|
-
vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {
|
|
21
|
-
vec3 halfway_direction = normalize(light_direction + view_direction);
|
|
22
|
-
float lambertian = dot(light_direction, normal_worldspace);
|
|
23
|
-
float specular = 0.0;
|
|
24
|
-
if (lambertian > 0.0) {
|
|
25
|
-
float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
|
|
26
|
-
specular = pow(specular_angle, material.shininess);
|
|
27
|
-
}
|
|
28
|
-
lambertian = max(lambertian, 0.0);
|
|
29
|
-
return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
|
|
33
|
-
vec3 lightColor = surfaceColor;
|
|
34
|
-
|
|
35
|
-
if (lighting.enabled) {
|
|
36
|
-
vec3 view_direction = normalize(cameraPosition - position_worldspace);
|
|
37
|
-
lightColor = material.ambient * surfaceColor * lighting.ambientColor;
|
|
38
|
-
|
|
39
|
-
if (lighting.lightType == 0) {
|
|
40
|
-
PointLight pointLight = lighting_getPointLight(0);
|
|
41
|
-
vec3 light_position_worldspace = pointLight.position;
|
|
42
|
-
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
43
|
-
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
44
|
-
} else if (lighting.lightType == 1) {
|
|
45
|
-
DirectionalLight directionalLight = lighting_getDirectionalLight(0);
|
|
46
|
-
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
47
|
-
}
|
|
48
|
-
/*
|
|
49
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
50
|
-
if (i >= lighting.pointLightCount) {
|
|
51
|
-
break;
|
|
52
|
-
}
|
|
53
|
-
PointLight pointLight = lighting.pointLight[i];
|
|
54
|
-
vec3 light_position_worldspace = pointLight.position;
|
|
55
|
-
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
56
|
-
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
60
|
-
if (i >= lighting.directionalLightCount) {
|
|
61
|
-
break;
|
|
62
|
-
}
|
|
63
|
-
DirectionalLight directionalLight = lighting.directionalLight[i];
|
|
64
|
-
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
65
|
-
}
|
|
66
|
-
*/
|
|
67
|
-
}
|
|
68
|
-
return lightColor;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
|
|
72
|
-
vec3 lightColor = vec3(0, 0, 0);
|
|
73
|
-
vec3 surfaceColor = vec3(0, 0, 0);
|
|
74
|
-
|
|
75
|
-
if (lighting.enabled) {
|
|
76
|
-
vec3 view_direction = normalize(cameraPosition - position_worldspace);
|
|
77
|
-
|
|
78
|
-
switch (lighting.lightType) {
|
|
79
|
-
case 0:
|
|
80
|
-
PointLight pointLight = lighting_getPointLight(0);
|
|
81
|
-
vec3 light_position_worldspace = pointLight.position;
|
|
82
|
-
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
83
|
-
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
84
|
-
break;
|
|
85
|
-
|
|
86
|
-
case 1:
|
|
87
|
-
DirectionalLight directionalLight = lighting_getDirectionalLight(0);
|
|
88
|
-
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
89
|
-
break;
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
return lightColor;
|
|
93
|
-
}
|
|
94
|
-
`;
|
|
95
|
-
// TODO - handle multiple lights
|
|
96
|
-
/**
|
|
97
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
98
|
-
if (i >= lighting.pointLightCount) {
|
|
99
|
-
break;
|
|
100
|
-
}
|
|
101
|
-
PointLight pointLight = lighting_getPointLight(i);
|
|
102
|
-
vec3 light_position_worldspace = pointLight.position;
|
|
103
|
-
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
104
|
-
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
108
|
-
if (i >= lighting.directionalLightCount) {
|
|
109
|
-
break;
|
|
110
|
-
}
|
|
111
|
-
PointLight pointLight = lighting_getDirectionalLight(i);
|
|
112
|
-
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
117
|
-
if (i >= lighting.pointLightCount) {
|
|
118
|
-
break;
|
|
119
|
-
}
|
|
120
|
-
PointLight pointLight = lighting_getPointLight(i);
|
|
121
|
-
vec3 light_position_worldspace = pointLight.position;
|
|
122
|
-
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
123
|
-
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
127
|
-
if (i >= lighting.directionalLightCount) {
|
|
128
|
-
break;
|
|
129
|
-
}
|
|
130
|
-
PointLight pointLight = lighting_getDirectionalLight(i);
|
|
131
|
-
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
*/
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
// luma.gl
|
|
2
|
-
// SPDX-License-Identifier: MIT
|
|
3
|
-
// Copyright (c) vis.gl contributors
|
|
4
|
-
|
|
5
|
-
export const GOURAUD_VS = /* glsl */ `\
|
|
6
|
-
uniform materialUniforms {
|
|
7
|
-
uniform float ambient;
|
|
8
|
-
uniform float diffuse;
|
|
9
|
-
uniform float shininess;
|
|
10
|
-
uniform vec3 specularColor;
|
|
11
|
-
} material;
|
|
12
|
-
`;
|
|
13
|
-
|
|
14
|
-
export const GOURAUD_FS = /* glsl */ `\
|
|
15
|
-
uniform materialUniforms {
|
|
16
|
-
uniform float ambient;
|
|
17
|
-
uniform float diffuse;
|
|
18
|
-
uniform float shininess;
|
|
19
|
-
uniform vec3 specularColor;
|
|
20
|
-
} material;
|
|
21
|
-
|
|
22
|
-
vec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {
|
|
23
|
-
vec3 halfway_direction = normalize(light_direction + view_direction);
|
|
24
|
-
float lambertian = dot(light_direction, normal_worldspace);
|
|
25
|
-
float specular = 0.0;
|
|
26
|
-
if (lambertian > 0.0) {
|
|
27
|
-
float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);
|
|
28
|
-
specular = pow(specular_angle, material.shininess);
|
|
29
|
-
}
|
|
30
|
-
lambertian = max(lambertian, 0.0);
|
|
31
|
-
return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
|
|
35
|
-
vec3 lightColor = surfaceColor;
|
|
36
|
-
|
|
37
|
-
if (lighting.enabled) {
|
|
38
|
-
vec3 view_direction = normalize(cameraPosition - position_worldspace);
|
|
39
|
-
lightColor = material.ambient * surfaceColor * lighting.ambientColor;
|
|
40
|
-
|
|
41
|
-
if (lighting.lightType == 0) {
|
|
42
|
-
PointLight pointLight = lighting_getPointLight(0);
|
|
43
|
-
vec3 light_position_worldspace = pointLight.position;
|
|
44
|
-
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
45
|
-
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
46
|
-
} else if (lighting.lightType == 1) {
|
|
47
|
-
DirectionalLight directionalLight = lighting_getDirectionalLight(0);
|
|
48
|
-
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
49
|
-
}
|
|
50
|
-
/*
|
|
51
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
52
|
-
if (i >= lighting.pointLightCount) {
|
|
53
|
-
break;
|
|
54
|
-
}
|
|
55
|
-
PointLight pointLight = lighting.pointLight[i];
|
|
56
|
-
vec3 light_position_worldspace = pointLight.position;
|
|
57
|
-
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
58
|
-
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
62
|
-
if (i >= lighting.directionalLightCount) {
|
|
63
|
-
break;
|
|
64
|
-
}
|
|
65
|
-
DirectionalLight directionalLight = lighting.directionalLight[i];
|
|
66
|
-
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
67
|
-
}
|
|
68
|
-
*/
|
|
69
|
-
}
|
|
70
|
-
return lightColor;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
|
|
74
|
-
vec3 lightColor = vec3(0, 0, 0);
|
|
75
|
-
vec3 surfaceColor = vec3(0, 0, 0);
|
|
76
|
-
|
|
77
|
-
if (lighting.enabled) {
|
|
78
|
-
vec3 view_direction = normalize(cameraPosition - position_worldspace);
|
|
79
|
-
|
|
80
|
-
switch (lighting.lightType) {
|
|
81
|
-
case 0:
|
|
82
|
-
PointLight pointLight = lighting_getPointLight(0);
|
|
83
|
-
vec3 light_position_worldspace = pointLight.position;
|
|
84
|
-
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
85
|
-
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
86
|
-
break;
|
|
87
|
-
|
|
88
|
-
case 1:
|
|
89
|
-
DirectionalLight directionalLight = lighting_getDirectionalLight(0);
|
|
90
|
-
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
return lightColor;
|
|
95
|
-
}
|
|
96
|
-
`;
|
|
97
|
-
|
|
98
|
-
// TODO - handle multiple lights
|
|
99
|
-
/**
|
|
100
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
101
|
-
if (i >= lighting.pointLightCount) {
|
|
102
|
-
break;
|
|
103
|
-
}
|
|
104
|
-
PointLight pointLight = lighting_getPointLight(i);
|
|
105
|
-
vec3 light_position_worldspace = pointLight.position;
|
|
106
|
-
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
107
|
-
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
111
|
-
if (i >= lighting.directionalLightCount) {
|
|
112
|
-
break;
|
|
113
|
-
}
|
|
114
|
-
PointLight pointLight = lighting_getDirectionalLight(i);
|
|
115
|
-
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
120
|
-
if (i >= lighting.pointLightCount) {
|
|
121
|
-
break;
|
|
122
|
-
}
|
|
123
|
-
PointLight pointLight = lighting_getPointLight(i);
|
|
124
|
-
vec3 light_position_worldspace = pointLight.position;
|
|
125
|
-
vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
|
|
126
|
-
lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
for (int i = 0; i < MAX_LIGHTS; i++) {
|
|
130
|
-
if (i >= lighting.directionalLightCount) {
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
PointLight pointLight = lighting_getDirectionalLight(i);
|
|
134
|
-
lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
*/
|