@deck.gl/geo-layers 9.0.0-beta.5 → 9.0.0-beta.6

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.
@@ -1,3 +1,3 @@
1
- declare const _default: "#version 300 es\n#define SHADER_NAME simple-mesh-layer-fs\n\nprecision highp float;\n\nuniform bool hasTexture;\nuniform sampler2D sampler;\nuniform bool flatShading;\nuniform float opacity;\n\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n \n#ifdef MODULE_PBR\n\n fragColor = vColor * pbr_filterColor(vec4(0));\n geometry.uv = pbr_vUV;\n fragColor.a *= opacity;\n\n#else\n\n geometry.uv = vTexCoord;\n\n vec3 normal;\n if (flatShading) {\n\n// NOTE(Tarek): This is necessary because\n// headless.gl reports the extension as\n// available but does not support it in\n// the shader.\n#ifdef DERIVATIVES_AVAILABLE\n normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n#else\n normal = vec3(0.0, 0.0, 1.0);\n#endif\n } else {\n normal = normals_commonspace;\n }\n\n vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;\n vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, color.a * opacity);\n\n#endif\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
1
+ declare const _default: "#version 300 es\n#define SHADER_NAME simple-mesh-layer-fs\n\nprecision highp float;\n\nuniform bool hasTexture;\nuniform sampler2D sampler;\nuniform bool flatShading;\nuniform float opacity;\n\nin vec2 vTexCoord;\nin vec3 cameraPosition;\nin vec3 normals_commonspace;\nin vec4 position_commonspace;\nin vec4 vColor;\n\nout vec4 fragColor;\n\nvoid main(void) {\n \n#ifdef MODULE_PBR\n\n fragColor = vColor * pbr_filterColor(vec4(0));\n geometry.uv = pbr_vUV;\n fragColor.a *= opacity;\n\n#else\n\n geometry.uv = vTexCoord;\n\n vec3 normal;\n if (flatShading) {\n\n normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));\n } else {\n normal = normals_commonspace;\n }\n\n vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;\n vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);\n fragColor = vec4(lightColor, color.a * opacity);\n\n#endif\n\n DECKGL_FILTER_COLOR(fragColor, geometry);\n}\n";
2
2
  export default _default;
3
3
  //# sourceMappingURL=mesh-layer-fragment.glsl.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-layer-fragment.glsl.d.ts","sourceRoot":"","sources":["../../src/mesh-layer/mesh-layer-fragment.glsl.ts"],"names":[],"mappings":";AAAA,wBAsDE"}
1
+ {"version":3,"file":"mesh-layer-fragment.glsl.d.ts","sourceRoot":"","sources":["../../src/mesh-layer/mesh-layer-fragment.glsl.ts"],"names":[],"mappings":";AAAA,wBA8CE"}
@@ -1,55 +1,33 @@
1
1
  export default `#version 300 es
2
2
  #define SHADER_NAME simple-mesh-layer-fs
3
-
4
3
  precision highp float;
5
-
6
4
  uniform bool hasTexture;
7
5
  uniform sampler2D sampler;
8
6
  uniform bool flatShading;
9
7
  uniform float opacity;
10
-
11
8
  in vec2 vTexCoord;
12
9
  in vec3 cameraPosition;
13
10
  in vec3 normals_commonspace;
14
11
  in vec4 position_commonspace;
15
12
  in vec4 vColor;
16
-
17
13
  out vec4 fragColor;
18
-
19
14
  void main(void) {
20
-
21
15
  #ifdef MODULE_PBR
22
-
23
- fragColor = vColor * pbr_filterColor(vec4(0));
24
- geometry.uv = pbr_vUV;
25
- fragColor.a *= opacity;
26
-
16
+ fragColor = vColor * pbr_filterColor(vec4(0));
17
+ geometry.uv = pbr_vUV;
18
+ fragColor.a *= opacity;
27
19
  #else
28
-
29
- geometry.uv = vTexCoord;
30
-
31
- vec3 normal;
32
- if (flatShading) {
33
-
34
- // NOTE(Tarek): This is necessary because
35
- // headless.gl reports the extension as
36
- // available but does not support it in
37
- // the shader.
38
- #ifdef DERIVATIVES_AVAILABLE
39
- normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
40
- #else
41
- normal = vec3(0.0, 0.0, 1.0);
42
- #endif
43
- } else {
44
- normal = normals_commonspace;
45
- }
46
-
47
- vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;
48
- vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
49
- fragColor = vec4(lightColor, color.a * opacity);
50
-
20
+ geometry.uv = vTexCoord;
21
+ vec3 normal;
22
+ if (flatShading) {
23
+ normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
24
+ } else {
25
+ normal = normals_commonspace;
26
+ }
27
+ vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;
28
+ vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
29
+ fragColor = vec4(lightColor, color.a * opacity);
51
30
  #endif
52
-
53
- DECKGL_FILTER_COLOR(fragColor, geometry);
31
+ DECKGL_FILTER_COLOR(fragColor, geometry);
54
32
  }
55
33
  `;
