@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.
Files changed (118) hide show
  1. package/dist/dist.dev.js +277 -344
  2. package/dist/dist.min.js +215 -314
  3. package/dist/index.cjs +276 -346
  4. package/dist/index.cjs.map +4 -4
  5. package/dist/index.d.ts +4 -2
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +0 -1
  8. package/dist/lib/shader-module/shader-module.d.ts +24 -14
  9. package/dist/lib/shader-module/shader-module.d.ts.map +1 -1
  10. package/dist/lib/shader-module/shader-module.js +11 -15
  11. package/dist/lib/shader-module/shader-pass.d.ts +4 -2
  12. package/dist/lib/shader-module/shader-pass.d.ts.map +1 -1
  13. package/dist/lib/utils/uniform-types.d.ts +11 -0
  14. package/dist/lib/utils/uniform-types.d.ts.map +1 -0
  15. package/dist/lib/utils/uniform-types.js +1 -0
  16. package/dist/modules/engine/picking/picking.d.ts +7 -7
  17. package/dist/modules/engine/picking/picking.d.ts.map +1 -1
  18. package/dist/modules/engine/picking/picking.js +2 -2
  19. package/dist/modules/engine/project/project.d.ts +9 -8
  20. package/dist/modules/engine/project/project.d.ts.map +1 -1
  21. package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts +3 -57
  22. package/dist/modules/lighting/gouraud-material/gouraud-material.d.ts.map +1 -1
  23. package/dist/modules/lighting/gouraud-material/gouraud-material.js +9 -6
  24. package/dist/modules/lighting/lights/lighting-uniforms-glsl.d.ts +1 -1
  25. package/dist/modules/lighting/lights/lighting-uniforms-glsl.d.ts.map +1 -1
  26. package/dist/modules/lighting/lights/lighting-uniforms-glsl.js +35 -12
  27. package/dist/modules/lighting/lights/lighting.d.ts +55 -29
  28. package/dist/modules/lighting/lights/lighting.d.ts.map +1 -1
  29. package/dist/modules/lighting/lights/lighting.js +46 -35
  30. package/dist/modules/lighting/no-material/dirlight.d.ts +3 -3
  31. package/dist/modules/lighting/no-material/dirlight.d.ts.map +1 -1
  32. package/dist/modules/lighting/no-material/dirlight.js +1 -1
  33. package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.d.ts +1 -1
  34. package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.d.ts.map +1 -1
  35. package/dist/modules/lighting/pbr-material/pbr-fragment-glsl.js +56 -60
  36. package/dist/modules/lighting/pbr-material/pbr-material.d.ts +56 -98
  37. package/dist/modules/lighting/pbr-material/pbr-material.d.ts.map +1 -1
  38. package/dist/modules/lighting/pbr-material/pbr-material.js +14 -22
  39. package/dist/modules/lighting/pbr-material/pbr-projection.d.ts +10 -0
  40. package/dist/modules/lighting/pbr-material/pbr-projection.d.ts.map +1 -0
  41. package/dist/modules/lighting/pbr-material/pbr-projection.js +24 -0
  42. package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.d.ts +1 -1
  43. package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.d.ts.map +1 -1
  44. package/dist/modules/lighting/pbr-material/pbr-vertex-glsl.js +8 -16
  45. package/dist/modules/lighting/phong-material/phong-material.d.ts +5 -59
  46. package/dist/modules/lighting/phong-material/phong-material.d.ts.map +1 -1
  47. package/dist/modules/lighting/phong-material/phong-material.js +6 -4
  48. package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts +1 -40
  49. package/dist/modules/lighting/phong-material/phong-shaders-glsl.d.ts.map +1 -1
  50. package/dist/modules/lighting/phong-material/phong-shaders-glsl.js +8 -87
  51. package/dist/modules-webgl1/project/project.d.ts +6 -4
  52. package/dist/modules-webgl1/project/project.d.ts.map +1 -1
  53. package/dist/passes/postprocessing/fxaa/fxaa.d.ts +1 -1
  54. package/dist/passes/postprocessing/fxaa/fxaa.d.ts.map +1 -1
  55. package/dist/passes/postprocessing/fxaa/fxaa.js +1 -1
  56. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts +0 -1
  57. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.d.ts.map +1 -1
  58. package/dist/passes/postprocessing/image-adjust-filters/brightnesscontrast.js +0 -1
  59. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts +0 -1
  60. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.d.ts.map +1 -1
  61. package/dist/passes/postprocessing/image-adjust-filters/huesaturation.js +0 -1
  62. package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts +3 -0
  63. package/dist/passes/postprocessing/image-adjust-filters/vibrance.d.ts.map +1 -1
  64. package/dist/passes/postprocessing/image-adjust-filters/vibrance.js +3 -0
  65. package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts +2 -2
  66. package/dist/passes/postprocessing/image-blur-filters/tiltshift.d.ts.map +1 -1
  67. package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts +1 -1
  68. package/dist/passes/postprocessing/image-blur-filters/triangleblur.d.ts.map +1 -1
  69. package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts +1 -1
  70. package/dist/passes/postprocessing/image-blur-filters/zoomblur.d.ts.map +1 -1
  71. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts +1 -1
  72. package/dist/passes/postprocessing/image-fun-filters/colorhalftone.d.ts.map +1 -1
  73. package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts +1 -1
  74. package/dist/passes/postprocessing/image-fun-filters/dotscreen.d.ts.map +1 -1
  75. package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts +15 -11
  76. package/dist/passes/postprocessing/image-fun-filters/edgework.d.ts.map +1 -1
  77. package/dist/passes/postprocessing/image-fun-filters/edgework.js +24 -12
  78. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts +1 -1
  79. package/dist/passes/postprocessing/image-fun-filters/hexagonalpixelate.d.ts.map +1 -1
  80. package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts +2 -2
  81. package/dist/passes/postprocessing/image-fun-filters/magnify.d.ts.map +1 -1
  82. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts +1 -1
  83. package/dist/passes/postprocessing/image-warp-filters/bulgepinch.d.ts.map +1 -1
  84. package/package.json +3 -3
  85. package/src/index.ts +9 -3
  86. package/src/lib/shader-module/shader-module.ts +31 -20
  87. package/src/lib/shader-module/shader-pass.ts +7 -4
  88. package/src/lib/utils/uniform-types.ts +66 -0
  89. package/src/modules/engine/picking/picking.ts +9 -9
  90. package/src/modules/engine/project/project.ts +10 -9
  91. package/src/modules/lighting/gouraud-material/gouraud-material.ts +14 -12
  92. package/src/modules/lighting/lights/lighting-uniforms-glsl.ts +35 -12
  93. package/src/modules/lighting/lights/lighting.ts +83 -54
  94. package/src/modules/lighting/no-material/dirlight.ts +3 -3
  95. package/src/modules/lighting/pbr-material/pbr-fragment-glsl.ts +56 -60
  96. package/src/modules/lighting/pbr-material/pbr-material.ts +40 -74
  97. package/src/modules/lighting/pbr-material/pbr-projection.ts +39 -0
  98. package/src/modules/lighting/pbr-material/pbr-vertex-glsl.ts +8 -16
  99. package/src/modules/lighting/phong-material/phong-material.ts +12 -12
  100. package/src/modules/lighting/phong-material/phong-shaders-glsl.ts +8 -88
  101. package/src/modules-webgl1/project/project.ts +8 -7
  102. package/src/passes/postprocessing/fxaa/fxaa.ts +2 -2
  103. package/src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts +0 -1
  104. package/src/passes/postprocessing/image-adjust-filters/huesaturation.ts +0 -1
  105. package/src/passes/postprocessing/image-adjust-filters/vibrance.ts +3 -0
  106. package/src/passes/postprocessing/image-blur-filters/tiltshift.ts +2 -2
  107. package/src/passes/postprocessing/image-blur-filters/triangleblur.ts +1 -1
  108. package/src/passes/postprocessing/image-blur-filters/zoomblur.ts +1 -1
  109. package/src/passes/postprocessing/image-fun-filters/colorhalftone.ts +1 -1
  110. package/src/passes/postprocessing/image-fun-filters/dotscreen.ts +1 -1
  111. package/src/passes/postprocessing/image-fun-filters/edgework.ts +26 -15
  112. package/src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts +1 -1
  113. package/src/passes/postprocessing/image-fun-filters/magnify.ts +2 -2
  114. package/src/passes/postprocessing/image-warp-filters/bulgepinch.ts +1 -1
  115. package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts +0 -42
  116. package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.d.ts.map +0 -1
  117. package/dist/modules/lighting/gouraud-material/gouraud-shaders-glsl.js +0 -134
  118. package/src/modules/lighting/gouraud-material/gouraud-shaders-glsl.ts +0 -137
