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

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/index.cjs CHANGED
@@ -1966,149 +1966,105 @@ var import_mesh_layers2 = require("@deck.gl/mesh-layers");
1966
1966
  var import_gltf = require("@luma.gl/gltf");
1967
1967
  var import_shadertools = require("@luma.gl/shadertools");
1968
1968
  var import_engine = require("@luma.gl/engine");
1969
- var import_constants = require("@luma.gl/constants");
1970
1969
  var import_mesh_layers = require("@deck.gl/mesh-layers");
1971
1970
 
1972
1971
  // dist/mesh-layer/mesh-layer-vertex.glsl.js
1973
1972
  var mesh_layer_vertex_glsl_default = `#version 300 es
1974
1973
  #define SHADER_NAME simple-mesh-layer-vs
1975
-
1976
- // Scale the model
1977
1974
  uniform float sizeScale;
1978
1975
  uniform bool composeModelMatrix;
1979
1976
  uniform bool pickFeatureIds;
1980
-
1981
- // Primitive attributes
1982
1977
  in vec3 positions;
1983
1978
  in vec3 normals;
1984
1979
  in vec3 colors;
1985
1980
  in vec2 texCoords;
1986
1981
  in vec4 uvRegions;
1987
1982
  in vec3 featureIdsPickingColors;
1988
-
1989
- // Instance attributes
1990
1983
  in vec4 instanceColors;
1991
1984
  in vec3 instancePickingColors;
1992
1985
  in vec3 instanceModelMatrixCol0;
1993
1986
  in vec3 instanceModelMatrixCol1;
1994
1987
  in vec3 instanceModelMatrixCol2;
1995
-
1996
- // Outputs to fragment shader
1997
1988
  out vec2 vTexCoord;
1998
1989
  out vec3 cameraPosition;
1999
1990
  out vec3 normals_commonspace;
2000
1991
  out vec4 position_commonspace;
2001
1992
  out vec4 vColor;
2002
-
2003
1993
  vec2 applyUVRegion(vec2 uv) {
2004
- #ifdef HAS_UV_REGIONS
2005
- // https://github.com/Esri/i3s-spec/blob/master/docs/1.7/geometryUVRegion.cmn.md
2006
- return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;
2007
- #else
2008
- return uv;
2009
- #endif
1994
+ #ifdef HAS_UV_REGIONS
1995
+ return fract(uv) * (uvRegions.zw - uvRegions.xy) + uvRegions.xy;
1996
+ #else
1997
+ return uv;
1998
+ #endif
2010
1999
  }
2011
-
2012
2000
  void main(void) {
2013
- vec2 uv = applyUVRegion(texCoords);
2014
- geometry.uv = uv;
2015
-
2016
- if (pickFeatureIds) {
2017
- geometry.pickingColor = featureIdsPickingColors;
2018
- } else {
2019
- geometry.pickingColor = instancePickingColors;
2020
- }
2021
-
2022
- mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
2023
-
2024
- vTexCoord = uv;
2025
- cameraPosition = project_uCameraPosition;
2026
- vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
2027
-
2028
- vec3 pos = (instanceModelMatrix * positions) * sizeScale;
2029
- vec3 projectedPosition = project_position(positions);
2030
- position_commonspace = vec4(projectedPosition, 1.0);
2031
- gl_Position = project_common_position_to_clipspace(position_commonspace);
2032
-
2033
- geometry.position = position_commonspace;
2034
- normals_commonspace = project_normal(instanceModelMatrix * normals);
2035
- geometry.normal = normals_commonspace;
2036
-
2037
- DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
2038
-
2039
- #ifdef MODULE_PBR
2040
- // set PBR data
2041
- pbr_vPosition = geometry.position.xyz;
2042
- #ifdef HAS_NORMALS
2043
- pbr_vNormal = geometry.normal;
2044
- #endif
2045
-
2046
- #ifdef HAS_UV
2047
- pbr_vUV = uv;
2048
- #else
2049
- pbr_vUV = vec2(0., 0.);
2050
- #endif
2051
- geometry.uv = pbr_vUV;
2052
- #endif
2053
-
2054
- DECKGL_FILTER_COLOR(vColor, geometry);
2001
+ vec2 uv = applyUVRegion(texCoords);
2002
+ geometry.uv = uv;
2003
+ if (pickFeatureIds) {
2004
+ geometry.pickingColor = featureIdsPickingColors;
2005
+ } else {
2006
+ geometry.pickingColor = instancePickingColors;
2007
+ }
2008
+ mat3 instanceModelMatrix = mat3(instanceModelMatrixCol0, instanceModelMatrixCol1, instanceModelMatrixCol2);
2009
+ vTexCoord = uv;
2010
+ cameraPosition = project_uCameraPosition;
2011
+ vColor = vec4(colors * instanceColors.rgb, instanceColors.a);
2012
+ vec3 pos = (instanceModelMatrix * positions) * sizeScale;
2013
+ vec3 projectedPosition = project_position(positions);
2014
+ position_commonspace = vec4(projectedPosition, 1.0);
2015
+ gl_Position = project_common_position_to_clipspace(position_commonspace);
2016
+ geometry.position = position_commonspace;
2017
+ normals_commonspace = project_normal(instanceModelMatrix * normals);
2018
+ geometry.normal = normals_commonspace;
2019
+ DECKGL_FILTER_GL_POSITION(gl_Position, geometry);
2020
+ #ifdef MODULE_PBR
2021
+ pbr_vPosition = geometry.position.xyz;
2022
+ #ifdef HAS_NORMALS
2023
+ pbr_vNormal = geometry.normal;
2024
+ #endif
2025
+ #ifdef HAS_UV
2026
+ pbr_vUV = uv;
2027
+ #else
2028
+ pbr_vUV = vec2(0., 0.);
2029
+ #endif
2030
+ geometry.uv = pbr_vUV;
2031
+ #endif
2032
+ DECKGL_FILTER_COLOR(vColor, geometry);
2055
2033
  }
2056
2034
  `;
