diff --git a/package-lock.json b/package-lock.json index 3ad6e02..56bc443 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,8 @@ "@fortawesome/fontawesome-free": "^5.15.2", "@types/three": "^0.129.1", "bulma": "^0.9.2", + "concaveman": "github:grassick/concaveman#patch-1", + "hull.js": "^0.2.11", "lodash": "^4.17.21", "normalize.css": "^8.0.1", "proj4": "^2.6.3", @@ -36,7 +38,7 @@ "node-sass": "^6.0.0", "resolve-url-loader": "^4.0.0", "sass-loader": "^12.1.0", - "style-loader": "^2.0.0", + "style-loader": "^3.0.0", "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", "webpack": "^5.7.0", @@ -1759,9 +1761,9 @@ } }, "node_modules/@types/estree": { - "version": "0.0.47", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.47.tgz", - "integrity": "sha512-c5ciR06jK8u9BstrmJyO97m+klJrrhCf9u3rLu3DEAJBirxRqSCvDQoYKmxuYwQI5SZChAWu+tq9oVlGRuzPAg==", + "version": "0.0.48", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.48.tgz", + "integrity": "sha512-LfZwXoGUDo0C3me81HXgkBg5CTQYb6xzEl+fNmbO4JdRiSKQ8A0GD1OBBvKAIsbCUgoyAty7m99GqqMQe784ew==", "dev": true }, "node_modules/@types/json-schema": { @@ -1777,9 +1779,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "15.12.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.4.tgz", - "integrity": "sha512-zrNj1+yqYF4WskCMOHwN+w9iuD12+dGm0rQ35HLl9/Ouuq52cEtd0CH9qMgrdNmi5ejC1/V7vKEXYubB+65DkA==", + "version": "15.12.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.5.tgz", + "integrity": "sha512-se3yX7UHv5Bscf8f1ERKvQOD6sTyycH3hdaoozvaLxgUiY5lIGEeH37AD0G0Qi9kPqihPn0HOfd2yaIEN9VwEg==", "dev": true }, "node_modules/@types/normalize-package-data": { @@ -2358,9 +2360,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001239", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001239.tgz", - "integrity": "sha512-cyBkXJDMeI4wthy8xJ2FvDU6+0dtcZSJW3voUF8+e9f1bBeuvyZfc3PNbkOETyhbR+dGCPzn9E7MA3iwzusOhQ==", + "version": "1.0.30001241", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001241.tgz", + "integrity": "sha512-1uoSZ1Pq1VpH0WerIMqwptXHNNGfdl7d1cJUFs80CwQ/lVzdhTvsFZCeNFslze7AjsQnb4C85tzclPa1VShbeQ==", "dev": true, "funding": { "type": "opencollective", @@ -2534,6 +2536,17 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "node_modules/concaveman": { + "version": "1.2.0", + "resolved": "git+ssh://git@github.com/grassick/concaveman.git#05682dcd7c21ef09f391e814d0f5df7cfbc3bbae", + "license": "ISC", + "dependencies": { + "point-in-polygon": "^1.0.1", + "rbush": "^3.0.0", + "robust-predicates": "^2.0.4", + "tinyqueue": "^2.0.3" + } + }, "node_modules/concurrently": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-6.2.0.tgz", @@ -2920,9 +2933,9 @@ } }, "node_modules/electron-to-chromium": { - "version": "1.3.757", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.757.tgz", - "integrity": "sha512-kP0ooyrvavDC+Y9UG6G/pUVxfRNM2VTJwtLQLvgsJeyf1V+7shMCb68Wj0/TETmfx8dWv9pToGkVT39udE87wQ==", + "version": "1.3.760", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.760.tgz", + "integrity": "sha512-XPKwjX6pHezJWB4FLVuSil9gGmU6XYl27ahUwEHODXF4KjCEB8RuIT05MkU1au2Tdye57o49yY0uCMK+bwUt+A==", "dev": true }, "node_modules/emoji-regex": { @@ -3113,18 +3126,17 @@ "dev": true }, "node_modules/fast-glob": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", - "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.6.tgz", + "integrity": "sha512-GnLuqj/pvQ7pX8/L4J84nijv6sAnlwvSDpMkJi9i7nPmPxGtRPkBSStfvDW5l6nMdX9VWe+pkKWFTgD+vF2QSQ==", "dev": true, "peer": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", + "glob-parent": "^5.1.2", "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" + "micromatch": "^4.0.4" }, "engines": { "node": ">=8" @@ -3602,6 +3614,11 @@ "npm": ">=1.3.7" } }, + "node_modules/hull.js": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/hull.js/-/hull.js-0.2.11.tgz", + "integrity": "sha512-WEmMRCFqoZA0d7bD9KY9RK0rTBKRfNqDExi8OvFz5A57hpywyc0Wd5N4egF9cU+E69p1KjE/fTIYU4CjOgXdZQ==" + }, "node_modules/human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -3864,9 +3881,9 @@ "dev": true }, "node_modules/jest-worker": { - "version": "27.0.2", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.0.2.tgz", - "integrity": "sha512-EoBdilOTTyOgmHXtw/cPc+ZrCA0KJMrkXzkrPGNwLmnvvlN1nj7MPrxpT7m+otSv2e1TLaVffzDnE/LB14zJMg==", + "version": "27.0.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.0.6.tgz", + "integrity": "sha512-qupxcj/dRuA3xHPMUd40gr2EaAurFbkwzOh7wfPaeE9id7hyjURRQoqNfHifHK3XjJU6YJJUQKILGUnwGPEOCA==", "dev": true, "dependencies": { "@types/node": "*", @@ -4223,9 +4240,9 @@ } }, "node_modules/mini-css-extract-plugin": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-1.6.0.tgz", - "integrity": "sha512-nPFKI7NSy6uONUo9yn2hIfb9vyYvkFu95qki0e21DQ9uaqNKDP15DGpK0KnV6wDroWxPHtExrdEwx/yDQ8nVRw==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-1.6.2.tgz", + "integrity": "sha512-WhDvO3SjGm40oV5y26GjMJYjd2UMqrLAGKy5YS2/3QKJy2F7jgynuHTir/tgUUOiNQu5saXHdc8reo7YuhhT4Q==", "dev": true, "dependencies": { "loader-utils": "^2.0.0", @@ -4790,6 +4807,11 @@ "node": ">=8" } }, + "node_modules/point-in-polygon": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/point-in-polygon/-/point-in-polygon-1.1.0.tgz", + "integrity": "sha512-3ojrFwjnnw8Q9242TzgXuTD+eKiutbzyslcq1ydfu82Db2y+Ogbmyrkpv0Hgj31qwT3lbS9+QAAO/pIQM35XRw==" + }, "node_modules/postcss": { "version": "8.3.5", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.5.tgz", @@ -4955,6 +4977,11 @@ "node": ">=8" } }, + "node_modules/quickselect": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", + "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==" + }, "node_modules/randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -4964,6 +4991,14 @@ "safe-buffer": "^5.1.0" } }, + "node_modules/rbush": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz", + "integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==", + "dependencies": { + "quickselect": "^2.0.0" + } + }, "node_modules/read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", @@ -5369,6 +5404,11 @@ "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/robust-predicates": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-2.0.4.tgz", + "integrity": "sha512-l4NwboJM74Ilm4VKfbAtFeGq7aEjWL+5kVFcmgFA2MrdnQWx9iE/tUGvxY5HyMI7o/WpSIUFLbC5fbeaHgSCYg==" + }, "node_modules/run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -5668,9 +5708,9 @@ } }, "node_modules/serialize-javascript": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", - "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", "dev": true, "dependencies": { "randombytes": "^2.1.0" @@ -5917,55 +5957,19 @@ } }, "node_modules/style-loader": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-2.0.0.tgz", - "integrity": "sha512-Z0gYUJmzZ6ZdRUqpg1r8GsaFKypE+3xAzuFeMuoHgjc9KZv3wMyCRjQIWEbhoFSq7+7yoHXySDJyyWQaPajeiQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.0.0.tgz", + "integrity": "sha512-pqJTDiCtLr8D2eyVWXPiwNkLsAMDuvPHnu+Z/Edo9hu+DzdJwdO5eZv9zUBF6tWI8GJGhAkenWJaVjXI+sHnuQ==", "dev": true, - "dependencies": { - "loader-utils": "^2.0.0", - "schema-utils": "^3.0.0" - }, "engines": { - "node": ">= 10.13.0" + "node": ">= 12.13.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/webpack" }, "peerDependencies": { - "webpack": "^4.0.0 || ^5.0.0" - } - }, - "node_modules/style-loader/node_modules/loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", - "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", - "dev": true, - "dependencies": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - }, - "engines": { - "node": ">=8.9.0" - } - }, - "node_modules/style-loader/node_modules/schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", - "dev": true, - "dependencies": { - "@types/json-schema": "^7.0.6", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - }, - "engines": { - "node": ">= 10.13.0" - }, - "funding": { - "type": "opencollective", - "url": "https://opencollective.com/webpack" + "webpack": "^5.0.0" } }, "node_modules/supports-color": { @@ -6007,9 +6011,9 @@ } }, "node_modules/terser": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.7.0.tgz", - "integrity": "sha512-HP5/9hp2UaZt5fYkuhNBR8YyRcT8juw8+uFbAme53iN9hblvKnLUTKkmwJG6ocWpIKf8UK4DoeWG4ty0J6S6/g==", + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.7.1.tgz", + "integrity": "sha512-b3e+d5JbHAe/JSjwsC3Zn55wsBIM7AsHLjKxT31kGCldgbpFePaFo+PiddtO6uwRZWRw7sPXmAN8dTW61xmnSg==", "dev": true, "dependencies": { "commander": "^2.20.0", @@ -6024,15 +6028,15 @@ } }, "node_modules/terser-webpack-plugin": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.1.3.tgz", - "integrity": "sha512-cxGbMqr6+A2hrIB5ehFIF+F/iST5ZOxvOmy9zih9ySbP1C2oEWQSOUS+2SNBTjzx5xLKO4xnod9eywdfq1Nb9A==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.1.4.tgz", + "integrity": "sha512-C2WkFwstHDhVEmsmlCxrXUtVklS+Ir1A7twrYzrDrQQOIMOaVAYykaoo/Aq1K0QRkMoY2hhvDQY1cm4jnIMFwA==", "dev": true, "dependencies": { "jest-worker": "^27.0.2", "p-limit": "^3.1.0", "schema-utils": "^3.0.0", - "serialize-javascript": "^5.0.1", + "serialize-javascript": "^6.0.0", "source-map": "^0.6.1", "terser": "^5.7.0" }, @@ -6112,6 +6116,11 @@ "three": ">= 0.125.0" } }, + "node_modules/tinyqueue": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-2.0.3.tgz", + "integrity": "sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA==" + }, "node_modules/to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -6406,13 +6415,13 @@ } }, "node_modules/webpack": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.40.0.tgz", - "integrity": "sha512-c7f5e/WWrxXWUzQqTBg54vBs5RgcAgpvKE4F4VegVgfo4x660ZxYUF2/hpMkZUnLjgytVTitjeXaN4IPlXCGIw==", + "version": "5.41.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.41.0.tgz", + "integrity": "sha512-pCVO7hVm8XiL6DpPtXrFLS8ktmH/tpvtbEex6hn4RweTFe6z6Cugh5FlQoEPZotb15HiirjM2Kv7THTA7sKLzQ==", "dev": true, "dependencies": { "@types/eslint-scope": "^3.7.0", - "@types/estree": "^0.0.47", + "@types/estree": "^0.0.48", "@webassemblyjs/ast": "1.11.0", "@webassemblyjs/wasm-edit": "1.11.0", "@webassemblyjs/wasm-parser": "1.11.0", @@ -8014,9 +8023,9 @@ } }, "@types/estree": { - "version": "0.0.47", - "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.47.tgz", - "integrity": "sha512-c5ciR06jK8u9BstrmJyO97m+klJrrhCf9u3rLu3DEAJBirxRqSCvDQoYKmxuYwQI5SZChAWu+tq9oVlGRuzPAg==", + "version": "0.0.48", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-0.0.48.tgz", + "integrity": "sha512-LfZwXoGUDo0C3me81HXgkBg5CTQYb6xzEl+fNmbO4JdRiSKQ8A0GD1OBBvKAIsbCUgoyAty7m99GqqMQe784ew==", "dev": true }, "@types/json-schema": { @@ -8032,9 +8041,9 @@ "dev": true }, "@types/node": { - "version": "15.12.4", - "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.4.tgz", - "integrity": "sha512-zrNj1+yqYF4WskCMOHwN+w9iuD12+dGm0rQ35HLl9/Ouuq52cEtd0CH9qMgrdNmi5ejC1/V7vKEXYubB+65DkA==", + "version": "15.12.5", + "resolved": "https://registry.npmjs.org/@types/node/-/node-15.12.5.tgz", + "integrity": "sha512-se3yX7UHv5Bscf8f1ERKvQOD6sTyycH3hdaoozvaLxgUiY5lIGEeH37AD0G0Qi9kPqihPn0HOfd2yaIEN9VwEg==", "dev": true }, "@types/normalize-package-data": { @@ -8516,9 +8525,9 @@ } }, "caniuse-lite": { - "version": "1.0.30001239", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001239.tgz", - "integrity": "sha512-cyBkXJDMeI4wthy8xJ2FvDU6+0dtcZSJW3voUF8+e9f1bBeuvyZfc3PNbkOETyhbR+dGCPzn9E7MA3iwzusOhQ==", + "version": "1.0.30001241", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001241.tgz", + "integrity": "sha512-1uoSZ1Pq1VpH0WerIMqwptXHNNGfdl7d1cJUFs80CwQ/lVzdhTvsFZCeNFslze7AjsQnb4C85tzclPa1VShbeQ==", "dev": true }, "caseless": { @@ -8660,6 +8669,16 @@ "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s=", "dev": true }, + "concaveman": { + "version": "git+ssh://git@github.com/grassick/concaveman.git#05682dcd7c21ef09f391e814d0f5df7cfbc3bbae", + "from": "concaveman@github:grassick/concaveman#patch-1", + "requires": { + "point-in-polygon": "^1.0.1", + "rbush": "^3.0.0", + "robust-predicates": "^2.0.4", + "tinyqueue": "^2.0.3" + } + }, "concurrently": { "version": "6.2.0", "resolved": "https://registry.npmjs.org/concurrently/-/concurrently-6.2.0.tgz", @@ -8942,9 +8961,9 @@ } }, "electron-to-chromium": { - "version": "1.3.757", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.757.tgz", - "integrity": "sha512-kP0ooyrvavDC+Y9UG6G/pUVxfRNM2VTJwtLQLvgsJeyf1V+7shMCb68Wj0/TETmfx8dWv9pToGkVT39udE87wQ==", + "version": "1.3.760", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.760.tgz", + "integrity": "sha512-XPKwjX6pHezJWB4FLVuSil9gGmU6XYl27ahUwEHODXF4KjCEB8RuIT05MkU1au2Tdye57o49yY0uCMK+bwUt+A==", "dev": true }, "emoji-regex": { @@ -9089,18 +9108,17 @@ "dev": true }, "fast-glob": { - "version": "3.2.5", - "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.5.tgz", - "integrity": "sha512-2DtFcgT68wiTTiwZ2hNdJfcHNke9XOfnwmBRWXhmeKM8rF0TGwmC/Qto3S7RoZKp5cilZbxzO5iTNTQsJ+EeDg==", + "version": "3.2.6", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.6.tgz", + "integrity": "sha512-GnLuqj/pvQ7pX8/L4J84nijv6sAnlwvSDpMkJi9i7nPmPxGtRPkBSStfvDW5l6nMdX9VWe+pkKWFTgD+vF2QSQ==", "dev": true, "peer": true, "requires": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", - "glob-parent": "^5.1.0", + "glob-parent": "^5.1.2", "merge2": "^1.3.0", - "micromatch": "^4.0.2", - "picomatch": "^2.2.1" + "micromatch": "^4.0.4" } }, "fast-json-stable-stringify": { @@ -9456,6 +9474,11 @@ "sshpk": "^1.7.0" } }, + "hull.js": { + "version": "0.2.11", + "resolved": "https://registry.npmjs.org/hull.js/-/hull.js-0.2.11.tgz", + "integrity": "sha512-WEmMRCFqoZA0d7bD9KY9RK0rTBKRfNqDExi8OvFz5A57hpywyc0Wd5N4egF9cU+E69p1KjE/fTIYU4CjOgXdZQ==" + }, "human-signals": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/human-signals/-/human-signals-2.1.0.tgz", @@ -9645,9 +9668,9 @@ "dev": true }, "jest-worker": { - "version": "27.0.2", - "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.0.2.tgz", - "integrity": "sha512-EoBdilOTTyOgmHXtw/cPc+ZrCA0KJMrkXzkrPGNwLmnvvlN1nj7MPrxpT7m+otSv2e1TLaVffzDnE/LB14zJMg==", + "version": "27.0.6", + "resolved": "https://registry.npmjs.org/jest-worker/-/jest-worker-27.0.6.tgz", + "integrity": "sha512-qupxcj/dRuA3xHPMUd40gr2EaAurFbkwzOh7wfPaeE9id7hyjURRQoqNfHifHK3XjJU6YJJUQKILGUnwGPEOCA==", "dev": true, "requires": { "@types/node": "*", @@ -9921,9 +9944,9 @@ "dev": true }, "mini-css-extract-plugin": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-1.6.0.tgz", - "integrity": "sha512-nPFKI7NSy6uONUo9yn2hIfb9vyYvkFu95qki0e21DQ9uaqNKDP15DGpK0KnV6wDroWxPHtExrdEwx/yDQ8nVRw==", + "version": "1.6.2", + "resolved": "https://registry.npmjs.org/mini-css-extract-plugin/-/mini-css-extract-plugin-1.6.2.tgz", + "integrity": "sha512-WhDvO3SjGm40oV5y26GjMJYjd2UMqrLAGKy5YS2/3QKJy2F7jgynuHTir/tgUUOiNQu5saXHdc8reo7YuhhT4Q==", "dev": true, "requires": { "loader-utils": "^2.0.0", @@ -10330,6 +10353,11 @@ "find-up": "^4.0.0" } }, + "point-in-polygon": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/point-in-polygon/-/point-in-polygon-1.1.0.tgz", + "integrity": "sha512-3ojrFwjnnw8Q9242TzgXuTD+eKiutbzyslcq1ydfu82Db2y+Ogbmyrkpv0Hgj31qwT3lbS9+QAAO/pIQM35XRw==" + }, "postcss": { "version": "8.3.5", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.3.5.tgz", @@ -10439,6 +10467,11 @@ "integrity": "sha512-ARhCpm70fzdcvNQfPoy49IaanKkTlRWF2JMzqhcJbhSFRZv7nPTvZJdcY7301IPmvW+/p0RgIWnQDLJxifsQ7g==", "dev": true }, + "quickselect": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/quickselect/-/quickselect-2.0.0.tgz", + "integrity": "sha512-RKJ22hX8mHe3Y6wH/N3wCM6BWtjaxIyyUIkpHOvfFnxdI4yD4tBXEBKSbriGujF6jnSVkJrffuo6vxACiSSxIw==" + }, "randombytes": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/randombytes/-/randombytes-2.1.0.tgz", @@ -10448,6 +10481,14 @@ "safe-buffer": "^5.1.0" } }, + "rbush": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/rbush/-/rbush-3.0.1.tgz", + "integrity": "sha512-XRaVO0YecOpEuIvbhbpTrZgoiI6xBlz6hnlr6EHhd+0x9ase6EmeN+hdwwUaJvLcsFFQ8iWVF1GAK1yB0BWi0w==", + "requires": { + "quickselect": "^2.0.0" + } + }, "read-pkg": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-5.2.0.tgz", @@ -10765,6 +10806,11 @@ "glob": "^7.1.3" } }, + "robust-predicates": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/robust-predicates/-/robust-predicates-2.0.4.tgz", + "integrity": "sha512-l4NwboJM74Ilm4VKfbAtFeGq7aEjWL+5kVFcmgFA2MrdnQWx9iE/tUGvxY5HyMI7o/WpSIUFLbC5fbeaHgSCYg==" + }, "run-parallel": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", @@ -10987,9 +11033,9 @@ "dev": true }, "serialize-javascript": { - "version": "5.0.1", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-5.0.1.tgz", - "integrity": "sha512-SaaNal9imEO737H2c05Og0/8LUXG7EnsZyMa8MzkmuHoELfT6txuj0cMqRj6zfPKnmQ1yasR4PCJc8x+M4JSPA==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-6.0.0.tgz", + "integrity": "sha512-Qr3TosvguFt8ePWqsvRfrKyQXIiW+nGbYpy8XK24NQHE83caxWt+mIymTT19DGFbNWNLfEwsrkSmN64lVWB9ag==", "dev": true, "requires": { "randombytes": "^2.1.0" @@ -11195,38 +11241,11 @@ } }, "style-loader": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-2.0.0.tgz", - "integrity": "sha512-Z0gYUJmzZ6ZdRUqpg1r8GsaFKypE+3xAzuFeMuoHgjc9KZv3wMyCRjQIWEbhoFSq7+7yoHXySDJyyWQaPajeiQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/style-loader/-/style-loader-3.0.0.tgz", + "integrity": "sha512-pqJTDiCtLr8D2eyVWXPiwNkLsAMDuvPHnu+Z/Edo9hu+DzdJwdO5eZv9zUBF6tWI8GJGhAkenWJaVjXI+sHnuQ==", "dev": true, - "requires": { - "loader-utils": "^2.0.0", - "schema-utils": "^3.0.0" - }, - "dependencies": { - "loader-utils": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/loader-utils/-/loader-utils-2.0.0.tgz", - "integrity": "sha512-rP4F0h2RaWSvPEkD7BLDFQnvSf+nK+wr3ESUjNTyAGobqrijmW92zc+SO6d4p4B1wh7+B/Jg1mkQe5NYUEHtHQ==", - "dev": true, - "requires": { - "big.js": "^5.2.2", - "emojis-list": "^3.0.0", - "json5": "^2.1.2" - } - }, - "schema-utils": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/schema-utils/-/schema-utils-3.0.0.tgz", - "integrity": "sha512-6D82/xSzO094ajanoOSbe4YvXWMfn2A//8Y1+MUqFAJul5Bs+yn36xbK9OtNDcRVSBJ9jjeoXftM6CfztsjOAA==", - "dev": true, - "requires": { - "@types/json-schema": "^7.0.6", - "ajv": "^6.12.5", - "ajv-keywords": "^3.5.2" - } - } - } + "requires": {} }, "supports-color": { "version": "5.5.0", @@ -11258,9 +11277,9 @@ } }, "terser": { - "version": "5.7.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.7.0.tgz", - "integrity": "sha512-HP5/9hp2UaZt5fYkuhNBR8YyRcT8juw8+uFbAme53iN9hblvKnLUTKkmwJG6ocWpIKf8UK4DoeWG4ty0J6S6/g==", + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.7.1.tgz", + "integrity": "sha512-b3e+d5JbHAe/JSjwsC3Zn55wsBIM7AsHLjKxT31kGCldgbpFePaFo+PiddtO6uwRZWRw7sPXmAN8dTW61xmnSg==", "dev": true, "requires": { "commander": "^2.20.0", @@ -11277,15 +11296,15 @@ } }, "terser-webpack-plugin": { - "version": "5.1.3", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.1.3.tgz", - "integrity": "sha512-cxGbMqr6+A2hrIB5ehFIF+F/iST5ZOxvOmy9zih9ySbP1C2oEWQSOUS+2SNBTjzx5xLKO4xnod9eywdfq1Nb9A==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.1.4.tgz", + "integrity": "sha512-C2WkFwstHDhVEmsmlCxrXUtVklS+Ir1A7twrYzrDrQQOIMOaVAYykaoo/Aq1K0QRkMoY2hhvDQY1cm4jnIMFwA==", "dev": true, "requires": { "jest-worker": "^27.0.2", "p-limit": "^3.1.0", "schema-utils": "^3.0.0", - "serialize-javascript": "^5.0.1", + "serialize-javascript": "^6.0.0", "source-map": "^0.6.1", "terser": "^5.7.0" }, @@ -11329,6 +11348,11 @@ "integrity": "sha512-9wDhf1FOkXJ70JfsnQxuIFi997TRYGP+AWCEiJchxPy6mQysRdQOXgeym07JahkOB83YSTULOr/5hV6Lx2kXPA==", "requires": {} }, + "tinyqueue": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/tinyqueue/-/tinyqueue-2.0.3.tgz", + "integrity": "sha512-ppJZNDuKGgxzkHihX8v9v9G5f+18gzaTfrukGrq6ueg0lmH4nqVnA2IPG0AEH3jKEk2GRJCUhDoqpoiw3PHLBA==" + }, "to-fast-properties": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", @@ -11546,13 +11570,13 @@ } }, "webpack": { - "version": "5.40.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.40.0.tgz", - "integrity": "sha512-c7f5e/WWrxXWUzQqTBg54vBs5RgcAgpvKE4F4VegVgfo4x660ZxYUF2/hpMkZUnLjgytVTitjeXaN4IPlXCGIw==", + "version": "5.41.0", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.41.0.tgz", + "integrity": "sha512-pCVO7hVm8XiL6DpPtXrFLS8ktmH/tpvtbEex6hn4RweTFe6z6Cugh5FlQoEPZotb15HiirjM2Kv7THTA7sKLzQ==", "dev": true, "requires": { "@types/eslint-scope": "^3.7.0", - "@types/estree": "^0.0.47", + "@types/estree": "^0.0.48", "@webassemblyjs/ast": "1.11.0", "@webassemblyjs/wasm-edit": "1.11.0", "@webassemblyjs/wasm-parser": "1.11.0", diff --git a/package.json b/package.json index c26a119..bc23f4d 100644 --- a/package.json +++ b/package.json @@ -7,6 +7,8 @@ "@fortawesome/fontawesome-free": "^5.15.2", "@types/three": "^0.129.1", "bulma": "^0.9.2", + "concaveman": "github:grassick/concaveman#patch-1", + "hull.js": "^0.2.11", "lodash": "^4.17.21", "normalize.css": "^8.0.1", "proj4": "^2.6.3", @@ -33,7 +35,7 @@ "node-sass": "^6.0.0", "resolve-url-loader": "^4.0.0", "sass-loader": "^12.1.0", - "style-loader": "^2.0.0", + "style-loader": "^3.0.0", "terser-webpack-plugin": "^5.0.3", "url-loader": "^4.1.1", "webpack": "^5.7.0", diff --git a/src/js/clip/Selection.ts b/src/js/clip/Selection.ts index b6016d7..33e3bbb 100644 --- a/src/js/clip/Selection.ts +++ b/src/js/clip/Selection.ts @@ -58,7 +58,7 @@ export class Selection extends Layer { // this.box = new BoxGeometry(1, 1, 1); let box = this.box = new UpdatableBoxGeometry(this.vertices) - this.boxMesh = new Mesh(box, material.capMaterial); + this.boxMesh = new Mesh(box, material.profileMaterial); let v = this.vertices; @@ -99,14 +99,15 @@ export class Selection extends Layer { this.map = map; this.build(this.getScene()); this.emit('add'); - // if (this.map.layers) { - // for (const [key, layer] of Object.entries(this.map.layers)) { - // if (layer instanceof TinLayer) { - // layer.buildBorder(this.vertices); - // } - // } - // } - this.map.layers[17].buildBorder(this.vertices); + + if (this.map.layers) { + for (const [key, layer] of Object.entries(this.map.layers)) { + if (layer instanceof TinLayer) { + layer.buildBorder(this.vertices); + } + } + } + // this.map.layers[17].buildBorder(this.vertices); } onRemove(map) { @@ -236,13 +237,13 @@ export class Selection extends Layer { // this.setBox(); this.box.update(); - this.map.layers[17].box.update(); - // if (this.map.layers) { - // for (const [key, layer] of Object.entries(this.map.layers)) { - // if (layer instanceof TinLayer) { - // layer.box.update(); - // } - // } - // } + // this.map.layers[17].box.update(); + if (this.map.layers) { + for (const [key, layer] of Object.entries(this.map.layers)) { + if (layer instanceof TinLayer) { + layer.box.update(); + } + } + } } } \ No newline at end of file diff --git a/src/js/clip/material.js b/src/js/clip/material.js index 5c0168e..f33cbbb 100644 --- a/src/js/clip/material.js +++ b/src/js/clip/material.js @@ -3,29 +3,54 @@ import { LineBasicMaterial } from 'three/src/materials/LineBasicMaterial'; import { ShaderMaterial } from 'three/src/materials/ShaderMaterial'; import { uniforms } from "./uniforms"; import { shader } from './shader'; -import { DoubleSide, BackSide } from 'three/src/constants'; +import { DoubleSide, BackSide, FrontSide } from 'three/src/constants'; +import { DecrementWrapStencilOp, IncrementWrapStencilOp } from 'three/src/constants'; +import { NotEqualStencilFunc, ReplaceStencilOp, AlwaysStencilFunc } from 'three/src/constants'; -let capMaterial = new ShaderMaterial({ +let profileMaterial = new ShaderMaterial({ + color: 0xE91E63, + // metalness: 0.1, + // roughness: 0.75, + // flatShading: true, + stencilWrite: true, + // stencilRef: 0, + stencilFunc: NotEqualStencilFunc, + stencilFail: ReplaceStencilOp, + stencilZFail: ReplaceStencilOp, + stencilZPass: ReplaceStencilOp, uniforms: uniforms.caps, vertexShader: shader.vertex, fragmentShader: shader.fragment }); let frontStencilMaterial = new ShaderMaterial({ + depthWrite: false, + depthTest: false, + colorWrite: false, + stencilWrite: true, + stencilFunc: AlwaysStencilFunc, uniforms: uniforms.clipping, vertexShader: shader.vertexClipping, - fragmentShader: shader.fragmentClippingFront, - colorWrite: false, - depthWrite: false, + fragmentShader: shader.fragmentClippingFront, + side: FrontSide, + stencilFail: DecrementWrapStencilOp, + stencilZFail: DecrementWrapStencilOp, + stencilZPass: DecrementWrapStencilOp }); let backStencilMaterial = new ShaderMaterial({ + depthWrite: false, + depthTest: false, + colorWrite: false, + stencilWrite: true, + stencilFunc: AlwaysStencilFunc, uniforms: uniforms.clipping, vertexShader: shader.vertexClipping, - fragmentShader: shader.fragmentClippingFront, - colorWrite: false, - depthWrite: false, - side: BackSide + fragmentShader: shader.fragmentClippingFront, + side: BackSide, + stencilFail: IncrementWrapStencilOp, + stencilZFail: IncrementWrapStencilOp, + stencilZPass: IncrementWrapStencilOp }); // beige: @@ -45,7 +70,7 @@ let Invisible = new ShaderMaterial({ }); export { - capMaterial, + profileMaterial, frontStencilMaterial, backStencilMaterial, BoxBackFace, diff --git a/src/js/controls/BoreholePopup.ts b/src/js/controls/BoreholePopup.ts index b38e75d..20e7117 100644 --- a/src/js/controls/BoreholePopup.ts +++ b/src/js/controls/BoreholePopup.ts @@ -101,7 +101,7 @@ export class BoreholePopup extends Control { domEvent.on(this._clearButton, 'click', domEvent.preventDefault); domEvent.on(this._clearButton, 'click', this.close, this);; - this._toggleVisibility(false); + // this._toggleVisibility(false); if (!this.options.parentDiv) { return container; diff --git a/src/js/layer/TinLayer.ts b/src/js/layer/TinLayer.ts index c122a1c..dd16d89 100644 --- a/src/js/layer/TinLayer.ts +++ b/src/js/layer/TinLayer.ts @@ -1,6 +1,6 @@ import { BufferGeometry } from 'three/src/core/BufferGeometry'; import { Float32BufferAttribute, Uint16BufferAttribute } from 'three/src/core/BufferAttribute'; -import { DoubleSide } from 'three/src/constants'; +import { DoubleSide, FrontSide } from 'three/src/constants'; import { Mesh } from 'three/src/objects/Mesh'; import { Layer } from './Layer'; import { BitStream } from '../lib/bitstream'; @@ -19,8 +19,8 @@ import { Box3 } from 'three/src/math/Box3'; import { uniforms } from '../clip/uniforms'; import { UpdatableBoxGeometry } from '../clip/UpdatableBoxGeometry'; import { Scene } from 'three/src/scenes/Scene'; +import * as material from '../clip/material'; -import { CSG } from 'three-csg-ts'; import { Plane } from 'three/src/math/Plane'; import { PlaneGeometry } from '../clip/PlaneGeometry'; import { Line3 } from 'three/src/math/Line3'; @@ -29,8 +29,11 @@ import { LineSegments } from 'three/src/objects/LineSegments'; import { PointsMaterial } from 'three/src/materials/PointsMaterial'; import { Points } from 'three/src/objects/Points'; import { Line } from 'three/src/objects/Line'; -// import hull from 'hull.js/src/hull'; -// import concaveman from 'concaveman/index'; +import hull from 'hull.js/src/hull'; +import concaveman from 'concaveman/index'; +import { Color } from 'three/src/math/Color'; + + const POINTURL = 'https://geusegdi01.geus.dk/geom3d/data/nodes/'; const EDGEURL = 'https://geusegdi01.geus.dk/geom3d/data/triangles/'; @@ -123,7 +126,9 @@ class TinLayer extends Layer { backStencil: Scene; capsScene: Scene; p_vertices: Array; - tolerance : number = 0.001; + tolerance: number = 0.01; + pointsOfIntersection: BufferGeometry; + borderMaterial; constructor(params) { super(); @@ -147,62 +152,53 @@ class TinLayer extends Layer { buildBorder(vertices) { let box = this.box = new UpdatableBoxGeometry(vertices); - - - this.getScene().add(this.borderGroup); - + // this.getScene().add(this.borderGroup); - // this.boxMesh = new Mesh(box, material.capMaterial); + let color = parseInt(this.color, 16); - // let color = parseInt(this.color, 16); - // let meshMaterial = new MeshBasicMaterial({ - // color: color, + let planeGeom = new PlaneGeometry(this.box.vertices[0], this.box.vertices[1], this.box.vertices[2], this.box.vertices[3]); + + let caps = { + // red + color: { type: "c", value: new Color(color) } + } + let profileMaterial = material.profileMaterial.clone(); + profileMaterial.uniforms = caps; + this.borderMesh = new Mesh(box, profileMaterial); + // this.borderMesh.name = 'stencilFeatureBack_' + this.index; + this.borderMesh.name = 'profilePlane_' + this.name; + // this.borderMesh.onAfterRender = this.debugRenderOrder; + + + // this.boxMesh = new Mesh(box, material.profileMaterial); + + + + // //let planeGeom = this.planeGeom = new PlaneGeometry(vertices[0], vertices[1], vertices[5], vertices[4]); + // let planeGeom = this.planeGeom = new PlaneGeometry(this.box.vertices[0], this.box.vertices[1], this.box.vertices[2], this.box.vertices[3]); + // // planeGeom.rotateX(-Math.PI / 2); + // let plane = new Mesh(planeGeom, new MeshBasicMaterial({ + // color: "lightgray", + // transparent: true, + // opacity: 0.75, // side: DoubleSide + // })); + // // this._addObject(plane, false); + + // let pointsOfIntersection = this.pointsOfIntersection = new BufferGeometry(); + // let p_vertices = new Array(); // 3 vertices per point + // // let positions = new Float32BufferAttribute(p_vertices, 3); + // // pointsOfIntersection.setAttribute('position', positions); + + // var pointsMaterial = new PointsMaterial({ + // size: 100, + // color: 0xff0000 // }); - // this.materialsArray.push(meshMaterial); - // let meshA = this.mainMesh; - // let meshB = this.borderMesh = new Mesh(box, meshMaterial); - // this._addObject(mesh, false); + // var points = new Points(pointsOfIntersection, pointsMaterial); + // this._addObject(points, false); - // Make sure the .matrix of each mesh is current - // meshA.updateMatrix(); - // meshB.updateMatrix(); - // // Subtract meshB from meshA - // this.borderMesh = CSG.subtract(meshA, meshB); - // this._addObject(this.borderMesh, false); - - - - //let planeGeom = this.planeGeom = new PlaneGeometry(vertices[0], vertices[1], vertices[5], vertices[4]); - let planeGeom = this.planeGeom = new PlaneGeometry(this.box.vertices[0], this.box.vertices[1], this.box.vertices[2], this.box.vertices[3]); - // planeGeom.rotateX(-Math.PI / 2); - let plane = new Mesh(planeGeom, new MeshBasicMaterial({ - color: "lightgray", - transparent: true, - opacity: 0.75, - side: DoubleSide - })); - // this._addObject(plane, false); - - let pointsOfIntersection = new BufferGeometry(); - let p_vertices = new Array(); // 3 vertices per point - // let positions = new Float32BufferAttribute(p_vertices, 3); - // pointsOfIntersection.setAttribute('position', positions); - - var pointsMaterial = new PointsMaterial({ - size: 100, - color: 0xff0000 - }); - var points = new Points(pointsOfIntersection, pointsMaterial); - this._addObject(points, false); - - // let color = parseInt(this.color, 16); - // var mesh = new Mesh( - // pointsOfIntersection, // re-use the existing geometry - // new MeshBasicMaterial({ color: 0xa9a9a9, side: DoubleSide }) - // ); - // this._addObject(mesh, false); + // var lines = new LineSegments(pointsOfIntersection, new LineBasicMaterial({ // color: 0xa9a9a9 @@ -215,15 +211,7 @@ class TinLayer extends Layer { // let meshMaterial = new MeshBasicMaterial({ // color: 0xa9a9a9 // }); - // let convexGeometry;// = new ConvexGeometry( p_vertices ); - // const mesh1 = new Mesh( convexGeometry, meshMaterial ); - // this._addObject(mesh1, false); - - // let meshMaterial = new MeshBasicMaterial({ - // color: 0xa9a9a9 - // }); - // let mesh = new Mesh(pointsOfIntersection, meshMaterial); - // this._addObject(mesh, false); + let a = new Vector3(), b = new Vector3(), @@ -236,98 +224,110 @@ class TinLayer extends Layer { lineCA = new Line3(); // let pointOfIntersection = new Vector3(); - box.addEventListener("update", (event) => { - let ar = new Array(this.box.vertices[0], this.box.vertices[1], this.box.vertices[2], this.box.vertices[3]); - this.planeGeom.setFromPoints(ar); - this.planeGeom.update(); + // box.addEventListener("update", (event) => { + // let ar = new Array(this.box.vertices[0], this.box.vertices[1], this.box.vertices[2], this.box.vertices[3]); + // this.planeGeom.setFromPoints(ar); + // this.planeGeom.update(); - this.borderGroup.clear(); + // this.borderGroup.clear(); - this.p_vertices = []; - vertices = []; + // this.p_vertices = []; + // vertices = []; - let mathPlane = new Plane(); - plane.localToWorld(planePointA.copy(plane.geometry.vertices[0])); - plane.localToWorld(planePointB.copy(plane.geometry.vertices[1])); - plane.localToWorld(planePointC.copy(plane.geometry.vertices[2])); - mathPlane.setFromCoplanarPoints(planePointA, planePointB, planePointC); + // let mathPlane = new Plane(); + // plane.localToWorld(planePointA.copy(plane.geometry.vertices[0])); + // plane.localToWorld(planePointB.copy(plane.geometry.vertices[1])); + // plane.localToWorld(planePointC.copy(plane.geometry.vertices[2])); + // mathPlane.setFromCoplanarPoints(planePointA, planePointB, planePointC); - - let geom = this.mainMesh.geometry; - // this.mainMesh.geometry.faces.forEach(function (face) { - for (let vi = 0; vi < geom.index.array.length; vi += 3) { - let idx0 = geom.index.array[vi]; - let idx1 = geom.index.array[vi + 1]; - let idx2 = geom.index.array[vi + 2]; + // let geom = this.mainMesh.geometry; + // // this.mainMesh.geometry.faces.forEach(function (face) { + // for (let vi = 0; vi < geom.index.array.length; vi += 3) { - let vx0 = geom.attributes.position.array[3 * idx0]; - let vy0 = geom.attributes.position.array[3 * idx0 + 1]; - let vz0 = geom.attributes.position.array[3 * idx0 + 2]; + // let idx0 = geom.index.array[vi]; + // let idx1 = geom.index.array[vi + 1]; + // let idx2 = geom.index.array[vi + 2]; - let vx1 = geom.attributes.position.array[3 * idx1]; - let vy1 = geom.attributes.position.array[3 * idx1 + 1]; - let vz1 = geom.attributes.position.array[3 * idx1 + 2]; + // let vx0 = geom.attributes.position.array[3 * idx0]; + // let vy0 = geom.attributes.position.array[3 * idx0 + 1]; + // let vz0 = geom.attributes.position.array[3 * idx0 + 2]; - let vx2 = geom.attributes.position.array[3 * idx2]; - let vy2 = geom.attributes.position.array[3 * idx2 + 1]; - let vz2 = geom.attributes.position.array[3 * idx2 + 2]; + // let vx1 = geom.attributes.position.array[3 * idx1]; + // let vy1 = geom.attributes.position.array[3 * idx1 + 1]; + // let vz1 = geom.attributes.position.array[3 * idx1 + 2]; - let v0 = new Vector3(vx0, vy0, vz0); - let v1 = new Vector3(vx1, vy1, vz1); - let v2 = new Vector3(vx2, vy2, vz2); + // let vx2 = geom.attributes.position.array[3 * idx2]; + // let vy2 = geom.attributes.position.array[3 * idx2 + 1]; + // let vz2 = geom.attributes.position.array[3 * idx2 + 2]; - this.mainMesh.localToWorld(a.copy(v0)); - this.mainMesh.localToWorld(b.copy(v1)); - this.mainMesh.localToWorld(c.copy(v2)); - lineAB = new Line3(a, b); - lineBC = new Line3(b, c); - lineCA = new Line3(c, a); - this.setPointOfIntersection(lineAB, mathPlane, vi); - this.setPointOfIntersection(lineBC, mathPlane, vi); - this.setPointOfIntersection(lineCA, mathPlane, vi); - } - if (this.p_vertices.length > 0) { - // pointsOfIntersection.setFromPoints(p_vertices); - // pointsOfIntersection.computeBoundingSphere() - // pointsOfIntersection.attributes.position.needsUpdate = true; + // let v0 = new Vector3(vx0, vy0, vz0); + // let v1 = new Vector3(vx1, vy1, vz1); + // let v2 = new Vector3(vx2, vy2, vz2); - // // convexGeometry.setFromPoints(p_vertices); - // convexGeometry = new ConvexGeometry( p_vertices ); - // convexGeometry.computeBoundingSphere() - // convexGeometry.attributes.position.needsUpdate = true; - let test = this.p_vertices.map(v => { - return [v.x, v.y, v.z]; - }); - // const indexHull = hull(test, 1); // returns points of the hull (in clockwise order) - // let vertices = indexHull.map(a => { - // return new Vector3(a[0], a[1], a[2]); - // }); + // this.mainMesh.localToWorld(a.copy(v0)); + // this.mainMesh.localToWorld(b.copy(v1)); + // this.mainMesh.localToWorld(c.copy(v2)); + // lineAB = new Line3(a, b); + // lineBC = new Line3(b, c); + // lineCA = new Line3(c, a); + // let p1 = this.setPointOfIntersection(lineAB, mathPlane, vi); + // let p2 = this.setPointOfIntersection(lineBC, mathPlane, vi); + // let p3 = this.setPointOfIntersection(lineCA, mathPlane, vi); + // // if (p1.x != 0 && p1.y != 0 && p1.z != 0 && p2.x != 0 && p2.y != 0 && p2.z != 0 && p3.x != 0 && p3.y != 0 && p3.z != 0) { + // // this.p_vertices.push(p1, p2, p3); + // // } - // const indexAlpha = concaveman(test, 1); - // let vertices = indexAlpha.map(a => { - // return new Vector3(a[0], a[1], a[2]); - // }); - - pointsOfIntersection.setFromPoints(this.p_vertices); - pointsOfIntersection.computeBoundingSphere() - pointsOfIntersection.attributes.position.needsUpdate = true; + // } + // if (this.p_vertices.length > 0) { + // // pointsOfIntersection.setFromPoints(p_vertices); + // // pointsOfIntersection.computeBoundingSphere() + // // pointsOfIntersection.attributes.position.needsUpdate = true; - let contours = this.getContours(this.p_vertices, [], true); - contours.forEach(cntr => { - let cntrGeom = new BufferGeometry(); - cntrGeom.setFromPoints(cntr); - let contour = new Line(cntrGeom, new LineBasicMaterial({ - color: Math.random() * 0xffffff //0x777777 + 0x777777 - })); - this.borderGroup.add(contour); - }); - } + // // // convexGeometry.setFromPoints(p_vertices); + // // convexGeometry = new ConvexGeometry( p_vertices ); + // // convexGeometry.computeBoundingSphere() + // // convexGeometry.attributes.position.needsUpdate = true; + + // // let test = this.p_vertices.map(v => { + // // return [v.x, v.z]; + // // }); + // // // const indexHull = hull(test, 20); // returns points of the hull (in clockwise order) + // // const indexHull = concaveman(test, 1.5); + // // let vertices = indexHull.map(a => { + // // return new Vector3(a[0], this.p_vertices[0].y, a[1]); + // // }); + // // let cntrGeom = new BufferGeometry(); + // // cntrGeom.setFromPoints(vertices); + // // let contour = new Line(cntrGeom, new LineBasicMaterial({ + // // color: Math.random() * 0xffffff //0x777777 + 0x777777 + // // })); + // // this.borderGroup.add(contour); + + // // const indexAlpha = concaveman(test, 1); + // // let vertices = indexAlpha.map(a => { + // // return new Vector3(a[0], a[1], a[2]); + // // }); + + // pointsOfIntersection.setFromPoints(this.p_vertices); + // pointsOfIntersection.computeBoundingSphere() + // pointsOfIntersection.attributes.position.needsUpdate = true; + + // let contours = this.getContours(this.p_vertices, [], true); + // contours.forEach(cntr => { + // let cntrGeom = new BufferGeometry(); + // cntrGeom.setFromPoints(cntr); + // let contour = new Line(cntrGeom, new LineBasicMaterial({ + // color: Math.random() * 0xffffff //0x777777 + 0x777777 + // })); + // this.borderGroup.add(contour); + // }); + // } - }); + // }); @@ -344,6 +344,10 @@ class TinLayer extends Layer { // this.capsScene = new Scene(); // this.capsScene.add(this.borderMesh); } + debugRenderOrder() { + console.log(this.name); + } + private setPointOfIntersection(line: Line3, plane: Plane, faceIndex: number): void { let pointOfIntersection = new Point3(); @@ -353,7 +357,9 @@ class TinLayer extends Layer { pointOfIntersection.checked = false; pointOfIntersection.faceIndex = faceIndex; this.p_vertices.push(pointOfIntersection); + } + // return pointOfIntersection; } private getContours(points: Array, contours: Array, firstRun: boolean) { @@ -380,7 +386,9 @@ class TinLayer extends Layer { } contour = this.getContour(secondPoint, points, contour); - contours.push(contour); + if (contour != undefined) { + contours.push(contour); + } let allChecked = 0; points.forEach(p => { allChecked += p.checked == true ? 1 : 0; }); // console.log("allChecked: ", allChecked == points.length); @@ -388,7 +396,49 @@ class TinLayer extends Layer { return contours; } + private getContour(currentPoint: Point3, points, contour) { + let p1Index = this.getNearestPointIndex(currentPoint, points); + let p1 = points[p1Index]; + p1.checked = true; + let p2Index = this.getPairIndex(p1, p1Index, points); + if (p2Index == 0) { + // return; + p2Index = this.getClosestPoint(p1, p1Index, points); + } + if (p2Index == 0) { + return; + } + let p2 = points[p2Index]; + p2.checked = true; + let isClosed = p2.equals(contour[0], this.tolerance); + if (!isClosed) { + contour.push(p2); + return this.getContour(p2, points, contour); + } else { + // it is closes, exit + contour.push(contour[0]); + return contour; + } + } + private getClosestPoint(point, pointIndex, points) { + let closestPointIndex: number; + let closestDistance: number = 99999999999999999; //something big + for (let i = 0; i < points.length; i++) { + let p = points[i]; + if (i == pointIndex && p.checked == true) { + continue; + } + let distance = point.distanceTo(p); + if (distance < closestDistance) { + closestDistance = distance; + closestPointIndex = i; + } + } + return closestPointIndex; + } + private getPairIndex(point, pointIndex, points) { + let index = 0; for (let i = 0; i < points.length; i++) { let p = points[i]; @@ -400,36 +450,19 @@ class TinLayer extends Layer { return index; } - private getContour(currentPoint: Point3, points, contour) { - let p1Index = this.getNearestPointIndex(currentPoint, points); - let p1 = points[p1Index]; - p1.checked = true; - let p2Index = this.getPairIndex(p1, p1Index, points); - let p2 = points[p2Index]; - p2.checked = true; - let isClosed = p2.equals(contour[0], this.tolerance); - if (!isClosed) { - contour.push(p2); - return this.getContour(p2, points, contour); - } else { - contour.push(contour[0]); - return contour; - } - } - - private getNearestPointIndex(point, points){ - let index = 0; - for (let i = 0; i < points.length; i++){ - // let p = points[i]; - if (points[i].checked == false && points[i].equals(point, this.tolerance)){ - index = i; - break; - } + private getNearestPointIndex(point: Point3, pointsArray: Array): number { + let index: number = 0; + for (let i = 0; i < pointsArray.length; i++) { + // let p = points[i]; + if (pointsArray[i].checked == false && pointsArray[i].equals(point, this.tolerance)) { + index = i; + break; + } } return index; - } - - + } + + // animate() { // let gl = this._map.renderer.getContext(); @@ -777,7 +810,7 @@ class TinLayer extends Layer { metalness: 0.1, roughness: 0.75, flatShading: true, - side: DoubleSide + side: DoubleSide, }, this.uniforms.clipping); // }, this.uniforms.clipping); } @@ -785,6 +818,8 @@ class TinLayer extends Layer { this.materialsArray.push(this.material); let mesh = this.mainMesh = new Mesh(geometry, this.material); mesh.userData.layerId = this.index; + mesh.castShadow = true; + mesh.receiveShadow = true; this._addObject(mesh, true); if (app_scene) { app_scene.add(this.objectGroup); diff --git a/src/js/main.js b/src/js/main.js index eb996fc..f0bf8c6 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -185,68 +185,61 @@ class Application { map.on('ready', () => { this.selectionBox.setUniforms(); + - this.capsScene.add(this.selectionBox.boxMesh); + // this.capsScene.add(this.selectionBox.boxMesh); // this.scene.add(this.selection.displayMeshes); // this.scene.add(this.selection.touchMeshes); this.map.addLayer(this.selectionBox); - // for (const [key, layer] of Object.entries(this.map.layers)) { - // // let layer = map.layers[i]; - // if (layer instanceof TinLayer && layer.name != "Topography") { - // // let capsScene = new Scene(); - // // capsScene.add(layer.borderMesh); - // // this.capsSceneArray.push(capsScene); - // this.capsScene.add(layer.borderMesh); - // layer.on('visibility-change', (args) => { - // let visible = args[0]; - // layer.borderMesh.visible = visible; - // }); - // } - // } - - let frontGroup = new Group(); - for (var i in map.layers) { - let layer = map.layers[i]; - if (layer instanceof TinLayer && layer.name != "Topography") { - let mesh = new Mesh(layer.geometry.clone(), material.frontStencilMaterial); - mesh.userData.layerId = layer.index; - frontGroup.add(mesh); + let profileNode = new Group(); + for (const [key, layer] of Object.entries(this.map.layers)) { + // let layer = map.layers[i]; + if (layer instanceof TinLayer && layer.name != "Topography") { + // this.capsScene.add(layer.borderMesh); + profileNode.add(layer.borderMesh); layer.on('visibility-change', (args) => { let visible = args[0]; - mesh.visible = visible; + layer.borderMesh.visible = visible; }); layer.on('scale-change', (args) => { let z = args[0]; - mesh.scale.z = z; + layer.borderMesh.scale.z = z; }); } } - frontGroup.updateMatrix(); - // let frontMesh = new Mesh(frontGroup, material.frontStencilMaterial); - this.frontStencil.add(frontGroup); + // this.scene.add(profileNode); - let backGroup = new Group(); + let stencilNode = new Group(); for (var i in map.layers) { let layer = map.layers[i]; if (layer instanceof TinLayer && layer.name != "Topography") { - let mesh = new Mesh(layer.geometry.clone(), material.backStencilMaterial); - mesh.userData.layerId = layer.index; - backGroup.add(mesh); + let stencilFeatureBack = new Mesh(layer.geometry, material.backStencilMaterial); + stencilFeatureBack.name = 'stencilFeatureBack_' + i; + stencilFeatureBack.userData.layerId = layer.index; + stencilNode.add(stencilFeatureBack); + + let stencilFeatureFront = new Mesh(layer.geometry, material.frontStencilMaterial); + stencilFeatureFront.name = 'stencilFeatureFront_' + i; + stencilFeatureFront.userData.layerId = layer.index; + stencilNode.add(stencilFeatureFront); layer.on('visibility-change', (args) => { let visible = args[0]; - mesh.visible = visible; + stencilFeatureFront.visible = visible; + stencilFeatureBack.visible = visible; }); layer.on('scale-change', (args) => { let z = args[0]; - mesh.scale.z = z; + stencilFeatureFront.scale.z = z; + stencilFeatureBack.scale.z = z; }); - } - } - backGroup.updateMatrix(); - // let frontMesh = new Mesh(frontGroup, material.frontStencilMaterial); - this.backStencil.add(backGroup); + } + + // scene.add(node('selectNode')); + // scene.add(node('modelNode')); + this.scene.add(stencilNode); + this.scene.add(profileNode); this.animate(); }, this); @@ -408,7 +401,7 @@ class Application { // this.renderer.render(this.capsScene, this.map.camera); // // disable stencil test - // gl.disable(gl.STENCIL_TEST); + // gl.disable(gl.STENCIL_TEST); // // gl.stencilMask(0); // // this.renderer.state.setStencilFunc( false ); // }