@@ -1,42 +1,3 @@
1
1
  export declare const PHONG_VS = "uniform phongMaterialUniforms {\n uniform float ambient;\n uniform float diffuse;\n uniform float shininess;\n uniform vec3 specularColor;\n} material;\n";
2
- export declare const PHONG_FS = "uniform phongMaterialUniforms {\n uniform float ambient;\n uniform float diffuse;\n uniform float shininess;\n uniform vec3 specularColor;\n} material;\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\n vec3 halfway_direction = normalize(light_direction + view_direction);\n float lambertian = dot(light_direction, normal_worldspace);\n float specular = 0.0;\n if (lambertian > 0.0) {\n float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\n specular = pow(specular_angle, material.shininess);\n }\n lambertian = max(lambertian, 0.0);\n return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color;\n}\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = surfaceColor;\n\n if (lighting.enabled == 0) {\n return lightColor;\n }\n\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n lightColor = material.ambient * surfaceColor * lighting.ambientColor;\n\n if (lighting.lightType == 0) {\n PointLight pointLight = lighting_getPointLight(0);\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n } else if (lighting.lightType == 1) {\n DirectionalLight directionalLight = lighting_getDirectionalLight(0);\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n \n /*\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting.pointLightCount) {\n break;\n }\n PointLight pointLight = lighting.pointLight[i];\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n }\n\n for (int i = 0; i < MAX_LIGHTS; i++) {\n if (i >= lighting.directionalLightCount) {\n break;\n }\n DirectionalLight directionalLight = lighting.directionalLight[i];\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n */\n return lightColor;\n}\n\nvec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = vec3(0, 0, 0);\n vec3 surfaceColor = vec3(0, 0, 0);\n\n if (lighting.enabled == 0) {\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n\n switch (lighting.lightType) {\n case 0:\n PointLight pointLight = lighting_getPointLight(0);\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);\n break;\n\n case 1:\n DirectionalLight directionalLight = lighting_getDirectionalLight(0);\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n break;\n }\n }\n return lightColor;\n}\n";
3
- /**
4
- for (int i = 0; i < MAX_LIGHTS; i++) {
5
- if (i >= lighting.pointLightCount) {
6
- break;
7
- }
8
- PointLight pointLight = lighting_getPointLight(i);
9
- vec3 light_position_worldspace = pointLight.position;
10
- vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
11
- lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
12
- }
13
-
14
- for (int i = 0; i < MAX_LIGHTS; i++) {
15
- if (i >= lighting.directionalLightCount) {
16
- break;
17
- }
18
- PointLight pointLight = lighting_getDirectionalLight(i);
19
- lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
20
- }
21
- }
22
- /**
23
- for (int i = 0; i < MAX_LIGHTS; i++) {
24
- if (i >= lighting.pointLightCount) {
25
- break;
26
- }
27
- PointLight pointLight = lighting_getPointLight(i);
28
- vec3 light_position_worldspace = pointLight.position;
29
- vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
30
- lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
31
- }
32
-
33
- for (int i = 0; i < MAX_LIGHTS; i++) {
34
- if (i >= lighting.directionalLightCount) {
35
- break;
36
- }
37
- PointLight pointLight = lighting_getDirectionalLight(i);
38
- lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
39
- }
40
- }
41
- */
2
+ export declare const PHONG_FS = "uniform phongMaterialUniforms {\n uniform float ambient;\n uniform float diffuse;\n uniform float shininess;\n uniform vec3 specularColor;\n} material;\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 light_direction, vec3 view_direction, vec3 normal_worldspace, vec3 color) {\n vec3 halfway_direction = normalize(light_direction + view_direction);\n float lambertian = dot(light_direction, normal_worldspace);\n float specular = 0.0;\n if (lambertian > 0.0) {\n float specular_angle = max(dot(normal_worldspace, halfway_direction), 0.0);\n specular = pow(specular_angle, material.shininess);\n }\n lambertian = max(lambertian, 0.0);\n return (lambertian * material.diffuse * surfaceColor + specular * material.specularColor) * color;\n}\n\nvec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {\n vec3 lightColor = surfaceColor;\n\n if (lighting.enabled == 0) {\n return lightColor;\n }\n\n vec3 view_direction = normalize(cameraPosition - position_worldspace);\n lightColor = material.ambient * surfaceColor * lighting.ambientColor;\n\n for (int i = 0; i < lighting.pointLightCount; i++) {\n PointLight pointLight = lighting_getPointLight(i);\n vec3 light_position_worldspace = pointLight.position;\n vec3 light_direction = normalize(light_position_worldspace - position_worldspace);\n float light_attenuation = getPointLightAttenuation(pointLight, distance(light_position_worldspace, position_worldspace));\n lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color / light_attenuation);\n }\n\n int totalLights = min(MAX_LIGHTS, lighting.pointLightCount + lighting.directionalLightCount);\n for (int i = lighting.pointLightCount; i < totalLights; i++) {\n DirectionalLight directionalLight = lighting_getDirectionalLight(i);\n lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);\n }\n \n return lightColor;\n}\n";
42
3
  //# sourceMappingURL=phong-shaders-glsl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"phong-shaders-glsl.d.ts","sourceRoot":"","sources":["../../../../src/modules/lighting/phong-material/phong-shaders-glsl.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,mKAOpB,CAAC;AAEF,eAAO,MAAM,QAAQ,ogHAqFpB,CAAC;AAGF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAsCI"}
