@webviz/subsurface-viewer 0.0.1-alpha.1
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/DashSubsurfaceViewer.d.ts +56 -0
- package/dist/DashSubsurfaceViewer.js +160 -0
- package/dist/DashSubsurfaceViewer.js.map +1 -0
- package/dist/SubsurfaceViewer.d.ts +65 -0
- package/dist/SubsurfaceViewer.js +208 -0
- package/dist/SubsurfaceViewer.js.map +1 -0
- package/dist/assets/glTF/north_arrow/scene.bin +0 -0
- package/dist/assets/glTF/north_arrow/scene.gltf +315 -0
- package/dist/assets/glTF/north_arrow/textures/Arrow5_baseColor.png +0 -0
- package/dist/assets/glTF/north_arrow/textures/Arrow5_metallicRoughness.png +0 -0
- package/dist/assets/glTF/north_arrow/textures/Arrow5_normal.png +0 -0
- package/dist/components/ColorLegend.d.ts +26 -0
- package/dist/components/ColorLegend.js +19 -0
- package/dist/components/ColorLegend.js.map +1 -0
- package/dist/components/ColorLegends.d.ts +12 -0
- package/dist/components/ColorLegends.js +10 -0
- package/dist/components/ColorLegends.js.map +1 -0
- package/dist/components/DistanceScale.d.ts +12 -0
- package/dist/components/DistanceScale.js +45 -0
- package/dist/components/DistanceScale.js.map +1 -0
- package/dist/components/InfoCard.d.ts +11 -0
- package/dist/components/InfoCard.js +149 -0
- package/dist/components/InfoCard.js.map +1 -0
- package/dist/components/Map.d.ts +158 -0
- package/dist/components/Map.js +867 -0
- package/dist/components/Map.js.map +1 -0
- package/dist/components/StatusIndicator.d.ts +8 -0
- package/dist/components/StatusIndicator.js +20 -0
- package/dist/components/StatusIndicator.js.map +1 -0
- package/dist/components/ViewAnnotation.d.ts +7 -0
- package/dist/components/ViewAnnotation.js +13 -0
- package/dist/components/ViewAnnotation.js.map +1 -0
- package/dist/components/ViewFooter.d.ts +6 -0
- package/dist/components/ViewFooter.js +21 -0
- package/dist/components/ViewFooter.js.map +1 -0
- package/dist/components/settings/DrawModeSelector.d.ts +18 -0
- package/dist/components/settings/DrawModeSelector.js +20 -0
- package/dist/components/settings/DrawModeSelector.js.map +1 -0
- package/dist/components/settings/LayerProperty.d.ts +6 -0
- package/dist/components/settings/LayerProperty.js +39 -0
- package/dist/components/settings/LayerProperty.js.map +1 -0
- package/dist/components/settings/LayerSettingsButton.d.ts +7 -0
- package/dist/components/settings/LayerSettingsButton.js +51 -0
- package/dist/components/settings/LayerSettingsButton.js.map +1 -0
- package/dist/components/settings/LayersButton.d.ts +8 -0
- package/dist/components/settings/LayersButton.js +45 -0
- package/dist/components/settings/LayersButton.js.map +1 -0
- package/dist/components/settings/NumericInput.d.ts +20 -0
- package/dist/components/settings/NumericInput.js +25 -0
- package/dist/components/settings/NumericInput.js.map +1 -0
- package/dist/components/settings/Settings.d.ts +7 -0
- package/dist/components/settings/Settings.js +39 -0
- package/dist/components/settings/Settings.js.map +1 -0
- package/dist/components/settings/SliderInput.d.ts +29 -0
- package/dist/components/settings/SliderInput.js +21 -0
- package/dist/components/settings/SliderInput.js.map +1 -0
- package/dist/components/settings/ToggleButton.d.ts +17 -0
- package/dist/components/settings/ToggleButton.js +19 -0
- package/dist/components/settings/ToggleButton.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -0
- package/dist/inputSchema/ColorTables.json +51 -0
- package/dist/inputSchema/FaultPolygons.json +80 -0
- package/dist/inputSchema/Grid.json +39 -0
- package/dist/inputSchema/PieChart.json +72 -0
- package/dist/inputSchema/WellLog.json +126 -0
- package/dist/inputSchema/WellLogTemplate.json +136 -0
- package/dist/inputSchema/WellLogs.json +5 -0
- package/dist/inputSchema/Wells.json +106 -0
- package/dist/inputSchema/schemaValidationUtil.d.ts +5 -0
- package/dist/inputSchema/schemaValidationUtil.js +48 -0
- package/dist/inputSchema/schemaValidationUtil.js.map +1 -0
- package/dist/inputSchema/validator.d.ts +1 -0
- package/dist/inputSchema/validator.js +64 -0
- package/dist/inputSchema/validator.js.map +1 -0
- package/dist/inputSchema/wellCompletions.json +108 -0
- package/dist/layers/BoxSelectionLayer/boxSelectionLayer.d.ts +37 -0
- package/dist/layers/BoxSelectionLayer/boxSelectionLayer.js +86 -0
- package/dist/layers/BoxSelectionLayer/boxSelectionLayer.js.map +1 -0
- package/dist/layers/axes/axes-fragment.glsl.d.ts +2 -0
- package/dist/layers/axes/axes-fragment.glsl.js +15 -0
- package/dist/layers/axes/axes-fragment.glsl.js.map +1 -0
- package/dist/layers/axes/axesLayer.d.ts +38 -0
- package/dist/layers/axes/axesLayer.js +485 -0
- package/dist/layers/axes/axesLayer.js.map +1 -0
- package/dist/layers/axes/boxLayer.d.ts +20 -0
- package/dist/layers/axes/boxLayer.js +52 -0
- package/dist/layers/axes/boxLayer.js.map +1 -0
- package/dist/layers/axes/grid-vertex.glsl.d.ts +2 -0
- package/dist/layers/axes/grid-vertex.glsl.js +14 -0
- package/dist/layers/axes/grid-vertex.glsl.js.map +1 -0
- package/dist/layers/axes2d/axes2DLayer.d.ts +58 -0
- package/dist/layers/axes2d/axes2DLayer.js +613 -0
- package/dist/layers/axes2d/axes2DLayer.js.map +1 -0
- package/dist/layers/axes2d/font-atlas.png +0 -0
- package/dist/layers/axes2d/label-fragment.glsl.d.ts +2 -0
- package/dist/layers/axes2d/label-fragment.glsl.js +38 -0
- package/dist/layers/axes2d/label-fragment.glsl.js.map +1 -0
- package/dist/layers/axes2d/label-vertex.glsl.d.ts +2 -0
- package/dist/layers/axes2d/label-vertex.glsl.js +21 -0
- package/dist/layers/axes2d/label-vertex.glsl.js.map +1 -0
- package/dist/layers/axes2d/line-fragment.glsl.d.ts +2 -0
- package/dist/layers/axes2d/line-fragment.glsl.js +15 -0
- package/dist/layers/axes2d/line-fragment.glsl.js.map +1 -0
- package/dist/layers/axes2d/line-vertex.glsl.d.ts +2 -0
- package/dist/layers/axes2d/line-vertex.glsl.js +14 -0
- package/dist/layers/axes2d/line-vertex.glsl.js.map +1 -0
- package/dist/layers/colormap/colormap.fs.glsl.d.ts +2 -0
- package/dist/layers/colormap/colormap.fs.glsl.js +42 -0
- package/dist/layers/colormap/colormap.fs.glsl.js.map +1 -0
- package/dist/layers/colormap/colormapLayer.d.ts +24 -0
- package/dist/layers/colormap/colormapLayer.js +150 -0
- package/dist/layers/colormap/colormapLayer.js.map +1 -0
- package/dist/layers/drawing/drawingLayer.d.ts +17 -0
- package/dist/layers/drawing/drawingLayer.js +202 -0
- package/dist/layers/drawing/drawingLayer.js.map +1 -0
- package/dist/layers/fault_polygons/faultPolygonsLayer.d.ts +9 -0
- package/dist/layers/fault_polygons/faultPolygonsLayer.js +43 -0
- package/dist/layers/fault_polygons/faultPolygonsLayer.js.map +1 -0
- package/dist/layers/grid3d/fragment.fs.glsl.d.ts +2 -0
- package/dist/layers/grid3d/fragment.fs.glsl.js +109 -0
- package/dist/layers/grid3d/fragment.fs.glsl.js.map +1 -0
- package/dist/layers/grid3d/fragment_lines.glsl.d.ts +2 -0
- package/dist/layers/grid3d/fragment_lines.glsl.js +21 -0
- package/dist/layers/grid3d/fragment_lines.glsl.js.map +1 -0
- package/dist/layers/grid3d/grid3dLayer.d.ts +73 -0
- package/dist/layers/grid3d/grid3dLayer.js +134 -0
- package/dist/layers/grid3d/grid3dLayer.js.map +1 -0
- package/dist/layers/grid3d/privateLayer.d.ts +73 -0
- package/dist/layers/grid3d/privateLayer.js +174 -0
- package/dist/layers/grid3d/privateLayer.js.map +1 -0
- package/dist/layers/grid3d/vertex.glsl.d.ts +2 -0
- package/dist/layers/grid3d/vertex.glsl.js +43 -0
- package/dist/layers/grid3d/vertex.glsl.js.map +1 -0
- package/dist/layers/grid3d/vertex_lines.glsl.d.ts +2 -0
- package/dist/layers/grid3d/vertex_lines.glsl.js +16 -0
- package/dist/layers/grid3d/vertex_lines.glsl.js.map +1 -0
- package/dist/layers/grid3d/webworker.d.ts +4 -0
- package/dist/layers/grid3d/webworker.js +140 -0
- package/dist/layers/grid3d/webworker.js.map +1 -0
- package/dist/layers/hillshading2d/hillshading2d.fs.glsl.d.ts +2 -0
- package/dist/layers/hillshading2d/hillshading2d.fs.glsl.js +62 -0
- package/dist/layers/hillshading2d/hillshading2d.fs.glsl.js.map +1 -0
- package/dist/layers/hillshading2d/hillshading2dLayer.d.ts +22 -0
- package/dist/layers/hillshading2d/hillshading2dLayer.js +101 -0
- package/dist/layers/hillshading2d/hillshading2dLayer.js.map +1 -0
- package/dist/layers/index.d.ts +34 -0
- package/dist/layers/index.js +19 -0
- package/dist/layers/index.js.map +1 -0
- package/dist/layers/intersection/unfoldedGeoJsonLayer.d.ts +10 -0
- package/dist/layers/intersection/unfoldedGeoJsonLayer.js +64 -0
- package/dist/layers/intersection/unfoldedGeoJsonLayer.js.map +1 -0
- package/dist/layers/map/fragment.fs.glsl.d.ts +2 -0
- package/dist/layers/map/fragment.fs.glsl.js +127 -0
- package/dist/layers/map/fragment.fs.glsl.js.map +1 -0
- package/dist/layers/map/fragment_lines.glsl.d.ts +2 -0
- package/dist/layers/map/fragment_lines.glsl.js +21 -0
- package/dist/layers/map/fragment_lines.glsl.js.map +1 -0
- package/dist/layers/map/mapLayer.d.ts +120 -0
- package/dist/layers/map/mapLayer.js +275 -0
- package/dist/layers/map/mapLayer.js.map +1 -0
- package/dist/layers/map/privateMapLayer.d.ts +76 -0
- package/dist/layers/map/privateMapLayer.js +190 -0
- package/dist/layers/map/privateMapLayer.js.map +1 -0
- package/dist/layers/map/vertex.glsl.d.ts +2 -0
- package/dist/layers/map/vertex.glsl.js +45 -0
- package/dist/layers/map/vertex.glsl.js.map +1 -0
- package/dist/layers/map/vertex_lines.glsl.d.ts +2 -0
- package/dist/layers/map/vertex_lines.glsl.js +16 -0
- package/dist/layers/map/vertex_lines.glsl.js.map +1 -0
- package/dist/layers/map/webworker.d.ts +4 -0
- package/dist/layers/map/webworker.js +362 -0
- package/dist/layers/map/webworker.js.map +1 -0
- package/dist/layers/northarrow/northArrow3DLayer.d.ts +20 -0
- package/dist/layers/northarrow/northArrow3DLayer.js +144 -0
- package/dist/layers/northarrow/northArrow3DLayer.js.map +1 -0
- package/dist/layers/northarrow/northarrow-fragment.glsl.d.ts +2 -0
- package/dist/layers/northarrow/northarrow-fragment.glsl.js +15 -0
- package/dist/layers/northarrow/northarrow-fragment.glsl.js.map +1 -0
- package/dist/layers/northarrow/northarrow-vertex.glsl.d.ts +2 -0
- package/dist/layers/northarrow/northarrow-vertex.glsl.js +14 -0
- package/dist/layers/northarrow/northarrow-vertex.glsl.js.map +1 -0
- package/dist/layers/piechart/fragment.glsl.d.ts +2 -0
- package/dist/layers/piechart/fragment.glsl.js +43 -0
- package/dist/layers/piechart/fragment.glsl.js.map +1 -0
- package/dist/layers/piechart/pieChartLayer.d.ts +40 -0
- package/dist/layers/piechart/pieChartLayer.js +174 -0
- package/dist/layers/piechart/pieChartLayer.js.map +1 -0
- package/dist/layers/piechart/vertex.glsl.d.ts +2 -0
- package/dist/layers/piechart/vertex.glsl.js +43 -0
- package/dist/layers/piechart/vertex.glsl.js.map +1 -0
- package/dist/layers/points/pointsLayer.d.ts +34 -0
- package/dist/layers/points/pointsLayer.js +78 -0
- package/dist/layers/points/pointsLayer.js.map +1 -0
- package/dist/layers/polylines/polylinesLayer.d.ts +50 -0
- package/dist/layers/polylines/polylinesLayer.js +157 -0
- package/dist/layers/polylines/polylinesLayer.js.map +1 -0
- package/dist/layers/selectable_geojson/selectableGeoJsonLayer.d.ts +6 -0
- package/dist/layers/selectable_geojson/selectableGeoJsonLayer.js +22 -0
- package/dist/layers/selectable_geojson/selectableGeoJsonLayer.js.map +1 -0
- package/dist/layers/shader_modules/decoder.d.ts +15 -0
- package/dist/layers/shader_modules/decoder.fs.glsl.d.ts +2 -0
- package/dist/layers/shader_modules/decoder.fs.glsl.js +40 -0
- package/dist/layers/shader_modules/decoder.fs.glsl.js.map +1 -0
- package/dist/layers/shader_modules/decoder.js +29 -0
- package/dist/layers/shader_modules/decoder.js.map +1 -0
- package/dist/layers/shader_modules/index.d.ts +1 -0
- package/dist/layers/shader_modules/index.js +2 -0
- package/dist/layers/shader_modules/index.js.map +1 -0
- package/dist/layers/terrain/map3DLayer.d.ts +42 -0
- package/dist/layers/terrain/map3DLayer.js +324 -0
- package/dist/layers/terrain/map3DLayer.js.map +1 -0
- package/dist/layers/terrain/terrainMapLayer.d.ts +45 -0
- package/dist/layers/terrain/terrainMapLayer.js +183 -0
- package/dist/layers/terrain/terrainMapLayer.js.map +1 -0
- package/dist/layers/terrain/terrainmap.fs.glsl.d.ts +2 -0
- package/dist/layers/terrain/terrainmap.fs.glsl.js +134 -0
- package/dist/layers/terrain/terrainmap.fs.glsl.js.map +1 -0
- package/dist/layers/triangle/fragment.fs.glsl.d.ts +2 -0
- package/dist/layers/triangle/fragment.fs.glsl.js +126 -0
- package/dist/layers/triangle/fragment.fs.glsl.js.map +1 -0
- package/dist/layers/triangle/fragment_lines.glsl.d.ts +2 -0
- package/dist/layers/triangle/fragment_lines.glsl.js +21 -0
- package/dist/layers/triangle/fragment_lines.glsl.js.map +1 -0
- package/dist/layers/triangle/privateTriangleLayer.d.ts +70 -0
- package/dist/layers/triangle/privateTriangleLayer.js +108 -0
- package/dist/layers/triangle/privateTriangleLayer.js.map +1 -0
- package/dist/layers/triangle/test_data/surfacePoints.d.ts +2 -0
- package/dist/layers/triangle/test_data/surfacePoints.js +4345 -0
- package/dist/layers/triangle/test_data/surfacePoints.js.map +1 -0
- package/dist/layers/triangle/test_data/surfaceTriangles.d.ts +2 -0
- package/dist/layers/triangle/test_data/surfaceTriangles.js +7393 -0
- package/dist/layers/triangle/test_data/surfaceTriangles.js.map +1 -0
- package/dist/layers/triangle/triangleLayer.d.ts +60 -0
- package/dist/layers/triangle/triangleLayer.js +170 -0
- package/dist/layers/triangle/triangleLayer.js.map +1 -0
- package/dist/layers/triangle/vertex.glsl.d.ts +2 -0
- package/dist/layers/triangle/vertex.glsl.js +35 -0
- package/dist/layers/triangle/vertex.glsl.js.map +1 -0
- package/dist/layers/triangle/vertex_lines.glsl.d.ts +2 -0
- package/dist/layers/triangle/vertex_lines.glsl.js +16 -0
- package/dist/layers/triangle/vertex_lines.glsl.js.map +1 -0
- package/dist/layers/triangle/webworker.d.ts +4 -0
- package/dist/layers/triangle/webworker.js +132 -0
- package/dist/layers/triangle/webworker.js.map +1 -0
- package/dist/layers/utils/layerTools.d.ts +52 -0
- package/dist/layers/utils/layerTools.js +91 -0
- package/dist/layers/utils/layerTools.js.map +1 -0
- package/dist/layers/utils/propertyMapTools.d.ts +8 -0
- package/dist/layers/utils/propertyMapTools.js +21 -0
- package/dist/layers/utils/propertyMapTools.js.map +1 -0
- package/dist/layers/wells/utils/spline.d.ts +28 -0
- package/dist/layers/wells/utils/spline.js +236 -0
- package/dist/layers/wells/utils/spline.js.map +1 -0
- package/dist/layers/wells/wellsLayer.d.ts +89 -0
- package/dist/layers/wells/wellsLayer.js +939 -0
- package/dist/layers/wells/wellsLayer.js.map +1 -0
- package/dist/package.json +35 -0
- package/dist/redux/actions.d.ts +1 -0
- package/dist/redux/actions.js +3 -0
- package/dist/redux/actions.js.map +1 -0
- package/dist/redux/reducer.d.ts +11 -0
- package/dist/redux/reducer.js +28 -0
- package/dist/redux/reducer.js.map +1 -0
- package/dist/redux/store.d.ts +4 -0
- package/dist/redux/store.js +10 -0
- package/dist/redux/store.js.map +1 -0
- package/dist/redux/types.d.ts +43 -0
- package/dist/redux/types.js +79 -0
- package/dist/redux/types.js.map +1 -0
- package/dist/storybook/SubsurfaceViewer.stories.d.ts +455 -0
- package/dist/storybook/SubsurfaceViewer.stories.js +537 -0
- package/dist/storybook/SubsurfaceViewer.stories.js.map +1 -0
- package/dist/storybook/components/InfoCard.stories.d.ts +48 -0
- package/dist/storybook/components/InfoCard.stories.js +36 -0
- package/dist/storybook/components/InfoCard.stories.js.map +1 -0
- package/dist/storybook/components/colorLegends/ContinuousLegend.stories.d.ts +31 -0
- package/dist/storybook/components/colorLegends/ContinuousLegend.stories.js +30 -0
- package/dist/storybook/components/colorLegends/ContinuousLegend.stories.js.map +1 -0
- package/dist/storybook/components/colorLegends/DiscreteLegend.stories.d.ts +31 -0
- package/dist/storybook/components/colorLegends/DiscreteLegend.stories.js +30 -0
- package/dist/storybook/components/colorLegends/DiscreteLegend.stories.js.map +1 -0
- package/dist/storybook/components/colorLegends/IndividualScaleForMap.stories.d.ts +20 -0
- package/dist/storybook/components/colorLegends/IndividualScaleForMap.stories.js +66 -0
- package/dist/storybook/components/colorLegends/IndividualScaleForMap.stories.js.map +1 -0
- package/dist/storybook/components/colorLegends/SingleScaleForMap.stories.d.ts +65 -0
- package/dist/storybook/components/colorLegends/SingleScaleForMap.stories.js +94 -0
- package/dist/storybook/components/colorLegends/SingleScaleForMap.stories.js.map +1 -0
- package/dist/storybook/components/settings/LayerSettingsButton.stories.d.ts +34 -0
- package/dist/storybook/components/settings/LayerSettingsButton.stories.js +31 -0
- package/dist/storybook/components/settings/LayerSettingsButton.stories.js.map +1 -0
- package/dist/storybook/components/settings/NumericInput.stories.d.ts +14 -0
- package/dist/storybook/components/settings/NumericInput.stories.js +15 -0
- package/dist/storybook/components/settings/NumericInput.stories.js.map +1 -0
- package/dist/storybook/components/settings/ToggleButton.stories.d.ts +13 -0
- package/dist/storybook/components/settings/ToggleButton.stories.js +14 -0
- package/dist/storybook/components/settings/ToggleButton.stories.js.map +1 -0
- package/dist/storybook/schemaValidation/sampleData.d.ts +122 -0
- package/dist/storybook/schemaValidation/sampleData.js +172 -0
- package/dist/storybook/schemaValidation/sampleData.js.map +1 -0
- package/dist/storybook/schemaValidation/schemaValidation.stories.d.ts +31 -0
- package/dist/storybook/schemaValidation/schemaValidation.stories.js +42 -0
- package/dist/storybook/schemaValidation/schemaValidation.stories.js.map +1 -0
- package/dist/utils/configuration.d.ts +631 -0
- package/dist/utils/configuration.js +36 -0
- package/dist/utils/configuration.js.map +1 -0
- package/dist/utils/fit-bounds.d.ts +15 -0
- package/dist/utils/fit-bounds.js +66 -0
- package/dist/utils/fit-bounds.js.map +1 -0
- package/dist/utils/measurement.d.ts +6 -0
- package/dist/utils/measurement.js +47 -0
- package/dist/utils/measurement.js.map +1 -0
- package/dist/utils/northArrow.d.ts +113 -0
- package/dist/utils/northArrow.js +5 -0
- package/dist/utils/northArrow.js.map +1 -0
- package/dist/utils/specExtractor.d.ts +3 -0
- package/dist/utils/specExtractor.js +24 -0
- package/dist/utils/specExtractor.js.map +1 -0
- package/dist/viewports/index.d.ts +1 -0
- package/dist/viewports/index.js +2 -0
- package/dist/viewports/index.js.map +1 -0
- package/dist/viewports/intersectionViewport.d.ts +35 -0
- package/dist/viewports/intersectionViewport.js +65 -0
- package/dist/viewports/intersectionViewport.js.map +1 -0
- package/dist/views/index.d.ts +1 -0
- package/dist/views/index.js +2 -0
- package/dist/views/index.js.map +1 -0
- package/dist/views/intersectionView.d.ts +18 -0
- package/dist/views/intersectionView.js +17 -0
- package/dist/views/intersectionView.js.map +1 -0
- package/package.json +35 -0
- package/src/DashSubsurfaceViewer.tsx +270 -0
- package/src/SubsurfaceViewer.stories.tsx +449 -0
- package/src/SubsurfaceViewer.test.tsx +98 -0
- package/src/SubsurfaceViewer.tsx +356 -0
- package/src/__snapshots__/SubsurfaceViewer.test.tsx.snap +178 -0
- package/src/assets/glTF/north_arrow/scene.bin +0 -0
- package/src/assets/glTF/north_arrow/scene.gltf +315 -0
- package/src/assets/glTF/north_arrow/textures/Arrow5_baseColor.png +0 -0
- package/src/assets/glTF/north_arrow/textures/Arrow5_metallicRoughness.png +0 -0
- package/src/assets/glTF/north_arrow/textures/Arrow5_normal.png +0 -0
- package/src/components/ColorLegend.test.tsx +32 -0
- package/src/components/ColorLegend.tsx +80 -0
- package/src/components/ColorLegends.test.tsx +97 -0
- package/src/components/ColorLegends.tsx +46 -0
- package/src/components/DistanceScale.stories.tsx +28 -0
- package/src/components/DistanceScale.test.tsx +36 -0
- package/src/components/DistanceScale.tsx +84 -0
- package/src/components/InfoCard.test.tsx +110 -0
- package/src/components/InfoCard.tsx +263 -0
- package/src/components/Map.test.tsx +142 -0
- package/src/components/Map.tsx +1435 -0
- package/src/components/StatusIndicator.test.tsx +14 -0
- package/src/components/StatusIndicator.tsx +38 -0
- package/src/components/ViewAnnotation.tsx +16 -0
- package/src/components/ViewFooter.test.tsx +12 -0
- package/src/components/ViewFooter.tsx +30 -0
- package/src/components/__snapshots__/ColorLegends.test.tsx.snap +15 -0
- package/src/components/__snapshots__/DistanceScale.test.tsx.snap +33 -0
- package/src/components/__snapshots__/InfoCard.test.tsx.snap +561 -0
- package/src/components/__snapshots__/Map.test.tsx.snap +119 -0
- package/src/components/__snapshots__/StatusIndicator.test.tsx.snap +3 -0
- package/src/components/__snapshots__/ViewFooter.test.tsx.snap +7 -0
- package/src/components/settings/DrawModeSelector.test.tsx +45 -0
- package/src/components/settings/DrawModeSelector.tsx +58 -0
- package/src/components/settings/DrawModeSelector_performance.test.tsx +35 -0
- package/src/components/settings/LayerProperty.test.tsx +35 -0
- package/src/components/settings/LayerProperty.tsx +153 -0
- package/src/components/settings/LayerProperty_performance.test.tsx +39 -0
- package/src/components/settings/LayerSettingsButton.test.tsx +133 -0
- package/src/components/settings/LayerSettingsButton.tsx +95 -0
- package/src/components/settings/LayersButton.test.tsx +102 -0
- package/src/components/settings/LayersButton.tsx +97 -0
- package/src/components/settings/NumericInput.test.tsx +25 -0
- package/src/components/settings/NumericInput.tsx +67 -0
- package/src/components/settings/Settings.tsx +71 -0
- package/src/components/settings/SliderInput.test.tsx +28 -0
- package/src/components/settings/SliderInput.tsx +71 -0
- package/src/components/settings/ToggleButton.test.tsx +25 -0
- package/src/components/settings/ToggleButton.tsx +53 -0
- package/src/components/settings/__snapshots__/DrawModeSelector.test.tsx.snap +124 -0
- package/src/components/settings/__snapshots__/LayerProperty.test.tsx.snap +124 -0
- package/src/components/settings/__snapshots__/LayerSettingsButton.test.tsx.snap +36 -0
- package/src/components/settings/__snapshots__/LayersButton.test.tsx.snap +83 -0
- package/src/components/settings/__snapshots__/NumericInput.test.tsx.snap +123 -0
- package/src/components/settings/__snapshots__/SliderInput.test.tsx.snap +244 -0
- package/src/components/settings/__snapshots__/ToggleButton.test.tsx.snap +182 -0
- package/src/custom.d.ts +9 -0
- package/src/index.ts +5 -0
- package/src/inputSchema/ColorTables.json +51 -0
- package/src/inputSchema/FaultPolygons.json +80 -0
- package/src/inputSchema/Grid.json +39 -0
- package/src/inputSchema/PieChart.json +72 -0
- package/src/inputSchema/WellLog.json +126 -0
- package/src/inputSchema/WellLogTemplate.json +136 -0
- package/src/inputSchema/WellLogs.json +5 -0
- package/src/inputSchema/Wells.json +106 -0
- package/src/inputSchema/schemaValidationUtil.tsx +55 -0
- package/src/inputSchema/validator.tsx +72 -0
- package/src/inputSchema/wellCompletions.json +108 -0
- package/src/layers/BoxSelectionLayer/boxSelectionLayer.stories.tsx +172 -0
- package/src/layers/BoxSelectionLayer/boxSelectionLayer.tsx +136 -0
- package/src/layers/axes/axes-fragment.glsl.ts +15 -0
- package/src/layers/axes/axesLayer.stories.tsx +87 -0
- package/src/layers/axes/axesLayer.ts +692 -0
- package/src/layers/axes/boxLayer.ts +71 -0
- package/src/layers/axes/grid-vertex.glsl.ts +14 -0
- package/src/layers/axes2d/axes2DLayer.stories.tsx +150 -0
- package/src/layers/axes2d/axes2DLayer.ts +841 -0
- package/src/layers/axes2d/font-atlas.png +0 -0
- package/src/layers/axes2d/label-fragment.glsl.js +37 -0
- package/src/layers/axes2d/label-vertex.glsl.js +20 -0
- package/src/layers/axes2d/line-fragment.glsl.js +14 -0
- package/src/layers/axes2d/line-vertex.glsl.js +13 -0
- package/src/layers/colormap/colormap.fs.glsl.ts +42 -0
- package/src/layers/colormap/colormapLayer.ts +247 -0
- package/src/layers/drawing/drawingLayer.tsx +256 -0
- package/src/layers/fault_polygons/faultPolygonsLayer.ts +54 -0
- package/src/layers/grid3d/fragment.fs.glsl.ts +109 -0
- package/src/layers/grid3d/fragment_lines.glsl.ts +21 -0
- package/src/layers/grid3d/grid3dLayer.stories.tsx +172 -0
- package/src/layers/grid3d/grid3dLayer.ts +248 -0
- package/src/layers/grid3d/privateLayer.ts +292 -0
- package/src/layers/grid3d/vertex.glsl.ts +43 -0
- package/src/layers/grid3d/vertex_lines.glsl.ts +15 -0
- package/src/layers/grid3d/webworker.ts +173 -0
- package/src/layers/hillshading2d/hillshading2d.fs.glsl.ts +62 -0
- package/src/layers/hillshading2d/hillshading2dLayer.ts +172 -0
- package/src/layers/index.ts +35 -0
- package/src/layers/intersection/intersectionView.stories.tsx +294 -0
- package/src/layers/intersection/unfoldedGeoJsonLayer.ts +92 -0
- package/src/layers/map/fragment.fs.glsl.ts +127 -0
- package/src/layers/map/fragment_lines.glsl.ts +21 -0
- package/src/layers/map/mapLayer.stories.tsx +1369 -0
- package/src/layers/map/mapLayer.ts +470 -0
- package/src/layers/map/privateMapLayer.ts +317 -0
- package/src/layers/map/vertex.glsl.ts +45 -0
- package/src/layers/map/vertex_lines.glsl.ts +15 -0
- package/src/layers/map/webworker.ts +479 -0
- package/src/layers/northarrow/northArrow.stories.tsx +108 -0
- package/src/layers/northarrow/northArrow3DLayer.ts +204 -0
- package/src/layers/northarrow/northarrow-fragment.glsl.js +14 -0
- package/src/layers/northarrow/northarrow-vertex.glsl.js +13 -0
- package/src/layers/piechart/fragment.glsl.js +42 -0
- package/src/layers/piechart/pieChartLayer.ts +246 -0
- package/src/layers/piechart/vertex.glsl.js +42 -0
- package/src/layers/points/pointsLayer.stories.tsx +141 -0
- package/src/layers/points/pointsLayer.ts +143 -0
- package/src/layers/polylines/polylinesLayer.stories.tsx +144 -0
- package/src/layers/polylines/polylinesLayer.ts +263 -0
- package/src/layers/selectable_geojson/selectableGeoJsonLayer.ts +25 -0
- package/src/layers/shader_modules/decoder.fs.glsl.ts +41 -0
- package/src/layers/shader_modules/decoder.ts +46 -0
- package/src/layers/shader_modules/index.ts +1 -0
- package/src/layers/terrain/map3DLayer.stories.tsx +340 -0
- package/src/layers/terrain/map3DLayer.ts +556 -0
- package/src/layers/terrain/terrainMapLayer.ts +334 -0
- package/src/layers/terrain/terrainmap.fs.glsl.ts +134 -0
- package/src/layers/triangle/fragment.fs.glsl.ts +126 -0
- package/src/layers/triangle/fragment_lines.glsl.ts +21 -0
- package/src/layers/triangle/privateTriangleLayer.ts +203 -0
- package/src/layers/triangle/test_data/surfacePoints.ts +4344 -0
- package/src/layers/triangle/test_data/surfaceTriangles.ts +7392 -0
- package/src/layers/triangle/triangleLayer.stories.tsx +191 -0
- package/src/layers/triangle/triangleLayer.ts +273 -0
- package/src/layers/triangle/vertex.glsl.ts +35 -0
- package/src/layers/triangle/vertex_lines.glsl.ts +15 -0
- package/src/layers/triangle/webworker.ts +165 -0
- package/src/layers/utils/glsl.d.ts +4 -0
- package/src/layers/utils/layerTools.ts +182 -0
- package/src/layers/utils/propertyMapTools.ts +43 -0
- package/src/layers/wells/utils/spline.ts +318 -0
- package/src/layers/wells/wellsLayer.stories.tsx +625 -0
- package/src/layers/wells/wellsLayer.ts +1377 -0
- package/src/redux/actions.ts +8 -0
- package/src/redux/reducer.ts +43 -0
- package/src/redux/store.ts +15 -0
- package/src/redux/types.ts +114 -0
- package/src/storybook/SubsurfaceViewer.stories.jsx +644 -0
- package/src/storybook/components/InfoCard.stories.jsx +39 -0
- package/src/storybook/components/colorLegends/ContinuousLegend.stories.jsx +32 -0
- package/src/storybook/components/colorLegends/DiscreteLegend.stories.jsx +33 -0
- package/src/storybook/components/colorLegends/IndividualScaleForMap.stories.jsx +99 -0
- package/src/storybook/components/colorLegends/SingleScaleForMap.stories.jsx +120 -0
- package/src/storybook/components/settings/LayerSettingsButton.stories.jsx +34 -0
- package/src/storybook/components/settings/NumericInput.stories.jsx +17 -0
- package/src/storybook/components/settings/ToggleButton.stories.jsx +16 -0
- package/src/storybook/schemaValidation/sampleData.js +177 -0
- package/src/storybook/schemaValidation/schemaValidation.stories.jsx +91 -0
- package/src/test/TestWrapper.tsx +13 -0
- package/src/utils/configuration.ts +61 -0
- package/src/utils/fit-bounds.js +85 -0
- package/src/utils/measurement.ts +61 -0
- package/src/utils/northArrow.ts +4 -0
- package/src/utils/specExtractor.ts +36 -0
- package/src/viewports/index.js +1 -0
- package/src/viewports/intersectionViewport.ts +137 -0
- package/src/views/index.js +1 -0
- package/src/views/intersectionView.ts +38 -0
- package/tsconfig.json +7 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { COORDINATE_SYSTEM, Layer, picking, project, phongLighting, } from "@deck.gl/core/typed";
|
|
2
|
+
import { createPropertyData, } from "../utils/layerTools";
|
|
3
|
+
import { Model, Geometry } from "@luma.gl/engine";
|
|
4
|
+
import vsShader from "./vertex.glsl";
|
|
5
|
+
import fsShader from "./fragment.fs.glsl";
|
|
6
|
+
import vsLineShader from "./vertex_lines.glsl";
|
|
7
|
+
import fsLineShader from "./fragment_lines.glsl";
|
|
8
|
+
import { rgbValues } from "@emerson-eps/color-tables/";
|
|
9
|
+
import { createDefaultContinuousColorScale } from "@emerson-eps/color-tables/dist/component/Utils/legendCommonFunction";
|
|
10
|
+
import { Texture2D } from "@luma.gl/webgl";
|
|
11
|
+
import GL from "@luma.gl/constants";
|
|
12
|
+
const DEFAULT_TEXTURE_PARAMETERS = {
|
|
13
|
+
[GL.TEXTURE_MIN_FILTER]: GL.LINEAR_MIPMAP_LINEAR,
|
|
14
|
+
[GL.TEXTURE_MAG_FILTER]: GL.LINEAR,
|
|
15
|
+
[GL.TEXTURE_WRAP_S]: GL.CLAMP_TO_EDGE,
|
|
16
|
+
[GL.TEXTURE_WRAP_T]: GL.CLAMP_TO_EDGE,
|
|
17
|
+
};
|
|
18
|
+
function getImageData(colorMapName, colorTables, colorMapFunction) {
|
|
19
|
+
const isColorMapFunctionDefined = typeof colorMapFunction !== "undefined";
|
|
20
|
+
const isColorMapNameDefined = !!colorMapName;
|
|
21
|
+
const defaultColorMap = createDefaultContinuousColorScale;
|
|
22
|
+
let colorMap = defaultColorMap();
|
|
23
|
+
if (isColorMapFunctionDefined) {
|
|
24
|
+
colorMap =
|
|
25
|
+
typeof colorMapFunction === "function"
|
|
26
|
+
? colorMapFunction
|
|
27
|
+
: (() => colorMapFunction);
|
|
28
|
+
}
|
|
29
|
+
else if (isColorMapNameDefined) {
|
|
30
|
+
colorMap = (value) => rgbValues(value, colorMapName, colorTables);
|
|
31
|
+
}
|
|
32
|
+
const data = new Uint8Array(256 * 3);
|
|
33
|
+
for (let i = 0; i < 256; i++) {
|
|
34
|
+
const value = i / 255.0;
|
|
35
|
+
const color = colorMap ? colorMap(value) : [0, 0, 0];
|
|
36
|
+
if (color) {
|
|
37
|
+
data[3 * i + 0] = color[0];
|
|
38
|
+
data[3 * i + 1] = color[1];
|
|
39
|
+
data[3 * i + 2] = color[2];
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
return data ? data : [0, 0, 0];
|
|
43
|
+
}
|
|
44
|
+
const defaultProps = {
|
|
45
|
+
data: ["dummy"],
|
|
46
|
+
contours: [-1, -1],
|
|
47
|
+
isContoursDepth: true,
|
|
48
|
+
gridLines: false,
|
|
49
|
+
colorMapName: "",
|
|
50
|
+
coordinateSystem: COORDINATE_SYSTEM.CARTESIAN,
|
|
51
|
+
propertyValueRange: [0.0, 1.0],
|
|
52
|
+
meshValueRange: [0.0, 1.0],
|
|
53
|
+
depthTest: true,
|
|
54
|
+
};
|
|
55
|
+
// This is a private layer used only by the composite Map3DLayer
|
|
56
|
+
export default class privateMapLayer extends Layer {
|
|
57
|
+
initializeState(context) {
|
|
58
|
+
const { gl } = context;
|
|
59
|
+
const [model_mesh, mesh_lines_model] = this._getModels(gl);
|
|
60
|
+
this.setState({ models: [model_mesh, mesh_lines_model] });
|
|
61
|
+
}
|
|
62
|
+
shouldUpdateState({ props, oldProps, context, changeFlags, }) {
|
|
63
|
+
return (super.shouldUpdateState({
|
|
64
|
+
props,
|
|
65
|
+
oldProps,
|
|
66
|
+
context,
|
|
67
|
+
changeFlags,
|
|
68
|
+
}) || changeFlags.propsOrDataChanged);
|
|
69
|
+
}
|
|
70
|
+
updateState({ context }) {
|
|
71
|
+
this.initializeState(context);
|
|
72
|
+
}
|
|
73
|
+
//eslint-disable-next-line
|
|
74
|
+
_getModels(gl) {
|
|
75
|
+
// MESH MODEL
|
|
76
|
+
const mesh_model = new Model(gl, {
|
|
77
|
+
id: `${this.props.id}-mesh`,
|
|
78
|
+
vs: vsShader,
|
|
79
|
+
fs: fsShader,
|
|
80
|
+
geometry: new Geometry({
|
|
81
|
+
drawMode: this.props.mesh.drawMode,
|
|
82
|
+
attributes: {
|
|
83
|
+
positions: this.props.mesh.attributes.positions,
|
|
84
|
+
normals: this.props.mesh.attributes.normals,
|
|
85
|
+
properties: this.props.mesh.attributes.properties,
|
|
86
|
+
vertex_indexs: this.props.mesh.attributes.vertex_indexs,
|
|
87
|
+
},
|
|
88
|
+
vertexCount: this.props.mesh.vertexCount,
|
|
89
|
+
indices: this.props.mesh.indices,
|
|
90
|
+
}),
|
|
91
|
+
modules: [project, picking, phongLighting],
|
|
92
|
+
isInstanced: false, // This only works when set to false.
|
|
93
|
+
});
|
|
94
|
+
// MESH LINES
|
|
95
|
+
const mesh_lines_model = new Model(gl, {
|
|
96
|
+
id: `${this.props.id}-lines`,
|
|
97
|
+
vs: vsLineShader,
|
|
98
|
+
fs: fsLineShader,
|
|
99
|
+
geometry: new Geometry(this.props.meshLines),
|
|
100
|
+
modules: [project, picking],
|
|
101
|
+
isInstanced: false,
|
|
102
|
+
});
|
|
103
|
+
return [mesh_model, mesh_lines_model];
|
|
104
|
+
}
|
|
105
|
+
// Signature from the base class, eslint doesn't like the any type.
|
|
106
|
+
// eslint-disable-next-line
|
|
107
|
+
draw(args) {
|
|
108
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
109
|
+
if (!this.state["models"]) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const { uniforms, context } = args;
|
|
113
|
+
const { gl } = context;
|
|
114
|
+
const contourReferencePoint = (_a = this.props.contours[0]) !== null && _a !== void 0 ? _a : -1.0;
|
|
115
|
+
const contourInterval = (_b = this.props.contours[1]) !== null && _b !== void 0 ? _b : -1.0;
|
|
116
|
+
const isContoursDepth = this.props.isContoursDepth;
|
|
117
|
+
const [model_mesh, mesh_lines_model] = this.state["models"];
|
|
118
|
+
const valueRangeMin = (_c = this.props.propertyValueRange[0]) !== null && _c !== void 0 ? _c : 0.0;
|
|
119
|
+
const valueRangeMax = (_d = this.props.propertyValueRange[1]) !== null && _d !== void 0 ? _d : 1.0;
|
|
120
|
+
// If specified color map will extend from colorMapRangeMin to colorMapRangeMax.
|
|
121
|
+
// Otherwise it will extend from valueRangeMin to valueRangeMax.
|
|
122
|
+
const colorMapRangeMin = (_f = (_e = this.props.colorMapRange) === null || _e === void 0 ? void 0 : _e[0]) !== null && _f !== void 0 ? _f : valueRangeMin;
|
|
123
|
+
const colorMapRangeMax = (_h = (_g = this.props.colorMapRange) === null || _g === void 0 ? void 0 : _g[1]) !== null && _h !== void 0 ? _h : valueRangeMax;
|
|
124
|
+
const isClampColor = this.props.colorMapClampColor !== undefined &&
|
|
125
|
+
this.props.colorMapClampColor !== true &&
|
|
126
|
+
this.props.colorMapClampColor !== false;
|
|
127
|
+
let colorMapClampColor = isClampColor
|
|
128
|
+
? this.props.colorMapClampColor
|
|
129
|
+
: [0, 0, 0];
|
|
130
|
+
// Normalize to [0,1] range.
|
|
131
|
+
colorMapClampColor = colorMapClampColor.map((x) => (x !== null && x !== void 0 ? x : 0) / 255);
|
|
132
|
+
const isColorMapClampColorTransparent = this.props.colorMapClampColor === false;
|
|
133
|
+
const smoothShading = this.props.smoothShading;
|
|
134
|
+
gl.enable(GL.POLYGON_OFFSET_FILL);
|
|
135
|
+
if (!this.props.depthTest) {
|
|
136
|
+
gl.disable(GL.DEPTH_TEST);
|
|
137
|
+
}
|
|
138
|
+
gl.polygonOffset(1, 1);
|
|
139
|
+
model_mesh
|
|
140
|
+
.setUniforms(Object.assign(Object.assign({}, uniforms), { contourReferencePoint,
|
|
141
|
+
contourInterval,
|
|
142
|
+
isContoursDepth, colormap: new Texture2D(context.gl, {
|
|
143
|
+
width: 256,
|
|
144
|
+
height: 1,
|
|
145
|
+
format: GL.RGB,
|
|
146
|
+
data: getImageData(this.props.colorMapName, this.context.userData
|
|
147
|
+
.colorTables, this.props.colorMapFunction),
|
|
148
|
+
parameters: DEFAULT_TEXTURE_PARAMETERS,
|
|
149
|
+
}), valueRangeMin,
|
|
150
|
+
valueRangeMax,
|
|
151
|
+
colorMapRangeMin,
|
|
152
|
+
colorMapRangeMax,
|
|
153
|
+
colorMapClampColor,
|
|
154
|
+
isColorMapClampColorTransparent,
|
|
155
|
+
isClampColor,
|
|
156
|
+
smoothShading }))
|
|
157
|
+
.draw();
|
|
158
|
+
gl.disable(GL.POLYGON_OFFSET_FILL);
|
|
159
|
+
if (!this.props.depthTest) {
|
|
160
|
+
gl.enable(GL.DEPTH_TEST);
|
|
161
|
+
}
|
|
162
|
+
if (this.props.gridLines) {
|
|
163
|
+
mesh_lines_model.draw();
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
decodePickingColor() {
|
|
167
|
+
return 0;
|
|
168
|
+
}
|
|
169
|
+
getPickingInfo({ info }) {
|
|
170
|
+
if (!info.color) {
|
|
171
|
+
return info;
|
|
172
|
+
}
|
|
173
|
+
const layer_properties = [];
|
|
174
|
+
// Note these colors are in the 0-255 range.
|
|
175
|
+
const r = info.color[0];
|
|
176
|
+
const g = info.color[1];
|
|
177
|
+
const b = info.color[2];
|
|
178
|
+
const vertexIndex = 256 * 256 * r + 256 * g + b;
|
|
179
|
+
const vertexs = this.props.mesh.attributes.positions.value;
|
|
180
|
+
const depth = -vertexs[3 * vertexIndex + 2];
|
|
181
|
+
layer_properties.push(createPropertyData("Depth", depth));
|
|
182
|
+
const properties = this.props.mesh.attributes.properties.value;
|
|
183
|
+
const property = properties[vertexIndex];
|
|
184
|
+
layer_properties.push(createPropertyData("Property", property));
|
|
185
|
+
return Object.assign(Object.assign({}, info), { properties: layer_properties });
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
privateMapLayer.layerName = "privateMapLayer";
|
|
189
|
+
privateMapLayer.defaultProps = defaultProps;
|
|
190
|
+
//# sourceMappingURL=privateMapLayer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"privateMapLayer.js","sourceRoot":"","sources":["../../../src/layers/map/privateMapLayer.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,iBAAiB,EACjB,KAAK,EACL,OAAO,EACP,OAAO,EACP,aAAa,GAIhB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACH,kBAAkB,GAGrB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAGlD,OAAO,QAAQ,MAAM,eAAe,CAAC;AACrC,OAAO,QAAQ,MAAM,oBAAoB,CAAC;AAC1C,OAAO,YAAY,MAAM,qBAAqB,CAAC;AAC/C,OAAO,YAAY,MAAM,uBAAuB,CAAC;AAEjD,OAAO,EAAoB,SAAS,EAAE,MAAM,4BAA4B,CAAC;AACzE,OAAO,EAAE,iCAAiC,EAAE,MAAM,qEAAqE,CAAC;AACxH,OAAO,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC3C,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAEpC,MAAM,0BAA0B,GAAG;IAC/B,CAAC,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,CAAC,oBAAoB;IAChD,CAAC,EAAE,CAAC,kBAAkB,CAAC,EAAE,EAAE,CAAC,MAAM;IAClC,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,aAAa;IACrC,CAAC,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE,CAAC,aAAa;CACxC,CAAC;AAgCF,SAAS,YAAY,CACjB,YAAoB,EACpB,WAA6B,EAC7B,gBAAkD;IAIlD,MAAM,yBAAyB,GAAG,OAAO,gBAAgB,KAAK,WAAW,CAAC;I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AAC;CACJ;AAED,eAAe,CAAC,SAAS,GAAG,iBAAiB,CAAC;AAC9C,eAAe,CAAC,YAAY,GAAG,YAAY,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const vsShader = "#version 300 es\n#define SHADER_NAME vertex-shader\n\nprecision highp float;\n\n// Primitive attributes\nin vec3 positions;\nin float properties;\nin vec3 normals;\nin vec3 colors;\n\nin int vertex_indexs;\nflat out int vertex_indexs_;\n\n\n// Outputs to fragment shader\nout vec2 vTexCoord;\nout vec3 cameraPosition;\nout vec3 normals_commonspace;\nout vec4 position_commonspace;\nout vec4 vColor;\nout vec3 worldPos;\nout float property;\n\n\nvoid main(void) {\n cameraPosition = project_uCameraPosition;\n\n worldPos = positions;\n\n normals_commonspace = normals;\n\n vertex_indexs_ = vertex_indexs;\n\n vColor = vec4(colors.rgb, 1.0);\n\n property = properties;\n\n position_commonspace = vec4(project_position(positions), 0.0);\n gl_Position = project_common_position_to_clipspace(position_commonspace);\n}\n";
|
|
2
|
+
export default vsShader;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const vsShader = `\
|
|
2
|
+
#version 300 es
|
|
3
|
+
#define SHADER_NAME vertex-shader
|
|
4
|
+
|
|
5
|
+
precision highp float;
|
|
6
|
+
|
|
7
|
+
// Primitive attributes
|
|
8
|
+
in vec3 positions;
|
|
9
|
+
in float properties;
|
|
10
|
+
in vec3 normals;
|
|
11
|
+
in vec3 colors;
|
|
12
|
+
|
|
13
|
+
in int vertex_indexs;
|
|
14
|
+
flat out int vertex_indexs_;
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
// Outputs to fragment shader
|
|
18
|
+
out vec2 vTexCoord;
|
|
19
|
+
out vec3 cameraPosition;
|
|
20
|
+
out vec3 normals_commonspace;
|
|
21
|
+
out vec4 position_commonspace;
|
|
22
|
+
out vec4 vColor;
|
|
23
|
+
out vec3 worldPos;
|
|
24
|
+
out float property;
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
void main(void) {
|
|
28
|
+
cameraPosition = project_uCameraPosition;
|
|
29
|
+
|
|
30
|
+
worldPos = positions;
|
|
31
|
+
|
|
32
|
+
normals_commonspace = normals;
|
|
33
|
+
|
|
34
|
+
vertex_indexs_ = vertex_indexs;
|
|
35
|
+
|
|
36
|
+
vColor = vec4(colors.rgb, 1.0);
|
|
37
|
+
|
|
38
|
+
property = properties;
|
|
39
|
+
|
|
40
|
+
position_commonspace = vec4(project_position(positions), 0.0);
|
|
41
|
+
gl_Position = project_common_position_to_clipspace(position_commonspace);
|
|
42
|
+
}
|
|
43
|
+
`;
|
|
44
|
+
export default vsShader;
|
|
45
|
+
//# sourceMappingURL=vertex.glsl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertex.glsl.js","sourceRoot":"","sources":["../../../src/layers/map/vertex.glsl.ts"],"names":[],"mappings":"AAAA,MAAM,QAAQ,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0ChB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
declare const _default: "#version 300 es\n#define SHADER_NAME vertex-lines-shader\n\nprecision highp float;\n\nin vec3 positions;\n\nout vec4 position_commonspace;\n\nvoid main(void) {\n vec3 position_commonspace = project_position(positions);\n gl_Position = project_common_position_to_clipspace(vec4(position_commonspace, 0.0));\n}\n";
|
|
2
|
+
export default _default;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export default `\
|
|
2
|
+
#version 300 es
|
|
3
|
+
#define SHADER_NAME vertex-lines-shader
|
|
4
|
+
|
|
5
|
+
precision highp float;
|
|
6
|
+
|
|
7
|
+
in vec3 positions;
|
|
8
|
+
|
|
9
|
+
out vec4 position_commonspace;
|
|
10
|
+
|
|
11
|
+
void main(void) {
|
|
12
|
+
vec3 position_commonspace = project_position(positions);
|
|
13
|
+
gl_Position = project_common_position_to_clipspace(vec4(position_commonspace, 0.0));
|
|
14
|
+
}
|
|
15
|
+
`;
|
|
16
|
+
//# sourceMappingURL=vertex_lines.glsl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vertex_lines.glsl.js","sourceRoot":"","sources":["../../../src/layers/map/vertex_lines.glsl.ts"],"names":[],"mappings":"AAAA,eAAe;;;;;;;;;;;;;;CAcd,CAAC"}
|
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
export function makeFullMesh(e) {
|
|
2
|
+
const params = e.data;
|
|
3
|
+
// Keep
|
|
4
|
+
//const t0 = performance.now();
|
|
5
|
+
const meshData = params.meshData;
|
|
6
|
+
const propertiesData = params.propertiesData;
|
|
7
|
+
const isMesh = params.isMesh;
|
|
8
|
+
const frame = params.frame;
|
|
9
|
+
const smoothShading = params.smoothShading;
|
|
10
|
+
function getFloat32ArrayMinMax(data) {
|
|
11
|
+
let max = -99999999;
|
|
12
|
+
let min = 99999999;
|
|
13
|
+
for (let i = 0; i < data.length; i++) {
|
|
14
|
+
max = data[i] > max ? data[i] : max;
|
|
15
|
+
min = data[i] < min ? data[i] : min;
|
|
16
|
+
}
|
|
17
|
+
return [min, max];
|
|
18
|
+
}
|
|
19
|
+
function crossProduct(a, b) {
|
|
20
|
+
const c = [
|
|
21
|
+
a[1] * b[2] - a[2] * b[1],
|
|
22
|
+
a[2] * b[0] - a[0] * b[2],
|
|
23
|
+
a[0] * b[1] - a[1] * b[0],
|
|
24
|
+
];
|
|
25
|
+
return c;
|
|
26
|
+
}
|
|
27
|
+
function normalize(a) {
|
|
28
|
+
const L = Math.sqrt(a[0] * a[0] + a[1] * a[1] + a[2] * a[2]);
|
|
29
|
+
a[0] /= L;
|
|
30
|
+
a[1] /= L;
|
|
31
|
+
a[2] /= L;
|
|
32
|
+
}
|
|
33
|
+
function calcNormal(w, h, nx, ny, isMesh, smoothShading, meshData, ox, oy) {
|
|
34
|
+
if (!smoothShading) {
|
|
35
|
+
return [1, 1, 1];
|
|
36
|
+
}
|
|
37
|
+
if (!isMesh) {
|
|
38
|
+
return [0, 0, 1];
|
|
39
|
+
}
|
|
40
|
+
const i0 = h * nx + w;
|
|
41
|
+
const i1 = h * nx + (w - 1);
|
|
42
|
+
const i2 = (h + 1) * nx + w;
|
|
43
|
+
const i3 = h * nx + (w + 1);
|
|
44
|
+
const i4 = (h - 1) * nx + w;
|
|
45
|
+
const i0_act = !isNaN(meshData[i0]); // eslint-disable-line
|
|
46
|
+
const i1_act = (w - 1) >= 0 && !isNaN(meshData[i1]); // eslint-disable-line
|
|
47
|
+
const i2_act = (h + 1) < ny && !isNaN(meshData[i2]); // eslint-disable-line
|
|
48
|
+
const i3_act = (w + 1) < nx && !isNaN(meshData[i3]); // eslint-disable-line
|
|
49
|
+
const i4_act = (h - 1) >= 0 && !isNaN(meshData[i4]); // eslint-disable-line
|
|
50
|
+
const noNormal = [0, 0, 1]; // signals a normal could not be calculated.
|
|
51
|
+
if (!i0_act) {
|
|
52
|
+
return noNormal;
|
|
53
|
+
}
|
|
54
|
+
const hh = ny - 1 - h; // Note use hh for h for getting y values.
|
|
55
|
+
const p0 = [ox + w * dx, oy + hh * dy, i0_act ? -meshData[i0] : 0]; // eslint-disable-line
|
|
56
|
+
const p1 = [ox + (w - 1) * dx, oy + hh * dy, i1_act ? -meshData[i1] : 0]; // eslint-disable-line
|
|
57
|
+
const p2 = [ox + w * dx, oy + (hh + 1) * dy, i2_act ? -meshData[i2] : 0]; // eslint-disable-line
|
|
58
|
+
const p3 = [ox + (w + 1) * dx, oy + hh * dy, i3_act ? -meshData[i3] : 0]; // eslint-disable-line
|
|
59
|
+
const p4 = [ox + w * dx, oy + (hh - 1) * dy, i4_act ? -meshData[i4] : 0]; // eslint-disable-line
|
|
60
|
+
const v1 = [p1[0] - p0[0], p1[1] - p0[1], p1[2] - p0[2]];
|
|
61
|
+
const v2 = [p2[0] - p0[0], p2[1] - p0[1], p2[2] - p0[2]];
|
|
62
|
+
const v3 = [p3[0] - p0[0], p3[1] - p0[1], p3[2] - p0[2]];
|
|
63
|
+
const v4 = [p4[0] - p0[0], p4[1] - p0[1], p4[2] - p0[2]];
|
|
64
|
+
// Estimating a normal vector at p0:
|
|
65
|
+
// Take cross product of vectors v1, v2,
|
|
66
|
+
// Do this for all 4 quadrants.
|
|
67
|
+
// The resulting normal will be the mean of these four normals.
|
|
68
|
+
// p2
|
|
69
|
+
// |
|
|
70
|
+
// p1 - p0 - p3
|
|
71
|
+
// |
|
|
72
|
+
// p4
|
|
73
|
+
const normals = [];
|
|
74
|
+
if (i1_act && i2_act) {
|
|
75
|
+
const normal = crossProduct(v2, v1);
|
|
76
|
+
normals.push(normal);
|
|
77
|
+
}
|
|
78
|
+
if (i2_act && i3_act) {
|
|
79
|
+
const normal = crossProduct(v3, v2);
|
|
80
|
+
normals.push(normal);
|
|
81
|
+
}
|
|
82
|
+
if (i3_act && i4_act) {
|
|
83
|
+
const normal = crossProduct(v4, v3);
|
|
84
|
+
normals.push(normal);
|
|
85
|
+
}
|
|
86
|
+
if (i4_act && i1_act) {
|
|
87
|
+
const normal = crossProduct(v1, v4);
|
|
88
|
+
normals.push(normal);
|
|
89
|
+
}
|
|
90
|
+
if (normals.length === 0) {
|
|
91
|
+
return noNormal;
|
|
92
|
+
}
|
|
93
|
+
const mean = normals[0];
|
|
94
|
+
for (let i = 1; i < normals.length; i++) {
|
|
95
|
+
mean[0] += normals[i][0];
|
|
96
|
+
mean[1] += normals[i][1];
|
|
97
|
+
mean[2] += normals[i][2];
|
|
98
|
+
}
|
|
99
|
+
normalize(mean);
|
|
100
|
+
return mean;
|
|
101
|
+
}
|
|
102
|
+
const meshZValueRange = getFloat32ArrayMinMax(meshData);
|
|
103
|
+
const propertyValueRange = getFloat32ArrayMinMax(propertiesData);
|
|
104
|
+
// Dimensions.
|
|
105
|
+
const ox = frame.origin[0];
|
|
106
|
+
const oy = frame.origin[1];
|
|
107
|
+
const dx = frame.increment[0];
|
|
108
|
+
const dy = frame.increment[1];
|
|
109
|
+
const nx = frame.count[0];
|
|
110
|
+
const ny = frame.count[1];
|
|
111
|
+
const propLength = propertiesData.length;
|
|
112
|
+
const isCellCenteredProperties = propLength === (nx - 1) * (ny - 1);
|
|
113
|
+
if (propLength !== (nx - 1) * (ny - 1) && propLength !== nx * ny) {
|
|
114
|
+
console.error("There should be as many property values as nodes (nx*ny) OR as many as cells (nx - 1) * (ny - 1).");
|
|
115
|
+
}
|
|
116
|
+
const positions = [];
|
|
117
|
+
const normals = [];
|
|
118
|
+
const indices = [];
|
|
119
|
+
const vertexProperties = [];
|
|
120
|
+
const vertexIndexs = [];
|
|
121
|
+
const line_positions = [];
|
|
122
|
+
// Note: Assumed layout of the incomming 2D array of data:
|
|
123
|
+
// First coloumn corresponds to lowest x value. Last column highest x value.
|
|
124
|
+
// First row corresponds to max y value. Last row corresponds to lowest y value.
|
|
125
|
+
// This must be taken into account when calculating vertex x,y values and texture coordinates.
|
|
126
|
+
if (!isCellCenteredProperties) {
|
|
127
|
+
// PROPERTIES IS SET INTERPOLATED OVER A CELL.
|
|
128
|
+
let i = 0;
|
|
129
|
+
// Loop over nodes.
|
|
130
|
+
for (let h = 0; h < ny; h++) {
|
|
131
|
+
for (let w = 0; w < nx; w++) {
|
|
132
|
+
const i0 = h * nx + w;
|
|
133
|
+
const x0 = ox + w * dx;
|
|
134
|
+
const y0 = oy + (ny - 1 - h) * dy; // See note above.
|
|
135
|
+
const z = isMesh ? -meshData[i0] : 0;
|
|
136
|
+
const propertyValue = propertiesData[i0];
|
|
137
|
+
positions.push(x0, y0, z);
|
|
138
|
+
const normal = calcNormal(w, h, nx, ny, isMesh, smoothShading, meshData, ox, oy); // eslint-disable-line
|
|
139
|
+
normals.push(normal[0], normal[1], normal[2]);
|
|
140
|
+
vertexProperties.push(propertyValue);
|
|
141
|
+
vertexIndexs.push(i++);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
for (let h = 0; h < ny - 1; h++) {
|
|
145
|
+
for (let w = 0; w < nx - 1; w++) {
|
|
146
|
+
const i0 = h * nx + w;
|
|
147
|
+
const i1 = h * nx + (w + 1);
|
|
148
|
+
const i2 = (h + 1) * nx + (w + 1);
|
|
149
|
+
const i3 = (h + 1) * nx + w;
|
|
150
|
+
const i0_act = !isMesh || (!isNaN(meshData[i0]) && !isNaN(propertiesData[i0])); // eslint-disable-line
|
|
151
|
+
const i1_act = !isMesh || (!isNaN(meshData[i1]) && !isNaN(propertiesData[i1])); // eslint-disable-line
|
|
152
|
+
const i2_act = !isMesh || (!isNaN(meshData[i2]) && !isNaN(propertiesData[i2])); // eslint-disable-line
|
|
153
|
+
const i3_act = !isMesh || (!isNaN(meshData[i3]) && !isNaN(propertiesData[i3])); // eslint-disable-line
|
|
154
|
+
const hh = ny - h - 1; // See note above.
|
|
155
|
+
const x0 = ox + w * dx;
|
|
156
|
+
const y0 = oy + hh * dy;
|
|
157
|
+
const z0 = isMesh ? -meshData[i0] : 0;
|
|
158
|
+
const x1 = ox + (w + 1) * dx;
|
|
159
|
+
const y1 = oy + hh * dy;
|
|
160
|
+
const z1 = isMesh ? -meshData[i1] : 0;
|
|
161
|
+
const x2 = ox + (w + 1) * dx;
|
|
162
|
+
const y2 = oy + (hh - 1) * dy;
|
|
163
|
+
const z2 = isMesh ? -meshData[i2] : 0;
|
|
164
|
+
const x3 = ox + w * dx;
|
|
165
|
+
const y3 = oy + (hh - 1) * dy;
|
|
166
|
+
const z3 = isMesh ? -meshData[i3] : 0;
|
|
167
|
+
if (i1_act && i3_act) {
|
|
168
|
+
// diagonal i1, i3
|
|
169
|
+
if (i0_act) {
|
|
170
|
+
indices.push(i1, i3, i0); // t1 - i0 provoking index.
|
|
171
|
+
line_positions.push(x0, y0, z0);
|
|
172
|
+
line_positions.push(x3, y3, z3);
|
|
173
|
+
line_positions.push(x0, y0, z0);
|
|
174
|
+
line_positions.push(x1, y1, z1);
|
|
175
|
+
}
|
|
176
|
+
if (i2_act) {
|
|
177
|
+
indices.push(i1, i3, i2); // t2 - i2 provoking index.
|
|
178
|
+
line_positions.push(x2, y2, z2);
|
|
179
|
+
line_positions.push(x3, y3, z3);
|
|
180
|
+
line_positions.push(x2, y2, z2);
|
|
181
|
+
line_positions.push(x1, y1, z1);
|
|
182
|
+
}
|
|
183
|
+
// diagonal
|
|
184
|
+
if ((i0_act && !i2_act) || (!i0_act && i2_act)) {
|
|
185
|
+
line_positions.push(x1, y1, z1);
|
|
186
|
+
line_positions.push(x3, y3, z3);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else if (i0_act && i2_act) {
|
|
190
|
+
// diagonal i0, i2
|
|
191
|
+
if (i1_act) {
|
|
192
|
+
indices.push(i1, i2, i0); // t1 - i0 provoking index.
|
|
193
|
+
}
|
|
194
|
+
if (i3_act) {
|
|
195
|
+
indices.push(i3, i0, i2); // t2 - i2 provoking index.
|
|
196
|
+
}
|
|
197
|
+
// diagonal
|
|
198
|
+
if ((i3_act && !i1_act) || (!i3_act && i1_act)) {
|
|
199
|
+
line_positions.push(x0, y0, z0);
|
|
200
|
+
line_positions.push(x2, y2, z2);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
// PROPERTIES IS SET CONSTANT OVER A CELL.
|
|
208
|
+
let i_indices = 0;
|
|
209
|
+
let i_vertices = 0;
|
|
210
|
+
// Loop over cells.
|
|
211
|
+
for (let h = 0; h < ny - 1; h++) {
|
|
212
|
+
for (let w = 0; w < nx - 1; w++) {
|
|
213
|
+
const hh = ny - 1 - h; // See note above.
|
|
214
|
+
const i0 = h * nx + w;
|
|
215
|
+
const i1 = h * nx + (w + 1);
|
|
216
|
+
const i2 = (h + 1) * nx + (w + 1);
|
|
217
|
+
const i3 = (h + 1) * nx + w;
|
|
218
|
+
const normal0 = calcNormal(w, h, nx, ny, isMesh, smoothShading, meshData, ox, oy); // eslint-disable-line
|
|
219
|
+
const normal1 = calcNormal(w + 1, h, nx, ny, isMesh, smoothShading, meshData, ox, oy); // eslint-disable-line
|
|
220
|
+
const normal2 = calcNormal(w + 1, h + 1, nx, ny, isMesh, smoothShading, meshData, ox, oy); // eslint-disable-line
|
|
221
|
+
const normal3 = calcNormal(w, h + 1, nx, ny, isMesh, smoothShading, meshData, ox, oy); // eslint-disable-line
|
|
222
|
+
const i0_act = !isMesh || !isNaN(meshData[i0]); // eslint-disable-line
|
|
223
|
+
const i1_act = !isMesh || !isNaN(meshData[i1]); // eslint-disable-line
|
|
224
|
+
const i2_act = !isMesh || !isNaN(meshData[i2]); // eslint-disable-line
|
|
225
|
+
const i3_act = !isMesh || !isNaN(meshData[i3]); // eslint-disable-line
|
|
226
|
+
const x0 = ox + w * dx;
|
|
227
|
+
const y0 = oy + hh * dy;
|
|
228
|
+
const z0 = isMesh ? -meshData[i0] : 0;
|
|
229
|
+
const x1 = ox + (w + 1) * dx;
|
|
230
|
+
const y1 = oy + hh * dy;
|
|
231
|
+
const z1 = isMesh ? -meshData[i1] : 0;
|
|
232
|
+
const x2 = ox + (w + 1) * dx;
|
|
233
|
+
const y2 = oy + (hh - 1) * dy; // Note hh - 1 here.
|
|
234
|
+
const z2 = isMesh ? -meshData[i2] : 0;
|
|
235
|
+
const x3 = ox + w * dx;
|
|
236
|
+
const y3 = oy + (hh - 1) * dy; // Note hh - 1 here.
|
|
237
|
+
const z3 = isMesh ? -meshData[i3] : 0;
|
|
238
|
+
const propertyIndex = h * (nx - 1) + w; // (nx - 1) -> the width of the property 2D array is one less than for the nodes in this case.
|
|
239
|
+
const propertyValue = propertiesData[propertyIndex];
|
|
240
|
+
if (isNaN(propertyValue)) {
|
|
241
|
+
// Inactive cell, dont draw.
|
|
242
|
+
continue;
|
|
243
|
+
}
|
|
244
|
+
if (i1_act && i3_act) {
|
|
245
|
+
// diagonal i1, i3
|
|
246
|
+
if (i0_act) {
|
|
247
|
+
// t1 - i0 provoking index.
|
|
248
|
+
positions.push(x1, y1, z1);
|
|
249
|
+
positions.push(x3, y3, z3);
|
|
250
|
+
positions.push(x0, y0, z0);
|
|
251
|
+
normals.push(normal1[0], normal1[1], normal1[2]);
|
|
252
|
+
normals.push(normal3[0], normal3[1], normal3[2]);
|
|
253
|
+
normals.push(normal0[0], normal0[1], normal0[2]);
|
|
254
|
+
vertexIndexs.push(i_vertices++, i_vertices++, i_vertices++);
|
|
255
|
+
indices.push(i_indices++, i_indices++, i_indices++);
|
|
256
|
+
vertexProperties.push(propertyValue);
|
|
257
|
+
vertexProperties.push(propertyValue);
|
|
258
|
+
vertexProperties.push(propertyValue);
|
|
259
|
+
line_positions.push(x0, y0, z0);
|
|
260
|
+
line_positions.push(x3, y3, z3);
|
|
261
|
+
line_positions.push(x0, y0, z0);
|
|
262
|
+
line_positions.push(x1, y1, z1);
|
|
263
|
+
}
|
|
264
|
+
if (i2_act) {
|
|
265
|
+
// t2 - i2 provoking index.
|
|
266
|
+
positions.push(x1, y1, z1);
|
|
267
|
+
positions.push(x3, y3, z3);
|
|
268
|
+
positions.push(x2, y2, z2);
|
|
269
|
+
normals.push(normal1[0], normal1[1], normal1[2]);
|
|
270
|
+
normals.push(normal3[0], normal3[1], normal3[2]);
|
|
271
|
+
normals.push(normal2[0], normal2[1], normal2[2]);
|
|
272
|
+
vertexIndexs.push(i_vertices++, i_vertices++, i_vertices++);
|
|
273
|
+
indices.push(i_indices++, i_indices++, i_indices++);
|
|
274
|
+
vertexProperties.push(propertyValue);
|
|
275
|
+
vertexProperties.push(propertyValue);
|
|
276
|
+
vertexProperties.push(propertyValue);
|
|
277
|
+
line_positions.push(x2, y2, z2);
|
|
278
|
+
line_positions.push(x3, y3, z3);
|
|
279
|
+
line_positions.push(x2, y2, z2);
|
|
280
|
+
line_positions.push(x1, y1, z1);
|
|
281
|
+
}
|
|
282
|
+
// diagonal
|
|
283
|
+
if ((i0_act && !i2_act) || (!i0_act && i2_act)) {
|
|
284
|
+
line_positions.push(x1, y1, z1);
|
|
285
|
+
line_positions.push(x3, y3, z3);
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
else if (i0_act && i2_act) {
|
|
289
|
+
// diagonal i0, i2
|
|
290
|
+
if (i1_act) {
|
|
291
|
+
// t1 - i0 provoking index.
|
|
292
|
+
positions.push(x1, y1, z1);
|
|
293
|
+
positions.push(x2, y2, z2);
|
|
294
|
+
positions.push(x0, y0, z0);
|
|
295
|
+
normals.push(normal1[0], normal1[1], normal1[2]);
|
|
296
|
+
normals.push(normal2[0], normal2[1], normal2[2]);
|
|
297
|
+
normals.push(normal0[0], normal0[1], normal0[2]);
|
|
298
|
+
vertexIndexs.push(i_vertices++, i_vertices++, i_vertices++);
|
|
299
|
+
indices.push(i_indices++, i_indices++, i_indices++);
|
|
300
|
+
vertexProperties.push(propertyValue);
|
|
301
|
+
vertexProperties.push(propertyValue);
|
|
302
|
+
vertexProperties.push(propertyValue);
|
|
303
|
+
line_positions.push(x1, y1, z1);
|
|
304
|
+
line_positions.push(x0, y0, z0);
|
|
305
|
+
line_positions.push(x1, y1, z1);
|
|
306
|
+
line_positions.push(x2, y2, z2);
|
|
307
|
+
}
|
|
308
|
+
if (i3_act) {
|
|
309
|
+
// t2 - i2 provoking index.
|
|
310
|
+
positions.push(x0, y0, z0);
|
|
311
|
+
positions.push(x3, y3, z3);
|
|
312
|
+
positions.push(x2, y2, z2);
|
|
313
|
+
normals.push(normal0[0], normal0[1], normal0[2]);
|
|
314
|
+
normals.push(normal3[0], normal3[1], normal3[2]);
|
|
315
|
+
normals.push(normal2[0], normal2[1], normal2[2]);
|
|
316
|
+
vertexIndexs.push(i_vertices++, i_vertices++, i_vertices++);
|
|
317
|
+
indices.push(i_indices++, i_indices++, i_indices++);
|
|
318
|
+
vertexProperties.push(propertyValue);
|
|
319
|
+
vertexProperties.push(propertyValue);
|
|
320
|
+
vertexProperties.push(propertyValue);
|
|
321
|
+
line_positions.push(x3, y3, z3);
|
|
322
|
+
line_positions.push(x0, y0, z0);
|
|
323
|
+
line_positions.push(x3, y3, z3);
|
|
324
|
+
line_positions.push(x2, y2, z2);
|
|
325
|
+
}
|
|
326
|
+
// diagonal
|
|
327
|
+
if ((i3_act && !i1_act) || (!i3_act && i1_act)) {
|
|
328
|
+
line_positions.push(x0, y0, z0);
|
|
329
|
+
line_positions.push(x2, y2, z2);
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
const mesh = {
|
|
336
|
+
drawMode: 4,
|
|
337
|
+
attributes: {
|
|
338
|
+
positions: { value: new Float32Array(positions), size: 3 },
|
|
339
|
+
normals: { value: new Float32Array(normals), size: 3 },
|
|
340
|
+
properties: { value: new Float32Array(vertexProperties), size: 1 },
|
|
341
|
+
vertex_indexs: { value: new Int32Array(vertexIndexs), size: 1 },
|
|
342
|
+
},
|
|
343
|
+
vertexCount: indices.length,
|
|
344
|
+
indices: { value: new Uint32Array(indices), size: 1 },
|
|
345
|
+
};
|
|
346
|
+
const mesh_lines = {
|
|
347
|
+
drawMode: 1,
|
|
348
|
+
attributes: {
|
|
349
|
+
positions: { value: new Float32Array(line_positions), size: 3 },
|
|
350
|
+
},
|
|
351
|
+
vertexCount: line_positions.length / 3,
|
|
352
|
+
};
|
|
353
|
+
//const t1 = performance.now();
|
|
354
|
+
// Keep this.
|
|
355
|
+
//console.log(`Task makeMesh took ${(t1 - t0) * 0.001} seconds.`);
|
|
356
|
+
// Note: typescript gives this error "error TS2554: Expected 2-3 arguments, but got 1."
|
|
357
|
+
// Disabling this for now as the second argument should be optional.
|
|
358
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
359
|
+
// @ts-ignore
|
|
360
|
+
postMessage([mesh, mesh_lines, meshZValueRange, propertyValueRange]);
|
|
361
|
+
}
|
|
362
|
+
//# sourceMappingURL=webworker.js.map
|