@@ -1,84 +1,63 @@
1
1
  export default `#version 300 es
2
2
  #define SHADER_NAME simple-mesh-layer-vs
3
-
4
- // Scale the model
5
3
  uniform float sizeScale;
6
4
  uniform bool composeModelMatrix;
7
5
  uniform bool pickFeatureIds;
8
-
9
- // Primitive attributes
10
6
  in vec3 positions;
11
7
  in vec3 normals;
12
8
  in vec3 colors;
13
9
  in vec2 texCoords;
14
10
  in vec4 uvRegions;
15
11
  in vec3 featureIdsPickingColors;
16
-
17
- // Instance attributes
18
12
  in vec4 instanceColors;
19
13
  in vec3 instancePickingColors;
20
14
  in vec3 instanceModelMatrixCol0;
21
15
  in vec3 instanceModelMatrixCol1;
22
16
  in vec3 instanceModelMatrixCol2;
23
-
24
- // Outputs to fragment shader
25
17
  out vec2 vTexCoord;
26
18
  out vec3 cameraPosition;
27
19
  out vec3 normals_commonspace;
28
20
  out vec4 position_commonspace;
29
21
  out vec4 vColor;
30
-
31
22
  vec2 applyUVRegion(vec2 uv) {
32
- #ifdef HAS_UV_REGIONS
33
- // https://github.com/Esri/i3s-spec/blob/master/docs/1.7/geometryUVRegion.cmn.md
34
- return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;
35
- #else
36
- return uv;
37
- #endif
23
+ #ifdef HAS_UV_REGIONS
24
+ return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;
25
+ #else
26
+ return uv;
27
+ #endif
38
28
  }
39
-
40
29
  void main(void) {
41
- vec2 uv = applyUVRegion(texCoords);
42
- geometry.uv = uv;
43
-
44
- if (pickFeatureIds) {
45
- geometry.pickingColor = featureIdsPickingColors;
46
- } else {
47
- geometry.pickingColor = instancePickingColors;
48
- }
49
-
50
- mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
51
-
52
- vTexCoord = uv;
53
- cameraPosition = project_uCameraPosition;
54
- vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
55
-
56
- vec3 pos = (instanceModelMatrix * positions) * sizeScale;
57
- vec3 projectedPosition = project_position(positions);
58
- position_commonspace = vec4(projectedPosition, 1.0);
59
- gl_Position = project_common_position_to_clipspace(position_commonspace);
60
-
61
- geometry.position = position_commonspace;
62
- normals_commonspace = project_normal(instanceModelMatrix * normals);
63
- geometry.normal = normals_commonspace;
64
-
65
- DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
66
-
67
- #ifdef MODULE_PBR
68
- // set PBR data
69
- pbr_vPosition = geometry.position.xyz;
70
- #ifdef HAS_NORMALS
71
- pbr_vNormal = geometry.normal;
72
- #endif
73
-
74
- #ifdef HAS_UV
75
- pbr_vUV = uv;
76
- #else
77
- pbr_vUV = vec2(0., 0.);
78
- #endif
79
- geometry.uv = pbr_vUV;
80
- #endif
81
-
82
- DECKGL_FILTER_COLOR(vColor, geometry);
30
+ vec2 uv = applyUVRegion(texCoords);
31
+ geometry.uv = uv;
32
+ if (pickFeatureIds) {
33
+ geometry.pickingColor = featureIdsPickingColors;
34
+ } else {
35
+ geometry.pickingColor = instancePickingColors;
36
+ }
37
+ mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
38
+ vTexCoord = uv;
39
+ cameraPosition = project_uCameraPosition;
40
+ vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
41
+ vec3 pos = (instanceModelMatrix * positions) * sizeScale;
42
+ vec3 projectedPosition = project_position(positions);
43
+ position_commonspace = vec4(projectedPosition, 1.0);
44
+ gl_Position = project_common_position_to_clipspace(position_commonspace);
45
+ geometry.position = position_commonspace;
46
+ normals_commonspace = project_normal(instanceModelMatrix * normals);
47
+ geometry.normal = normals_commonspace;
48
+ DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
49
+ #ifdef MODULE_PBR
50
+ pbr_vPosition = geometry.position.xyz;
51
+ #ifdef HAS_NORMALS
52
+ pbr_vNormal = geometry.normal;
53
+ #endif
54
+ #ifdef HAS_UV
55
+ pbr_vUV = uv;
56
+ #else
57
+ pbr_vUV = vec2(0., 0.);
58
+ #endif
59
+ geometry.uv = pbr_vUV;
60
+ #endif
61
+ DECKGL_FILTER_COLOR(vColor, geometry);
83
62
  }
84
63
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"mesh-layer.d.ts","sourceRoot":"","sources":["../../src/mesh-layer/mesh-layer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAmB,iBAAiB,EAAC,MAAM,eAAe,CAAC;AAElE,OAAO,EAAC,KAAK,EAAC,MAAM,iBAAiB,CAAC;AAEtC,OAAO,KAAK,EAAC,aAAa,EAAE,cAAc,EAAC,MAAM,oBAAoB,CAAC;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,IAAI,EAAE,IAAI,GAAG,iBAAiB;IAiBzD,gCAAgC,CAAC,SAAS,KAAA;IAiB1C,aAAa,CAAC,OAAO,EAAE,YAAY;CAKpC"}
@@ -1,7 +1,6 @@
1
1
  import { parsePBRMaterial } from '@luma.gl/gltf';
2
2
  import { pbr } from '@luma.gl/shadertools';
3
3
  import { Model } from '@luma.gl/engine';
4
- import { GL } from '@luma.gl/constants';
5
4
  import { SimpleMeshLayer } from '@deck.gl/mesh-layers';
6
5
  import vs from "./mesh-layer-vertex.glsl.js";
7
6
  import fs from "./mesh-layer-fragment.glsl.js";
@@ -38,7 +37,7 @@ export default class MeshLayer extends SimpleMeshLayer {
38
37
  // attributeManager is always defined in a primitive layer
39
38
  attributeManager.add({
40
39
  featureIdsPickingColors: {
41
- type: GL.UNSIGNED_BYTE,
40
+ type: 'uint8',
42
41
  size: 3,
43
42
  noAlloc: true,
44
43
  // eslint-disable-next-line @typescript-eslint/unbound-method
@@ -26,7 +26,7 @@ type _TripsLayerProps<DataT = unknown> = {
26
26
  getTimestamps?: AccessorFunction<DataT, NumericArray>;
27
27
  };
28
28
  /** Render animated paths that represent vehicle trips. */
29
- export default class TripsLayer<DataT = any, ExtraProps extends {} = {}> extends PathLayer<DataT, Required<_TripsLayerProps> & ExtraProps> {
29
+ export default class TripsLayer<DataT = any, ExtraProps extends {} = {}> extends PathLayer<DataT, Required<_TripsLayerProps<DataT>> & ExtraProps> {
30
30
  static layerName: string;
31
31
  static defaultProps: DefaultProps<TripsLayerProps<unknown>>;
32
32
  getShaders(): any;
@@ -1 +1 @@
1
- {"version":3,"file":"trips-layer.d.ts","sourceRoot":"","sources":["../../src/trips-layer/trips-layer.ts"],"names":[],"mappings":"AAoBA,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,eAAe,CAAC;AAChD,OAAO,EAAC,gBAAgB,EAAE,YAAY,EAAC,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAC,SAAS,EAAE,cAAc,EAAC,MAAM,iBAAiB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