1
+ {"version":3,"file":"phong-shaders-glsl.d.ts","sourceRoot":"","sources":["../../../../src/modules/lighting/phong-material/phong-shaders-glsl.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,QAAQ,mKAOpB,CAAC;AAEF,eAAO,MAAM,QAAQ,gjEA8CpB,CAAC"}
@@ -39,99 +39,20 @@ vec3 lighting_getLightColor(vec3 surfaceColor, vec3 cameraPosition, vec3 positio
39
39
  vec3 view_direction = normalize(cameraPosition - position_worldspace);
40
40
  lightColor = material.ambient * surfaceColor * lighting.ambientColor;
41
41
 
42
- if (lighting.lightType == 0) {
43
- PointLight pointLight = lighting_getPointLight(0);
42
+ for (int i = 0; i < lighting.pointLightCount; i++) {
43
+ PointLight pointLight = lighting_getPointLight(i);
44
44
  vec3 light_position_worldspace = pointLight.position;
45
45
  vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
46
- lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
47
- } else if (lighting.lightType == 1) {
48
- DirectionalLight directionalLight = lighting_getDirectionalLight(0);
49
- lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
50
- }
51
-
52
- /*
53
- for (int i = 0; i < MAX_LIGHTS; i++) {
54
- if (i >= lighting.pointLightCount) {
55
- break;
56
- }
57
- PointLight pointLight = lighting.pointLight[i];
58
- vec3 light_position_worldspace = pointLight.position;
59
- vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
60
- lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
46
+ float light_attenuation = getPointLightAttenuation(pointLight, distance(light_position_worldspace, position_worldspace));
47
+ lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color / light_attenuation);
61
48
  }
62
49
 
63
- for (int i = 0; i < MAX_LIGHTS; i++) {
64
- if (i >= lighting.directionalLightCount) {
65
- break;
66
- }
67
- DirectionalLight directionalLight = lighting.directionalLight[i];
50
+ int totalLights = min(MAX_LIGHTS, lighting.pointLightCount + lighting.directionalLightCount);
51
+ for (int i = lighting.pointLightCount; i < totalLights; i++) {
52
+ DirectionalLight directionalLight = lighting_getDirectionalLight(i);
68
53
  lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
69
54
  }
70
- */
71
- return lightColor;
72
- }
73
-
74
- vec3 lighting_getSpecularLightColor(vec3 cameraPosition, vec3 position_worldspace, vec3 normal_worldspace) {
75
- vec3 lightColor = vec3(0, 0, 0);
76
- vec3 surfaceColor = vec3(0, 0, 0);
77
-
78
- if (lighting.enabled == 0) {
79
- vec3 view_direction = normalize(cameraPosition - position_worldspace);
80
-
81
- switch (lighting.lightType) {
82
- case 0:
83
- PointLight pointLight = lighting_getPointLight(0);
84
- vec3 light_position_worldspace = pointLight.position;
85
- vec3 light_direction = normalize(light_position_worldspace - position_worldspace);
86
- lightColor += lighting_getLightColor(surfaceColor, light_direction, view_direction, normal_worldspace, pointLight.color);
87
- break;
88
-
89
- case 1:
90
- DirectionalLight directionalLight = lighting_getDirectionalLight(0);
91
- lightColor += lighting_getLightColor(surfaceColor, -directionalLight.direction, view_direction, normal_worldspace, directionalLight.color);
92
- break;
93
- }
94
- }
55
+
95
56
  return lightColor;
96
57
  }
97
58
  `;
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
- */
@@ -1,8 +1,10 @@
1
+ import { Vector3, Matrix4 } from '@math.gl/core';
2
+ import type { NumberArray3, NumberArray16 } from '@math.gl/core';
1
3
  type ProjectionProps = {
2
- modelMatrix?: readonly number[];
3
- viewMatrix?: readonly number[];
4
- projectionMatrix?: readonly number[];
5
- cameraPositionWorld?: readonly number[];
4
+ modelMatrix?: Readonly<Matrix4 | NumberArray16>;
5
+ viewMatrix?: Readonly<Matrix4 | NumberArray16>;
6
+ projectionMatrix?: Readonly<Matrix4 | NumberArray16>;
7
+ cameraPositionWorld?: Readonly<Vector3 | NumberArray3>;
6
8
  };
7
9
  declare function getUniforms(opts?: ProjectionProps, prevUniforms?: {}): Record<string, any>;
8
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/modules-webgl1/project/project.ts"],"names":[],"mappings":"AAOA,KAAK,eAAe,GAAG;IACrB,WAAW,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,UAAU,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC/B,gBAAgB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACrC,mBAAmB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACzC,CAAC;AAWF,iBAAS,WAAW,CAAC,IAAI,GAAE,eAAwC,EAAE,YAAY,KAAK,uBA2BrF;AA2ED;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;CAK+C,CAAC"}
1
+ {"version":3,"file":"project.d.ts","sourceRoot":"","sources":["../../../src/modules-webgl1/project/project.ts"],"names":[],"mappings":"AAIA,OAAO,EAAC,OAAO,EAAE,OAAO,EAAC,MAAM,eAAe,CAAC;AAE/C,OAAO,KAAK,EAAC,YAAY,EAAE,aAAa,EAAC,MAAM,eAAe,CAAC;AAE/D,KAAK,eAAe,GAAG;IACrB,WAAW,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,aAAa,CAAC,CAAC;IAChD,UAAU,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,aAAa,CAAC,CAAC;IAC/C,gBAAgB,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,aAAa,CAAC,CAAC;IACrD,mBAAmB,CAAC,EAAE,QAAQ,CAAC,OAAO,GAAG,YAAY,CAAC,CAAC;CACxD,CAAC;AAWF,iBAAS,WAAW,CAAC,IAAI,GAAE,eAAwC,EAAE,YAAY,KAAK,uBA2BrF;AA2ED;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;CAK+C,CAAC"}
@@ -10,6 +10,6 @@ export declare const fxaa: {
10
10
  readonly passes: [{
11
11
  readonly sampler: true;
12
12
  }];
13
- readonly getUniforms: (props: any) => any;
13
+ readonly getUniforms: (props: Partial<FXAAProps>) => Partial<FXAAProps>;
14
14
  };
15
15
  //# sourceMappingURL=fxaa.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"fxaa.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/fxaa/fxaa.ts"],"names":[],"mappings":"AAyqBA,MAAM,MAAM,SAAS,GAAG,EAAE,CAAC;AAC3B,MAAM,MAAM,YAAY,GAAG,EAAE,CAAC;AAE9B;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;;;CAMuC,CAAC"}
1
+ {"version":3,"file":"fxaa.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/fxaa/fxaa.ts"],"names":[],"mappings":"AAyqBA,MAAM,MAAM,SAAS,GAAG,EAAE,CAAC;AAC3B,MAAM,MAAM,YAAY,GAAG,EAAE,CAAC;AAE9B;;GAEG;AACH,eAAO,MAAM,IAAI;;;;;;;;CAM2C,CAAC"}
@@ -91,7 +91,7 @@
91
91
  // _ = the lowest digit is directly related to performance
92
92
  // _ = the highest digit is directly related to style
93
93
  //
94
- const fs = `
94
+ const fs = /* glsl */ `
95
95
  #define FXAA_QUALITY_PRESET 29
96
96
 
97
97
  #if (FXAA_QUALITY_PRESET == 10)
@@ -11,7 +11,6 @@ export type BrightnessContrastUniforms = BrightnessContrastProps;
11
11
  */
12
12
  export declare const brightnessContrast: {
13
13
  readonly props: BrightnessContrastProps;
14
- readonly uniforms: BrightnessContrastUniforms;
15
14
  readonly name: "brightnessContrast";
16
15
  readonly uniformTypes: {
17
16
  readonly brightness: "f32";
@@ -1 +1 @@
1
- {"version":3,"file":"brightnesscontrast.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts"],"names":[],"mappings":"AA+CA,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;oBAChB,uBAAuB;uBACpB,0BAA0B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBY,CAAC"}
1
+ {"version":3,"file":"brightnesscontrast.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/brightnesscontrast.ts"],"names":[],"mappings":"AA+CA,MAAM,MAAM,uBAAuB,GAAG;IACpC,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG,uBAAuB,CAAC;AAEjE;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB;oBAChB,uBAAuB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAmBkB,CAAC"}
@@ -48,7 +48,6 @@ vec4 brightnessContrast_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord)
48
48
  */
49
49
  export const brightnessContrast = {
50
50
  props: {},
51
- uniforms: {},
52
51
  name: 'brightnessContrast',
53
52
  uniformTypes: {
54
53
  brightness: 'f32',
@@ -20,7 +20,6 @@ export type HueSaturationUniforms = HueSaturationProps;
20
20
  */
21
21
  export declare const hueSaturation: {
22
22
  readonly props: HueSaturationProps;
23
- readonly uniforms: HueSaturationUniforms;
24
23
  readonly name: "hueSaturation";
25
24
  readonly fs: "uniform hueSaturationUniforms {\n float hue;\n float saturation;\n} hueSaturation;\n\nvec4 hueSaturation_filterColor(vec4 color) {\n // hue adjustment, wolfram alpha: RotationTransform[angle, {1, 1, 1}][{x, y, z}]\n float angle = hueSaturation.hue * 3.14159265;\n float s = sin(angle), c = cos(angle);\n vec3 weights = (vec3(2.0 * c, -sqrt(3.0) * s - c, sqrt(3.0) * s - c) + 1.0) / 3.0;\n float len = length(color.rgb);\n color.rgb = vec3(\n dot(color.rgb, weights.xyz),\n dot(color.rgb, weights.zxy),\n dot(color.rgb, weights.yzx)\n );\n\n // saturation adjustment\n float average = (color.r + color.g + color.b) / 3.0;\n if (hueSaturation.saturation > 0.0) {\n color.rgb += (average - color.rgb) * (1.0 - 1.0 / (1.001 - hueSaturation.saturation));\n } else {\n color.rgb += (average - color.rgb) * (-hueSaturation.saturation);\n }\n\n return color;\n}\n\nvec4 hueSaturation_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {\n return hueSaturation_filterColor(color);\n}\n";
26
25
  readonly uniformTypes: {
@@ -1 +1 @@
1
- {"version":3,"file":"huesaturation.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/huesaturation.ts"],"names":[],"mappings":"AAwCA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;iEAC6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa;oBACX,kBAAkB;uBACf,qBAAqB;;;;;;;;;;;;;;;;;;;;;;CAcY,CAAC"}
1
+ {"version":3,"file":"huesaturation.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/huesaturation.ts"],"names":[],"mappings":"AAwCA;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B;iEAC6D;IAC7D,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,4EAA4E;IAC5E,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa;oBACX,kBAAkB;;;;;;;;;;;;;;;;;;;;;;CAckB,CAAC"}
@@ -45,7 +45,6 @@ vec4 hueSaturation_filterColor_ext(vec4 color, vec2 texSize, vec2 texCoord) {
45
45
  */
46
46
  export const hueSaturation = {
47
47
  props: {},
48
- uniforms: {},
49
48
  name: 'hueSaturation',
50
49
  fs,
51
50
  uniformTypes: {
@@ -11,6 +11,9 @@ export declare const vibrance: {
11
11
  readonly props: VibranceProps;
12
12
  readonly uniforms: VibranceUniforms;
13
13
  readonly name: "vibrance";
14
+ readonly uniformTypes: {
15
+ readonly amount: "f32";
16
+ };
14
17
  readonly propTypes: {
15
18
  readonly amount: {
16
19
  readonly value: 0;
@@ -1 +1 @@
1
- {"version":3,"file":"vibrance.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/vibrance.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C,qGAAqG;AACrG,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,gBAAgB;;;;;;;;;;;;;CAO2B,CAAC"}
1
+ {"version":3,"file":"vibrance.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-adjust-filters/vibrance.ts"],"names":[],"mappings":"AAwBA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,kFAAkF;IAClF,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C,qGAAqG;AACrG,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,gBAAgB;;;;;;;;;;;;;;;;CAU2B,CAAC"}
@@ -23,6 +23,9 @@ export const vibrance = {
23
23
  props: {},
24
24
  uniforms: {},
25
25
  name: 'vibrance',
26
+ uniformTypes: {
27
+ amount: 'f32'
28
+ },
26
29
  propTypes: {
27
30
  amount: { value: 0, min: -1, max: 1 }
28
31
  },
@@ -4,9 +4,9 @@
4
4
  */
5
5
  export type TiltShiftProps = {
6
6
  /** The x,y coordinate of the start of the line segment. */
7
- start?: number[];
7
+ start?: [number, number];
8
8
  /** The xm y coordinate of the end of the line segment. */
9
- end?: number[];
9
+ end?: [number, number];
10
10
  /** The maximum radius of the pyramid blur. */
11
11
  blurRadius?: number;
12
12
  /** The distance from the line at which the maximum blur radius is reached. */
@@ -1 +1 @@
1
- {"version":3,"file":"tiltshift.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/tiltshift.ts"],"names":[],"mappings":"AAqDA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,MAAM,EAAE,CAAC;IACf,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;oBACP,cAAc;uBACX,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB4B,CAAC"}
1
+ {"version":3,"file":"tiltshift.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/tiltshift.ts"],"names":[],"mappings":"AAqDA;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,2DAA2D;IAC3D,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACzB,0DAA0D;IAC1D,GAAG,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvB,8CAA8C;IAC9C,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,8EAA8E;IAC9E,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAE/C;;;;;;;;;;GAUG;AACH,eAAO,MAAM,SAAS;oBACP,cAAc;uBACX,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB4B,CAAC"}
@@ -8,7 +8,7 @@ export type TriangleBlurProps = {
8
8
  /** The radius of the pyramid convolved with the image. */
9
9
  radius?: number;
10
10
  /** @deprecated internal property */
11
- delta?: number[];
11
+ delta?: [number, number];
12
12
  };
13
13
  export type TriangleBlurUniforms = TriangleBlurProps;
14
14
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"triangleblur.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/triangleblur.ts"],"names":[],"mappings":"AA2CA;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,YAAY;oBACV,iBAAiB;uBACd,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiB+B,CAAC"}
1
+ {"version":3,"file":"triangleblur.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/triangleblur.ts"],"names":[],"mappings":"AA2CA;;;;;GAKG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,0DAA0D;IAC1D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,oCAAoC;IACpC,KAAK,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,iBAAiB,CAAC;AAErD;;;;;GAKG;AACH,eAAO,MAAM,YAAY;oBACV,iBAAiB;uBACd,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiB+B,CAAC"}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export type ZoomBlurProps = {
5
5
  /** - The x, y coordinate of the blur origin. */
6
- center?: number[];
6
+ center?: [number, number];
7
7
  /** - The strength of the blur. Values in the range 0 to 1 are usually sufficient, where 0 doesn't change the image and 1 creates a highly blurred image. */
8
8
  strength?: number;
9
9
  };
@@ -1 +1 @@
1
- {"version":3,"file":"zoomblur.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/zoomblur.ts"],"names":[],"mappings":"AA0CA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,4JAA4J;IAC5J,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;CAc2B,CAAC"}
1
+ {"version":3,"file":"zoomblur.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-blur-filters/zoomblur.ts"],"names":[],"mappings":"AA0CA;;GAEG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,gDAAgD;IAChD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,4JAA4J;IAC5J,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C;;;GAGG;AACH,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;CAc2B,CAAC"}
@@ -6,7 +6,7 @@
6
6
  */
7
7
  export type ColorHalftoneProps = {
8
8
  /** The x,y coordinate of the pattern origin. */
9
- center?: number[];
9
+ center?: [number, number];
10
10
  /** The rotation of the pattern in radians. */
11
11
  angle?: number;
12
12
  /** The diameter of a dot in pixels. */
@@ -1 +1 @@
1
- {"version":3,"file":"colorhalftone.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/colorhalftone.ts"],"names":[],"mappings":"AA4CA;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gDAAgD;IAChD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,aAAa;oBACX,kBAAkB;uBACf,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAegC,CAAC"}
1
+ {"version":3,"file":"colorhalftone.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/colorhalftone.ts"],"names":[],"mappings":"AA4CA;;;;;GAKG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,gDAAgD;IAChD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG,kBAAkB,CAAC;AAEvD;;;;;GAKG;AACH,eAAO,MAAM,aAAa;oBACX,kBAAkB;uBACf,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAegC,CAAC"}
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export type DotScreenProps = {
7
7
  /** The x, y coordinate of the pattern origin. */
8
- center?: number[];
8
+ center?: [number, number];
9
9
  /** The rotation of the pattern in radians. */
10
10
  angle?: number;
11
11
  /** The diameter of a dot in pixels. */
@@ -1 +1 @@
1
- {"version":3,"file":"dotscreen.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/dotscreen.ts"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,SAAS;oBACP,cAAc;uBACX,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAe4B,CAAC"}
1
+ {"version":3,"file":"dotscreen.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/dotscreen.ts"],"names":[],"mappings":"AA+BA;;;;GAIG;AACH,MAAM,MAAM,cAAc,GAAG;IAC3B,iDAAiD;IACjD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG,cAAc,CAAC;AAE/C;;;;GAIG;AACH,eAAO,MAAM,SAAS;oBACP,cAAc;uBACX,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;CAe4B,CAAC"}
@@ -6,8 +6,8 @@
6
6
  export type EdgeWorkProps = {
7
7
  /** radius The radius of the effect in pixels. */
8
8
  radius?: number;
9
- /** @deprecated internal */
10
- delta?: number;
9
+ /** @deprecated xy or RGB */
10
+ mode?: 0 | 1;
11
11
  };
12
12
  export type EdgeWorkUniforms = EdgeWorkProps;
13
13
  /**
@@ -23,27 +23,31 @@ export declare const edgeWork: {
23
23
  readonly name: "random";
24
24
  readonly fs: "float random(vec3 scale, float seed) {\n /* use the fragment position for a different seed per-pixel */\n return fract(sin(dot(gl_FragCoord.xyz + seed, scale)) * 43758.5453 + seed);\n}\n";
25
25
  }];
26
- readonly fs: "uniform edgeWorkUniforms {\n float radius;\n vec2 delta;\n} edgeWork;\n\nvec4 edgeWork_sampleColor1(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 relativeDelta = edgeWork.radius * edgeWork.delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;\n float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4(color / total, 0.0, 1.0);\n}\n\nvec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {\n vec2 relativeDelta = edgeWork.radius * edgeWork.delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;\n color.x += sampleColor.x * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += sampleColor.y * weight;\n total.y += weight;\n }\n }\n float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\n return vec4(c, c, c, 1.0);\n}\n";
26
+ readonly fs: "uniform edgeWorkUniforms {\n float radius;\n int mode;\n} edgeWork;\n\nvec4 edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec3 sampleColor = texture(source, texCoord + relativeDelta * percent).rgb;\n float average = (sampleColor.r + sampleColor.g + sampleColor.b) / 3.0;\n color.x += average * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += average * weight;\n total.y += weight;\n }\n }\n return vec4(color / total, 0.0, 1.0);\n}\n\nvec4 edgeWork_sampleColorXY(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {\n vec2 relativeDelta = edgeWork.radius * delta / texSize;\n\n vec2 color = vec2(0.0);\n vec2 total = vec2(0.0);\n\n /* randomize the lookup values to hide the fixed number of samples */\n float offset = random(vec3(12.9898, 78.233, 151.7182), 0.0);\n\n for (float t = -30.0; t <= 30.0; t++) {\n float percent = (t + offset - 0.5) / 30.0;\n float weight = 1.0 - abs(percent);\n vec2 sampleColor = texture(source, texCoord + relativeDelta * percent).xy;\n color.x += sampleColor.x * weight;\n total.x += weight;\n if (abs(t) < 15.0) {\n weight = weight * 2.0 - 1.0;\n color.y += sampleColor.y * weight;\n total.y += weight;\n }\n }\n float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);\n return vec4(c, c, c, 1.0);\n}\n\nvec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {\n switch (edgeWork.mode) {\n case 0: \n return edgeWork_sampleColorRGB(source, texSize, texCoord, vec2(1., 0.));\n case 1: \n default:\n return edgeWork_sampleColorXY(source, texSize, texCoord, vec2(0., 1.));\n }\n}\n";
27
+ readonly uniformTypes: {
28
+ readonly radius: "f32";
29
+ readonly mode: "i32";
30
+ };
27
31
  readonly propTypes: {
28
32
  readonly radius: {
29
33
  readonly value: 2;
30
34
  readonly min: 1;
31
35
  readonly softMax: 50;
32
36
  };
33
- readonly delta: {
34
- readonly value: readonly [1, 0];
37
+ readonly mode: {
38
+ readonly value: 0;
35
39
  readonly private: true;
36
40
  };
37
41
  };
38
42
  readonly passes: [{
39
- readonly sampler: "edgeWork_sampleColor1";
40
- readonly propTypes: {
41
- readonly delta: readonly [1, 0];
43
+ readonly sampler: true;
44
+ readonly uniforms: {
45
+ readonly mode: 0;
42
46
  };
43
47
  }, {
44
- readonly sampler: "edgeWork_sampleColor2";
45
- readonly propTypes: {
46
- readonly delta: readonly [0, 1];
48
+ readonly sampler: true;
49
+ readonly uniforms: {
50
+ readonly mode: 1;
47
51
  };
48
52
  }];
49
53
  };
@@ -1 +1 @@
1
- {"version":3,"file":"edgework.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/edgework.ts"],"names":[],"mappings":"AAgEA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2BAA2B;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAuB8B,CAAC"}
1
+ {"version":3,"file":"edgework.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/edgework.ts"],"names":[],"mappings":"AA0EA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG;IAC1B,iDAAiD;IACjD,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,gBAAgB,GAAG,aAAa,CAAC;AAE7C;;;;GAIG;AACH,eAAO,MAAM,QAAQ;oBACN,aAAa;uBACV,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwB8B,CAAC"}
@@ -5,11 +5,11 @@ import { random } from "../../../modules/math/random/random.js";
5
5
  const fs = /* glsl */ `\
6
6
  uniform edgeWorkUniforms {
7
7
  float radius;
8
- vec2 delta;
8
+ int mode;
9
9
  } edgeWork;
10
10
 
11
- vec4 edgeWork_sampleColor1(sampler2D source, vec2 texSize, vec2 texCoord) {
12
- vec2 relativeDelta = edgeWork.radius * edgeWork.delta / texSize;
11
+ vec4 edgeWork_sampleColorRGB(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {
12
+ vec2 relativeDelta = edgeWork.radius * delta / texSize;
13
13
 
14
14
  vec2 color = vec2(0.0);
15
15
  vec2 total = vec2(0.0);
@@ -33,8 +33,8 @@ vec4 edgeWork_sampleColor1(sampler2D source, vec2 texSize, vec2 texCoord) {
33
33
  return vec4(color / total, 0.0, 1.0);
34
34
  }
35
35
 
36
- vec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {
37
- vec2 relativeDelta = edgeWork.radius * edgeWork.delta / texSize;
36
+ vec4 edgeWork_sampleColorXY(sampler2D source, vec2 texSize, vec2 texCoord, vec2 delta) {
37
+ vec2 relativeDelta = edgeWork.radius * delta / texSize;
38
38
 
39
39
  vec2 color = vec2(0.0);
40
40
  vec2 total = vec2(0.0);
@@ -57,6 +57,16 @@ vec4 edgeWork_sampleColor2(sampler2D source, vec2 texSize, vec2 texCoord) {
57
57
  float c = clamp(10000.0 * (color.y / total.y - color.x / total.x) + 0.5, 0.0, 1.0);
58
58
  return vec4(c, c, c, 1.0);
59
59
  }
60
+
61
+ vec4 edgeWork_sampleColor(sampler2D source, vec2 texSize, vec2 texCoord) {
62
+ switch (edgeWork.mode) {
63
+ case 0:
64
+ return edgeWork_sampleColorRGB(source, texSize, texCoord, vec2(1., 0.));
65
+ case 1:
66
+ default:
67
+ return edgeWork_sampleColorXY(source, texSize, texCoord, vec2(0., 1.));
68
+ }
69
+ }
60
70
  `;
61
71
  /**
62
72
  * Edge Work -
@@ -69,20 +79,22 @@ export const edgeWork = {
69
79
  name: 'edgeWork',
70
80
  dependencies: [random],
71
81
  fs,
82
+ uniformTypes: {
83
+ radius: 'f32',
84
+ mode: 'i32'
85
+ },
72
86
  propTypes: {
73
87
  radius: { value: 2, min: 1, softMax: 50 },
74
- delta: { value: [1, 0], private: true }
88
+ mode: { value: 0, private: true }
75
89
  },
76
90
  passes: [
77
91
  {
78
- // @ts-expect-error
79
- sampler: 'edgeWork_sampleColor1',
80
- propTypes: { delta: [1, 0] }
92
+ sampler: true,
93
+ uniforms: { mode: 0 }
81
94
  },
82
95
  {
83
- // @ts-expect-error
84
- sampler: 'edgeWork_sampleColor2',
85
- propTypes: { delta: [0, 1] }
96
+ sampler: true,
97
+ uniforms: { mode: 1 }
86
98
  }
87
99
  ]
88
100
  };
@@ -5,7 +5,7 @@
5
5
  */
6
6
  export type HexagonalPixelateProps = {
7
7
  /** The [x, y] coordinates of the pattern center. */
8
- center?: number[];
8
+ center?: [number, number];
9
9
  /** The width of an individual tile, in pixels. */
10
10
  scale?: number;
11
11
  };
@@ -1 +1 @@
1
- {"version":3,"file":"hexagonalpixelate.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts"],"names":[],"mappings":"AAmDA;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,oDAAoD;IACpD,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;oBACf,sBAAsB;uBACnB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;CAaoC,CAAC"}
1
+ {"version":3,"file":"hexagonalpixelate.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/hexagonalpixelate.ts"],"names":[],"mappings":"AAmDA;;;;GAIG;AACH,MAAM,MAAM,sBAAsB,GAAG;IACnC,oDAAoD;IACpD,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,kDAAkD;IAClD,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,sBAAsB,CAAC;AAE/D;;;;GAIG;AACH,eAAO,MAAM,iBAAiB;oBACf,sBAAsB;uBACnB,yBAAyB;;;;;;;;;;;;;;;;;;;;;;CAaoC,CAAC"}
@@ -3,7 +3,7 @@
3
3
  */
4
4
  export type MagnifyProps = {
5
5
  /** x, y position in screen coords, both x and y is normalized and in range `[0, 1]`. `[0, 0]` is the up left corner, `[1, 1]` is the bottom right corner. Default value is `[0, 0]`. */
6
- screenXY?: number[];
6
+ screenXY?: [number, number];
7
7
  /** effect radius in pixels. Default value is `100`. */
8
8
  radiusPixels?: number;
9
9
  /** magnify level. Default value is `2`. */
@@ -11,7 +11,7 @@ export type MagnifyProps = {
11
11
  /** border width of the effect circle, will not show border if value <= 0.0. Default value is `0`. */
12
12
  borderWidthPixels?: number;
13
13
  /** border color of the effect circle. Default value is `[255, 255, 255, 255]`. */
14
- borderColor?: number[];
14
+ borderColor?: [number, number, number, number];
15
15
  };
16
16
  export type MagnifyUniforms = MagnifyProps;
17
17
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"magnify.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/magnify.ts"],"names":[],"mappings":"AA6BA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,wLAAwL;IACxL,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qGAAqG;IACrG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kFAAkF;IAClF,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CACxB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;CAmBuC,CAAC"}
1
+ {"version":3,"file":"magnify.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-fun-filters/magnify.ts"],"names":[],"mappings":"AA6BA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,wLAAwL;IACxL,QAAQ,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC5B,uDAAuD;IACvD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qGAAqG;IACrG,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kFAAkF;IAClF,WAAW,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAChD,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,YAAY,CAAC;AAE3C;;GAEG;AACH,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;CAmBuC,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /** Bulges or pinches the image in a circle. */
2
2
  export type BulgePinchProps = {
3
3
  /** The [x, y] coordinates of the center of the circle of effect. */
4
- center?: number[];
4
+ center?: [number, number];
5
5
  /** The radius of the circle of effect. */
6
6
  radius?: number;
7
7
  /** strength -1 to 1 (-1 is strong pinch, 0 is no effect, 1 is strong bulge) */
@@ -1 +1 @@
1
- {"version":3,"file":"bulgepinch.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/bulgepinch.ts"],"names":[],"mappings":"AAqCA,+CAA+C;AAC/C,MAAM,MAAM,eAAe,GAAG;IAC5B,oEAAoE;IACpE,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,UAAU;oBACR,eAAe;uBACZ,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgB6B,CAAC"}
1
+ {"version":3,"file":"bulgepinch.d.ts","sourceRoot":"","sources":["../../../../src/passes/postprocessing/image-warp-filters/bulgepinch.ts"],"names":[],"mappings":"AAqCA,+CAA+C;AAC/C,MAAM,MAAM,eAAe,GAAG;IAC5B,oEAAoE;IACpE,MAAM,CAAC,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC1B,0CAA0C;IAC1C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,+EAA+E;IAC/E,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAEjD;;;GAGG;AACH,eAAO,MAAM,UAAU;oBACR,eAAe;uBACZ,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgB6B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@luma.gl/shadertools",
3
- "version": "9.1.0-alpha.16",
3
+ "version": "9.1.0-alpha.18",
4
4
  "description": "Shader module system for luma.gl",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -46,12 +46,12 @@
46
46
  "prepublishOnly": "npm run build-minified-bundle && npm run build-dev-bundle"
47
47
  },
48
48
  "peerDependencies": {
49
- "@luma.gl/core": "9.1.0-alpha.14"
49
+ "@luma.gl/core": "9.1.0-alpha.17"
50
50
  },
51
51
  "dependencies": {
52
52
  "@math.gl/core": "4.1.0-alpha.3",
53
53
  "@math.gl/types": "4.1.0-alpha.3",
54
54
  "wgsl_reflect": "^1.0.1"
55
55
  },
56
- "gitHead": "39eec40d12c826548b636c057fdb8572adfe611f"
56
+ "gitHead": "61c927cfdc3b96eb71aa014cbeac2bfe9375c0f6"
57
57
  }