2057
2035
 
2058
2036
  // dist/mesh-layer/mesh-layer-fragment.glsl.js
2059
2037
  var mesh_layer_fragment_glsl_default = `#version 300 es
2060
2038
  #define SHADER_NAME simple-mesh-layer-fs
2061
-
2062
2039
  precision highp float;
2063
-
2064
2040
  uniform bool hasTexture;
2065
2041
  uniform sampler2D sampler;
2066
2042
  uniform bool flatShading;
2067
2043
  uniform float opacity;
2068
-
2069
2044
  in vec2 vTexCoord;
2070
2045
  in vec3 cameraPosition;
2071
2046
  in vec3 normals_commonspace;
2072
2047
  in vec4 position_commonspace;
2073
2048
  in vec4 vColor;
2074
-
2075
2049
  out vec4 fragColor;
2076
-
2077
2050
  void main(void) {
2078
-
2079
2051
  #ifdef MODULE_PBR
2080
-
2081
- fragColor = vColor * pbr_filterColor(vec4(0));
2082
- geometry.uv = pbr_vUV;
2083
- fragColor.a *= opacity;
2084
-
2052
+ fragColor = vColor * pbr_filterColor(vec4(0));
2053
+ geometry.uv = pbr_vUV;
2054
+ fragColor.a *= opacity;
2085
2055
  #else
2086
-
2087
- geometry.uv = vTexCoord;
2088
-
2089
- vec3 normal;
2090
- if (flatShading) {
2091
-
2092
- // NOTE(Tarek): This is necessary because
2093
- // headless.gl reports the extension as
2094
- // available but does not support it in
2095
- // the shader.
2096
- #ifdef DERIVATIVES_AVAILABLE
2097
- normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
2098
- #else
2099
- normal = vec3(0.0, 0.0, 1.0);
2100
- #endif
2101
- } else {
2102
- normal = normals_commonspace;
2103
- }
2104
-
2105
- vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;
2106
- vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
2107
- fragColor = vec4(lightColor, color.a * opacity);
2108
-
2056
+ geometry.uv = vTexCoord;
2057
+ vec3 normal;
2058
+ if (flatShading) {
2059
+ normal = normalize(cross(dFdx(position_commonspace.xyz), dFdy(position_commonspace.xyz)));
2060
+ } else {
2061
+ normal = normals_commonspace;
2062
+ }
2063
+ vec4 color = hasTexture ? texture(sampler, vTexCoord) : vColor;
2064
+ vec3 lightColor = lighting_getLightColor(color.rgb, cameraPosition, position_commonspace.xyz, normal);
2065
+ fragColor = vec4(lightColor, color.a * opacity);
2109
2066
  #endif
2110
-
2111
- DECKGL_FILTER_COLOR(fragColor, geometry);
2067
+ DECKGL_FILTER_COLOR(fragColor, geometry);
2112
2068
  }
2113
2069
  `;
2114
2070
 
@@ -2143,7 +2099,7 @@ var _MeshLayer = class extends import_mesh_layers.SimpleMeshLayer {
2143
2099
  if (featureIds) {
2144
2100
  attributeManager.add({
2145
2101
  featureIdsPickingColors: {
2146
- type: import_constants.GL.UNSIGNED_BYTE,
2102
+ type: "uint8",
2147
2103
  size: 3,
2148
2104
  noAlloc: true,
2149
2105
  update: this.calculateFeatureIdsPickingColors