fl-web-component 2.0.6 → 2.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/fl-web-component.common.js +1229 -1213
- package/dist/fl-web-component.common.js.map +1 -1
- package/dist/fl-web-component.css +1 -1
- package/package.json +1 -1
- package/packages/components/com-graphics/index.vue +897 -770
- package/src/utils/threejs/measure-angle.js +17 -15
- package/src/utils/threejs/measure-area.js +17 -14
- package/src/utils/threejs/measure-distance.js +16 -14
- package/src/utils/threejs/measure-height.js +14 -12
|
@@ -2304,6 +2304,17 @@ exports.Kaleidoscope = Kaleidoscope;
|
|
|
2304
2304
|
Factory_1.Factory.addGetterSetter(Node_1.Node, 'kaleidoscopePower', 2, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
|
|
2305
2305
|
Factory_1.Factory.addGetterSetter(Node_1.Node, 'kaleidoscopeAngle', 0, (0, Validators_1.getNumberValidator)(), Factory_1.Factory.afterSetFilter);
|
|
2306
2306
|
|
|
2307
|
+
/***/ }),
|
|
2308
|
+
|
|
2309
|
+
/***/ "1ebb":
|
|
2310
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
2311
|
+
|
|
2312
|
+
"use strict";
|
|
2313
|
+
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_701092d4_prod_lang_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("a4a4");
|
|
2314
|
+
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_701092d4_prod_lang_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_701092d4_prod_lang_css__WEBPACK_IMPORTED_MODULE_0__);
|
|
2315
|
+
/* unused harmony reexport * */
|
|
2316
|
+
|
|
2317
|
+
|
|
2307
2318
|
/***/ }),
|
|
2308
2319
|
|
|
2309
2320
|
/***/ "1f21":
|
|
@@ -3076,6 +3087,13 @@ module.exports = _slicedToArray, module.exports.__esModule = true, module.export
|
|
|
3076
3087
|
|
|
3077
3088
|
/***/ }),
|
|
3078
3089
|
|
|
3090
|
+
/***/ "279e":
|
|
3091
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
3092
|
+
|
|
3093
|
+
// extracted by mini-css-extract-plugin
|
|
3094
|
+
|
|
3095
|
+
/***/ }),
|
|
3096
|
+
|
|
3079
3097
|
/***/ "2905":
|
|
3080
3098
|
/***/ (function(module, exports, __webpack_require__) {
|
|
3081
3099
|
|
|
@@ -37261,17 +37279,6 @@ setToStringTag(Math, 'Math', true);
|
|
|
37261
37279
|
// 24.3.3 JSON[@@toStringTag]
|
|
37262
37280
|
setToStringTag(global.JSON, 'JSON', true);
|
|
37263
37281
|
|
|
37264
|
-
/***/ }),
|
|
37265
|
-
|
|
37266
|
-
/***/ "69ec":
|
|
37267
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
37268
|
-
|
|
37269
|
-
"use strict";
|
|
37270
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_78d8f350_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("6bd0");
|
|
37271
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_78d8f350_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_78d8f350_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
|
|
37272
|
-
/* unused harmony reexport * */
|
|
37273
|
-
|
|
37274
|
-
|
|
37275
37282
|
/***/ }),
|
|
37276
37283
|
|
|
37277
37284
|
/***/ "6ac9":
|
|
@@ -37924,13 +37931,6 @@ Factory_1.Factory.addGetterSetter(Node_1.Node, 'brightness', 0, (0, Validators_1
|
|
|
37924
37931
|
|
|
37925
37932
|
/***/ }),
|
|
37926
37933
|
|
|
37927
|
-
/***/ "6bd0":
|
|
37928
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
37929
|
-
|
|
37930
|
-
// extracted by mini-css-extract-plugin
|
|
37931
|
-
|
|
37932
|
-
/***/ }),
|
|
37933
|
-
|
|
37934
37934
|
/***/ "6ca1":
|
|
37935
37935
|
/***/ (function(module, exports, __webpack_require__) {
|
|
37936
37936
|
|
|
@@ -41717,6 +41717,17 @@ function unzipSync(data, opts) {
|
|
|
41717
41717
|
return files;
|
|
41718
41718
|
}
|
|
41719
41719
|
|
|
41720
|
+
/***/ }),
|
|
41721
|
+
|
|
41722
|
+
/***/ "7555":
|
|
41723
|
+
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
41724
|
+
|
|
41725
|
+
"use strict";
|
|
41726
|
+
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_701092d4_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("279e");
|
|
41727
|
+
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_701092d4_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_8_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_8_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_8_oneOf_1_2_node_modules_sass_loader_dist_cjs_js_ref_8_oneOf_1_3_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_0_id_701092d4_prod_lang_scss_scoped_true__WEBPACK_IMPORTED_MODULE_0__);
|
|
41728
|
+
/* unused harmony reexport * */
|
|
41729
|
+
|
|
41730
|
+
|
|
41720
41731
|
/***/ }),
|
|
41721
41732
|
|
|
41722
41733
|
/***/ "769d":
|
|
@@ -43880,17 +43891,6 @@ Factory_1.Factory.addGetterSetter(Arc, 'outerRadius', 0, (0, Validators_1.getNum
|
|
|
43880
43891
|
Factory_1.Factory.addGetterSetter(Arc, 'angle', 0, (0, Validators_1.getNumberValidator)());
|
|
43881
43892
|
Factory_1.Factory.addGetterSetter(Arc, 'clockwise', false, (0, Validators_1.getBooleanValidator)());
|
|
43882
43893
|
|
|
43883
|
-
/***/ }),
|
|
43884
|
-
|
|
43885
|
-
/***/ "860b":
|
|
43886
|
-
/***/ (function(module, __webpack_exports__, __webpack_require__) {
|
|
43887
|
-
|
|
43888
|
-
"use strict";
|
|
43889
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_78d8f350_prod_lang_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("e7b7");
|
|
43890
|
-
/* harmony import */ var _node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_78d8f350_prod_lang_css__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_node_modules_mini_css_extract_plugin_dist_loader_js_ref_6_oneOf_1_0_node_modules_css_loader_dist_cjs_js_ref_6_oneOf_1_1_node_modules_vue_loader_lib_loaders_stylePostLoader_js_node_modules_postcss_loader_src_index_js_ref_6_oneOf_1_2_node_modules_cache_loader_dist_cjs_js_ref_0_0_node_modules_vue_loader_lib_index_js_vue_loader_options_index_vue_vue_type_style_index_1_id_78d8f350_prod_lang_css__WEBPACK_IMPORTED_MODULE_0__);
|
|
43891
|
-
/* unused harmony reexport * */
|
|
43892
|
-
|
|
43893
|
-
|
|
43894
43894
|
/***/ }),
|
|
43895
43895
|
|
|
43896
43896
|
/***/ "8875":
|
|
@@ -56507,7 +56507,7 @@ module.exports = document && document.documentElement;
|
|
|
56507
56507
|
/***/ "9224":
|
|
56508
56508
|
/***/ (function(module) {
|
|
56509
56509
|
|
|
56510
|
-
module.exports = JSON.parse("{\"name\":\"fl-web-component\",\"version\":\"2.0.
|
|
56510
|
+
module.exports = JSON.parse("{\"name\":\"fl-web-component\",\"version\":\"2.0.7\",\"scripts\":{\"postinstall\":\"patch-package\",\"tip1\":\"仅调试本组件不涉及业务组件,请执行dev\",\"dev\":\"vue-cli-service serve\",\"lint\":\"eslint \\\"{src,packages}/**/*.{vue,js}\\\" --fix\",\"prettier\":\"prettier --write \\\"packages/**/*.{js,css,less,scss,vue,html}\\\"\",\"=\":\"=============================================================\",\"tip2\":\"同时调试本组件与业务组件,请执行watch\",\"watch\":\"vue-cli-service build --watch --mode production --target lib --name fl-web-component --formats commonjs ./src/main.js\",\"build\":\"npm run lint && vue-cli-service build --target lib --name fl-web-component --formats commonjs ./src/main.js\",\"build:test\":\"vue-cli-service build --target lib --name fl-web-component --formats commonjs ./src/main.js\",\"publish:base\":\"npm run build && npm publish --registry https://registry.npmjs.org/\",\"publish:beta:base\":\"npm run build && npm publish --tag beta --registry https://registry.npmjs.org/\",\"==\":\"=============================================================\",\"tip3\":\"发版注意: 【测试版执行publish:beta】【修改bug执行publish:fix】【新增功能执行publish:feat】【新特性执行publish:perf】\",\"publish:beta\":\"npm version prerelease --preid=beta && npm run publish:beta:base\",\"publish:fix\":\"npm version patch && npm run publish:base\",\"publish:feat\":\"npm version minor && npm run publish:base\",\"publish:perf\":\"npm version major && npm run publish:base\"},\"files\":[\"dist\",\"packages\",\"src\"],\"main\":\"dist/fl-web-component.common.js\",\"dependencies\":{\"camera-controls\":\"2.9.0\",\"core-js\":\"^3.42.0\",\"dxf-parser\":\"^1.1.2\",\"element-ui\":\"2.15.14\",\"fflate\":\"^0.8.2\",\"html2canvas\":\"^1.4.1\",\"jspdf\":\"^3.0.1\",\"konva\":\"^9.3.12\",\"lodash\":\"^4.17.21\",\"meshline\":\"^3.3.1\",\"regenerator-runtime\":\"^0.14.1\",\"svg-pan-zoom\":\"^3.6.2\",\"three\":\"^0.176.0\",\"three.path\":\"^1.0.1\",\"vue\":\"^2.6.11\"},\"devDependencies\":{\"@babel/core\":\"^7.12.16\",\"@babel/plugin-proposal-nullish-coalescing-operator\":\"^7.18.6\",\"@babel/plugin-proposal-optional-chaining\":\"^7.21.0\",\"@babel/preset-env\":\"^7.0.0\",\"@babel/runtime-corejs3\":\"^7.27.1\",\"@vue/cli-plugin-babel\":\"~4.4.0\",\"@vue/cli-plugin-eslint\":\"~4.4.0\",\"@vue/cli-service\":\"~4.4.0\",\"babel-eslint\":\"^10.1.0\",\"babel-loader\":\"^8.0.0\",\"copy-webpack-plugin\":\"^4.0.1\",\"eslint\":\"^6.7.2\",\"eslint-config-prettier\":\"^6.15.0\",\"eslint-plugin-prettier\":\"^3.4.1\",\"eslint-plugin-vue\":\"^6.2.2\",\"patch-package\":\"^6.4.7\",\"prettier\":\"^2.8.8\",\"sass\":\"1.32.13\",\"sass-loader\":\"10.1.1\",\"vue-template-compiler\":\"^2.6.11\",\"worker-loader\":\"^3.0.8\"},\"browserslist\":[\"> 1%\",\"last 2 versions\"]}");
|
|
56511
56511
|
|
|
56512
56512
|
/***/ }),
|
|
56513
56513
|
|
|
@@ -59256,6 +59256,13 @@ module.exports = ExecutionEnvironment;
|
|
|
59256
59256
|
|
|
59257
59257
|
/***/ }),
|
|
59258
59258
|
|
|
59259
|
+
/***/ "a4a4":
|
|
59260
|
+
/***/ (function(module, exports, __webpack_require__) {
|
|
59261
|
+
|
|
59262
|
+
// extracted by mini-css-extract-plugin
|
|
59263
|
+
|
|
59264
|
+
/***/ }),
|
|
59265
|
+
|
|
59259
59266
|
/***/ "a742":
|
|
59260
59267
|
/***/ (function(module, exports, __webpack_require__) {
|
|
59261
59268
|
|
|
@@ -74014,13 +74021,6 @@ module.exports = /******/function (modules) {
|
|
|
74014
74021
|
|
|
74015
74022
|
/***/ }),
|
|
74016
74023
|
|
|
74017
|
-
/***/ "e7b7":
|
|
74018
|
-
/***/ (function(module, exports, __webpack_require__) {
|
|
74019
|
-
|
|
74020
|
-
// extracted by mini-css-extract-plugin
|
|
74021
|
-
|
|
74022
|
-
/***/ }),
|
|
74023
|
-
|
|
74024
74024
|
/***/ "e974":
|
|
74025
74025
|
/***/ (function(module, exports, __webpack_require__) {
|
|
74026
74026
|
|
|
@@ -78641,19 +78641,20 @@ if (typeof window !== 'undefined') {
|
|
|
78641
78641
|
// Indicate to webpack that this file can be concatenated
|
|
78642
78642
|
/* harmony default export */ var setPublicPath = (null);
|
|
78643
78643
|
|
|
78644
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
78645
|
-
var
|
|
78644
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"4b508e4e-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/index.vue?vue&type=template&id=701092d4&scoped=true
|
|
78645
|
+
var com_graphicsvue_type_template_id_701092d4_scoped_true_render = function render() {
|
|
78646
78646
|
var _vm = this,
|
|
78647
78647
|
_c = _vm._self._c;
|
|
78648
78648
|
return _c('div', {
|
|
78649
|
+
staticClass: "fl-model-containor",
|
|
78649
78650
|
attrs: {
|
|
78650
|
-
"id":
|
|
78651
|
+
"id": _vm.containId
|
|
78651
78652
|
}
|
|
78652
78653
|
});
|
|
78653
78654
|
};
|
|
78654
78655
|
var staticRenderFns = [];
|
|
78655
78656
|
|
|
78656
|
-
// CONCATENATED MODULE: ./packages/components/com-graphics/index.vue?vue&type=template&id=
|
|
78657
|
+
// CONCATENATED MODULE: ./packages/components/com-graphics/index.vue?vue&type=template&id=701092d4&scoped=true
|
|
78657
78658
|
|
|
78658
78659
|
// CONCATENATED MODULE: ./node_modules/camera-controls/dist/camera-controls.module.js
|
|
78659
78660
|
function _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }
|
|
@@ -105913,25 +105914,27 @@ measure_distance_MeasureDistance.prototype = {
|
|
|
105913
105914
|
measure_distance_this.renderer.domElement.removeEventListener('mousemove', measure_distance_this.mousemove);
|
|
105914
105915
|
}
|
|
105915
105916
|
},
|
|
105916
|
-
close: function close() {
|
|
105917
|
+
close: function close(isClear) {
|
|
105917
105918
|
this.renderer.domElement.removeEventListener('mousedown', this.mousedown);
|
|
105918
105919
|
this.renderer.domElement.removeEventListener('mouseup', this.click);
|
|
105919
105920
|
this.renderer.domElement.removeEventListener('mousemove', this.mousemove);
|
|
105920
105921
|
this.renderer.domElement.removeEventListener('contextmenu', this.rightClick);
|
|
105921
|
-
|
|
105922
|
-
|
|
105923
|
-
|
|
105924
|
-
|
|
105925
|
-
|
|
105926
|
-
|
|
105927
|
-
|
|
105928
|
-
|
|
105929
|
-
|
|
105930
|
-
|
|
105931
|
-
|
|
105932
|
-
|
|
105922
|
+
if (!isClear) {
|
|
105923
|
+
this.remove(this.points);
|
|
105924
|
+
this.remove(this.polyline);
|
|
105925
|
+
this.remove(this.labels);
|
|
105926
|
+
this.pointArray.splice(0);
|
|
105927
|
+
this.points.splice(0);
|
|
105928
|
+
this.polyline.splice(0);
|
|
105929
|
+
this.labels.splice(0);
|
|
105930
|
+
this.tempPoints = undefined;
|
|
105931
|
+
this.tempLabel = undefined;
|
|
105932
|
+
this.tempLine = undefined;
|
|
105933
|
+
this.scene.remove(this.tipsLabel);
|
|
105934
|
+
this.tipsLabel = undefined;
|
|
105935
|
+
this.firstTime = 0;
|
|
105936
|
+
}
|
|
105933
105937
|
this.renderer.domElement.style.cursor = 'pointer';
|
|
105934
|
-
this.firstTime = 0;
|
|
105935
105938
|
},
|
|
105936
105939
|
remove: function remove(array) {
|
|
105937
105940
|
for (var index = 0; index < array.length; index++) {
|
|
@@ -106188,24 +106191,26 @@ measure_area_MeasureArea.prototype = {
|
|
|
106188
106191
|
measure_area_this.renderer.domElement.removeEventListener('mousemove', measure_area_this.mousemove);
|
|
106189
106192
|
}
|
|
106190
106193
|
},
|
|
106191
|
-
close: function close() {
|
|
106194
|
+
close: function close(isClear) {
|
|
106192
106195
|
this.renderer.domElement.removeEventListener('mouseup', this.click);
|
|
106193
106196
|
this.renderer.domElement.removeEventListener('mousedown', this.mousedown);
|
|
106194
106197
|
this.renderer.domElement.removeEventListener('mousemove', this.mousemove);
|
|
106195
106198
|
this.renderer.domElement.removeEventListener('contextmenu', this.rightClick);
|
|
106196
|
-
|
|
106197
|
-
|
|
106198
|
-
|
|
106199
|
-
|
|
106200
|
-
|
|
106201
|
-
|
|
106202
|
-
|
|
106203
|
-
|
|
106204
|
-
|
|
106205
|
-
|
|
106206
|
-
|
|
106207
|
-
|
|
106208
|
-
|
|
106199
|
+
if (!isClear) {
|
|
106200
|
+
this.remove(this.points);
|
|
106201
|
+
this.remove(this.polyline);
|
|
106202
|
+
this.remove(this.labels);
|
|
106203
|
+
this.remove(this.polygons);
|
|
106204
|
+
this.pointArray.splice(0);
|
|
106205
|
+
this.points.splice(0);
|
|
106206
|
+
this.polyline.splice(0);
|
|
106207
|
+
this.labels.splice(0);
|
|
106208
|
+
this.tempPoints = undefined;
|
|
106209
|
+
this.tempLabel = undefined;
|
|
106210
|
+
this.tempLine = undefined;
|
|
106211
|
+
this.scene.remove(this.tipsLabel);
|
|
106212
|
+
this.tipsLabel = undefined;
|
|
106213
|
+
}
|
|
106209
106214
|
this.renderer.domElement.style.cursor = 'pointer';
|
|
106210
106215
|
},
|
|
106211
106216
|
remove: function remove(array) {
|
|
@@ -106521,25 +106526,27 @@ measure_angle_MeasureAngle.prototype = {
|
|
|
106521
106526
|
measure_angle_this.renderer.domElement.removeEventListener('mousemove', measure_angle_this.mousemove);
|
|
106522
106527
|
}
|
|
106523
106528
|
},
|
|
106524
|
-
close: function close() {
|
|
106529
|
+
close: function close(isClear) {
|
|
106525
106530
|
this.renderer.domElement.removeEventListener('mouseup', this.click, false);
|
|
106526
106531
|
this.renderer.domElement.removeEventListener('mousedown', this.mousedown, false);
|
|
106527
106532
|
this.renderer.domElement.removeEventListener('mousemove', this.mousemove, false);
|
|
106528
106533
|
this.renderer.domElement.removeEventListener('contextmenu', this.rightClick, false);
|
|
106529
|
-
|
|
106530
|
-
|
|
106531
|
-
|
|
106532
|
-
|
|
106533
|
-
|
|
106534
|
-
|
|
106535
|
-
|
|
106536
|
-
|
|
106537
|
-
|
|
106538
|
-
|
|
106539
|
-
|
|
106540
|
-
|
|
106541
|
-
|
|
106542
|
-
|
|
106534
|
+
if (!isClear) {
|
|
106535
|
+
this.remove(this.points);
|
|
106536
|
+
this.remove(this.polyline);
|
|
106537
|
+
this.remove(this.labels);
|
|
106538
|
+
this.remove(this.curves);
|
|
106539
|
+
this.pointArray.splice(0);
|
|
106540
|
+
this.points.splice(0);
|
|
106541
|
+
this.polyline.splice(0);
|
|
106542
|
+
this.labels.splice(0);
|
|
106543
|
+
this.curves.splice(0);
|
|
106544
|
+
this.tempPoints = undefined;
|
|
106545
|
+
this.tempLabel = undefined;
|
|
106546
|
+
this.tempLine = undefined;
|
|
106547
|
+
this.scene.remove(this.tipsLabel);
|
|
106548
|
+
this.tipsLabel = undefined;
|
|
106549
|
+
}
|
|
106543
106550
|
this.renderer.domElement.style.cursor = 'pointer';
|
|
106544
106551
|
},
|
|
106545
106552
|
remove: function remove(array) {
|
|
@@ -106762,21 +106769,23 @@ measure_height_MeasureHeight.prototype = {
|
|
|
106762
106769
|
measure_height_this.isCompleted = true;
|
|
106763
106770
|
}
|
|
106764
106771
|
},
|
|
106765
|
-
close: function close() {
|
|
106772
|
+
close: function close(isClear) {
|
|
106766
106773
|
this.renderer.domElement.removeEventListener('mousedown', this.mousedown);
|
|
106767
106774
|
this.renderer.domElement.removeEventListener('mouseup', this.click);
|
|
106768
106775
|
this.renderer.domElement.removeEventListener('contextmenu', this.rightClick);
|
|
106769
|
-
|
|
106770
|
-
|
|
106771
|
-
|
|
106772
|
-
|
|
106773
|
-
|
|
106774
|
-
|
|
106775
|
-
|
|
106776
|
-
|
|
106777
|
-
|
|
106778
|
-
|
|
106779
|
-
|
|
106776
|
+
if (!isClear) {
|
|
106777
|
+
this.remove(this.points);
|
|
106778
|
+
this.remove(this.polyline);
|
|
106779
|
+
this.remove(this.labels);
|
|
106780
|
+
this.pointArray.splice(0);
|
|
106781
|
+
this.points.splice(0);
|
|
106782
|
+
this.polyline.splice(0);
|
|
106783
|
+
this.labels.splice(0);
|
|
106784
|
+
this.scene.remove(this.tipsLabel);
|
|
106785
|
+
this.tipsLabel = undefined;
|
|
106786
|
+
this.renderer.domElement.style.cursor = 'pointer';
|
|
106787
|
+
this.firstTime = 0;
|
|
106788
|
+
}
|
|
106780
106789
|
},
|
|
106781
106790
|
remove: function remove(array) {
|
|
106782
106791
|
for (var index = 0; index < array.length; index++) {
|
|
@@ -114873,125 +114882,77 @@ function com_graphicsvue_type_script_lang_js_toConsumableArray(r) { return com_g
|
|
|
114873
114882
|
function com_graphicsvue_type_script_lang_js_nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
114874
114883
|
function com_graphicsvue_type_script_lang_js_iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
114875
114884
|
function com_graphicsvue_type_script_lang_js_arrayWithoutHoles(r) { if (Array.isArray(r)) return com_graphicsvue_type_script_lang_js_arrayLikeToArray(r); }
|
|
114876
|
-
function com_graphicsvue_type_script_lang_js_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
114877
|
-
function com_graphicsvue_type_script_lang_js_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { com_graphicsvue_type_script_lang_js_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { com_graphicsvue_type_script_lang_js_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
114878
|
-
function com_graphicsvue_type_script_lang_js_typeof(o) { "@babel/helpers - typeof"; return com_graphicsvue_type_script_lang_js_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, com_graphicsvue_type_script_lang_js_typeof(o); }
|
|
114879
|
-
function com_graphicsvue_type_script_lang_js_regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return com_graphicsvue_type_script_lang_js_regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (com_graphicsvue_type_script_lang_js_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, com_graphicsvue_type_script_lang_js_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, com_graphicsvue_type_script_lang_js_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), com_graphicsvue_type_script_lang_js_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", com_graphicsvue_type_script_lang_js_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), com_graphicsvue_type_script_lang_js_regeneratorDefine2(u), com_graphicsvue_type_script_lang_js_regeneratorDefine2(u, o, "Generator"), com_graphicsvue_type_script_lang_js_regeneratorDefine2(u, n, function () { return this; }), com_graphicsvue_type_script_lang_js_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (com_graphicsvue_type_script_lang_js_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
114880
|
-
function com_graphicsvue_type_script_lang_js_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } com_graphicsvue_type_script_lang_js_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { com_graphicsvue_type_script_lang_js_regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, com_graphicsvue_type_script_lang_js_regeneratorDefine2(e, r, n, t); }
|
|
114881
114885
|
function com_graphicsvue_type_script_lang_js_slicedToArray(r, e) { return com_graphicsvue_type_script_lang_js_arrayWithHoles(r) || com_graphicsvue_type_script_lang_js_iterableToArrayLimit(r, e) || com_graphicsvue_type_script_lang_js_unsupportedIterableToArray(r, e) || com_graphicsvue_type_script_lang_js_nonIterableRest(); }
|
|
114882
114886
|
function com_graphicsvue_type_script_lang_js_nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
114883
114887
|
function com_graphicsvue_type_script_lang_js_unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return com_graphicsvue_type_script_lang_js_arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? com_graphicsvue_type_script_lang_js_arrayLikeToArray(r, a) : void 0; } }
|
|
114884
114888
|
function com_graphicsvue_type_script_lang_js_arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
114885
114889
|
function com_graphicsvue_type_script_lang_js_iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
114886
114890
|
function com_graphicsvue_type_script_lang_js_arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
114887
|
-
var
|
|
114888
|
-
|
|
114889
|
-
|
|
114890
|
-
|
|
114891
|
-
|
|
114892
|
-
_context.n = 1;
|
|
114893
|
-
return v;
|
|
114894
|
-
case 1:
|
|
114895
|
-
_context.n = 0;
|
|
114896
|
-
break;
|
|
114897
|
-
case 2:
|
|
114898
|
-
return _context.a(2);
|
|
114899
|
-
}
|
|
114900
|
-
}, _callee);
|
|
114901
|
-
})(null),
|
|
114902
|
-
com_graphicsvue_type_script_lang_js_ref2 = com_graphicsvue_type_script_lang_js_slicedToArray(com_graphicsvue_type_script_lang_js_ref, 26),
|
|
114903
|
-
com_graphicsvue_type_script_lang_js_renderer = com_graphicsvue_type_script_lang_js_ref2[0],
|
|
114904
|
-
com_graphicsvue_type_script_lang_js_scene = com_graphicsvue_type_script_lang_js_ref2[1],
|
|
114905
|
-
com_graphicsvue_type_script_lang_js_camera = com_graphicsvue_type_script_lang_js_ref2[2],
|
|
114906
|
-
cameraControls = com_graphicsvue_type_script_lang_js_ref2[3],
|
|
114907
|
-
instructions = com_graphicsvue_type_script_lang_js_ref2[4],
|
|
114908
|
-
com_graphicsvue_type_script_lang_js_raycaster = com_graphicsvue_type_script_lang_js_ref2[5],
|
|
114909
|
-
com_graphicsvue_type_script_lang_js_mouse = com_graphicsvue_type_script_lang_js_ref2[6],
|
|
114910
|
-
labelRenderer = com_graphicsvue_type_script_lang_js_ref2[7],
|
|
114911
|
-
lineTexture = com_graphicsvue_type_script_lang_js_ref2[8],
|
|
114912
|
-
com_graphicsvue_type_script_lang_js_curve = com_graphicsvue_type_script_lang_js_ref2[9],
|
|
114913
|
-
downRaycaster = com_graphicsvue_type_script_lang_js_ref2[10],
|
|
114914
|
-
velocity = com_graphicsvue_type_script_lang_js_ref2[11],
|
|
114915
|
-
com_graphicsvue_type_script_lang_js_direction = com_graphicsvue_type_script_lang_js_ref2[12],
|
|
114916
|
-
clock = com_graphicsvue_type_script_lang_js_ref2[13],
|
|
114917
|
-
pointControls = com_graphicsvue_type_script_lang_js_ref2[14],
|
|
114918
|
-
threeMeasure = com_graphicsvue_type_script_lang_js_ref2[15],
|
|
114919
|
-
modelGroup = com_graphicsvue_type_script_lang_js_ref2[16],
|
|
114920
|
-
animateId = com_graphicsvue_type_script_lang_js_ref2[17],
|
|
114921
|
-
scenePass = com_graphicsvue_type_script_lang_js_ref2[18],
|
|
114922
|
-
outlineComposer = com_graphicsvue_type_script_lang_js_ref2[19],
|
|
114923
|
-
outlinePass = com_graphicsvue_type_script_lang_js_ref2[20],
|
|
114924
|
-
com_graphicsvue_type_script_lang_js_renderTarget = com_graphicsvue_type_script_lang_js_ref2[21],
|
|
114925
|
-
sceneClock = com_graphicsvue_type_script_lang_js_ref2[22],
|
|
114926
|
-
bizToThreeMatrix = com_graphicsvue_type_script_lang_js_ref2[23],
|
|
114927
|
-
threeToBizMatrix = com_graphicsvue_type_script_lang_js_ref2[24],
|
|
114928
|
-
stats = com_graphicsvue_type_script_lang_js_ref2[25];
|
|
114929
|
-
var _ref3 = /*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee2(v) {
|
|
114930
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context2) {
|
|
114931
|
-
while (1) switch (_context2.n) {
|
|
114932
|
-
case 0:
|
|
114933
|
-
if (false) {}
|
|
114934
|
-
_context2.n = 1;
|
|
114935
|
-
return v;
|
|
114936
|
-
case 1:
|
|
114937
|
-
_context2.n = 0;
|
|
114938
|
-
break;
|
|
114939
|
-
case 2:
|
|
114940
|
-
return _context2.a(2);
|
|
114941
|
-
}
|
|
114942
|
-
}, _callee2);
|
|
114943
|
-
})(0),
|
|
114944
|
-
_ref4 = com_graphicsvue_type_script_lang_js_slicedToArray(_ref3, 6),
|
|
114945
|
-
com_graphicsvue_type_script_lang_js_lastTime = _ref4[0],
|
|
114946
|
-
firstTime = _ref4[1],
|
|
114947
|
-
fpsClock = _ref4[2],
|
|
114948
|
-
timeStamp = _ref4[3],
|
|
114949
|
-
progress = _ref4[4],
|
|
114950
|
-
lastMiddleClickTime = _ref4[5];
|
|
114891
|
+
function com_graphicsvue_type_script_lang_js_regenerator() { /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */ var e, t, r = "function" == typeof Symbol ? Symbol : {}, n = r.iterator || "@@iterator", o = r.toStringTag || "@@toStringTag"; function i(r, n, o, i) { var c = n && n.prototype instanceof Generator ? n : Generator, u = Object.create(c.prototype); return com_graphicsvue_type_script_lang_js_regeneratorDefine2(u, "_invoke", function (r, n, o) { var i, c, u, f = 0, p = o || [], y = !1, G = { p: 0, n: 0, v: e, a: d, f: d.bind(e, 4), d: function d(t, r) { return i = t, c = 0, u = e, G.n = r, a; } }; function d(r, n) { for (c = r, u = n, t = 0; !y && f && !o && t < p.length; t++) { var o, i = p[t], d = G.p, l = i[2]; r > 3 ? (o = l === n) && (u = i[(c = i[4]) ? 5 : (c = 3, 3)], i[4] = i[5] = e) : i[0] <= d && ((o = r < 2 && d < i[1]) ? (c = 0, G.v = n, G.n = i[1]) : d < l && (o = r < 3 || i[0] > n || n > l) && (i[4] = r, i[5] = n, G.n = l, c = 0)); } if (o || r > 1) return a; throw y = !0, n; } return function (o, p, l) { if (f > 1) throw TypeError("Generator is already running"); for (y && 1 === p && d(p, l), c = p, u = l; (t = c < 2 ? e : u) || !y;) { i || (c ? c < 3 ? (c > 1 && (G.n = -1), d(c, u)) : G.n = u : G.v = u); try { if (f = 2, i) { if (c || (o = "next"), t = i[o]) { if (!(t = t.call(i, u))) throw TypeError("iterator result is not an object"); if (!t.done) return t; u = t.value, c < 2 && (c = 0); } else 1 === c && (t = i.return) && t.call(i), c < 2 && (u = TypeError("The iterator does not provide a '" + o + "' method"), c = 1); i = e; } else if ((t = (y = G.n < 0) ? u : r.call(n, G)) !== a) break; } catch (t) { i = e, c = 1, u = t; } finally { f = 1; } } return { value: t, done: y }; }; }(r, o, i), !0), u; } var a = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} t = Object.getPrototypeOf; var c = [][n] ? t(t([][n]())) : (com_graphicsvue_type_script_lang_js_regeneratorDefine2(t = {}, n, function () { return this; }), t), u = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(c); function f(e) { return Object.setPrototypeOf ? Object.setPrototypeOf(e, GeneratorFunctionPrototype) : (e.__proto__ = GeneratorFunctionPrototype, com_graphicsvue_type_script_lang_js_regeneratorDefine2(e, o, "GeneratorFunction")), e.prototype = Object.create(u), e; } return GeneratorFunction.prototype = GeneratorFunctionPrototype, com_graphicsvue_type_script_lang_js_regeneratorDefine2(u, "constructor", GeneratorFunctionPrototype), com_graphicsvue_type_script_lang_js_regeneratorDefine2(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = "GeneratorFunction", com_graphicsvue_type_script_lang_js_regeneratorDefine2(GeneratorFunctionPrototype, o, "GeneratorFunction"), com_graphicsvue_type_script_lang_js_regeneratorDefine2(u), com_graphicsvue_type_script_lang_js_regeneratorDefine2(u, o, "Generator"), com_graphicsvue_type_script_lang_js_regeneratorDefine2(u, n, function () { return this; }), com_graphicsvue_type_script_lang_js_regeneratorDefine2(u, "toString", function () { return "[object Generator]"; }), (com_graphicsvue_type_script_lang_js_regenerator = function _regenerator() { return { w: i, m: f }; })(); }
|
|
114892
|
+
function com_graphicsvue_type_script_lang_js_regeneratorDefine2(e, r, n, t) { var i = Object.defineProperty; try { i({}, "", {}); } catch (e) { i = 0; } com_graphicsvue_type_script_lang_js_regeneratorDefine2 = function _regeneratorDefine(e, r, n, t) { function o(r, n) { com_graphicsvue_type_script_lang_js_regeneratorDefine2(e, r, function (e) { return this._invoke(r, n, e); }); } r ? i ? i(e, r, { value: n, enumerable: !t, configurable: !t, writable: !t }) : e[r] = n : (o("next", 0), o("throw", 1), o("return", 2)); }, com_graphicsvue_type_script_lang_js_regeneratorDefine2(e, r, n, t); }
|
|
114893
|
+
function com_graphicsvue_type_script_lang_js_asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }
|
|
114894
|
+
function com_graphicsvue_type_script_lang_js_asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { com_graphicsvue_type_script_lang_js_asyncGeneratorStep(a, r, o, _next, _throw, "next", n); } function _throw(n) { com_graphicsvue_type_script_lang_js_asyncGeneratorStep(a, r, o, _next, _throw, "throw", n); } _next(void 0); }); }; }
|
|
114895
|
+
function com_graphicsvue_type_script_lang_js_typeof(o) { "@babel/helpers - typeof"; return com_graphicsvue_type_script_lang_js_typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, com_graphicsvue_type_script_lang_js_typeof(o); }
|
|
114951
114896
|
var singleFrameTime = 1 / 30;
|
|
114952
|
-
var
|
|
114953
|
-
|
|
114954
|
-
|
|
114955
|
-
|
|
114956
|
-
|
|
114957
|
-
|
|
114958
|
-
|
|
114959
|
-
|
|
114960
|
-
|
|
114961
|
-
|
|
114962
|
-
|
|
114963
|
-
|
|
114964
|
-
|
|
114965
|
-
|
|
114966
|
-
|
|
114967
|
-
|
|
114968
|
-
|
|
114969
|
-
|
|
114970
|
-
|
|
114971
|
-
|
|
114972
|
-
|
|
114973
|
-
|
|
114974
|
-
|
|
114975
|
-
|
|
114976
|
-
|
|
114977
|
-
|
|
114978
|
-
|
|
114979
|
-
|
|
114980
|
-
|
|
114981
|
-
|
|
114982
|
-
|
|
114983
|
-
|
|
114984
|
-
|
|
114985
|
-
|
|
114986
|
-
|
|
114987
|
-
|
|
114988
|
-
|
|
114989
|
-
|
|
114990
|
-
|
|
114991
|
-
|
|
114992
|
-
|
|
114993
|
-
|
|
114994
|
-
|
|
114897
|
+
var dragThreshold = 5; // 拖拽阈值,像素单位
|
|
114898
|
+
|
|
114899
|
+
// 根据场景包围盒动态计算的最大dolly距离(对角线长度)
|
|
114900
|
+
var maxDollyDistance = Infinity;
|
|
114901
|
+
|
|
114902
|
+
// var lastMiddleClickTime = 0;
|
|
114903
|
+
// var [
|
|
114904
|
+
// renderer,
|
|
114905
|
+
// scene,
|
|
114906
|
+
// camera,
|
|
114907
|
+
// cameraControls,
|
|
114908
|
+
// instructions,
|
|
114909
|
+
// raycaster,
|
|
114910
|
+
// mouse,
|
|
114911
|
+
// labelRenderer,
|
|
114912
|
+
// lineTexture,
|
|
114913
|
+
// curve,
|
|
114914
|
+
// downRaycaster,
|
|
114915
|
+
// velocity,
|
|
114916
|
+
// direction,
|
|
114917
|
+
// clock,
|
|
114918
|
+
// pointControls,
|
|
114919
|
+
// threeMeasure,
|
|
114920
|
+
// modelGroup,
|
|
114921
|
+
// animateId,
|
|
114922
|
+
// scenePass,
|
|
114923
|
+
// outlineComposer,
|
|
114924
|
+
// outlinePass,
|
|
114925
|
+
// renderTarget,
|
|
114926
|
+
// sceneClock,
|
|
114927
|
+
// bizToThreeMatrix,
|
|
114928
|
+
// threeToBizMatrix,
|
|
114929
|
+
// stats,
|
|
114930
|
+
// ] = (function* (v) {
|
|
114931
|
+
// while (true) yield v;
|
|
114932
|
+
// })(null);
|
|
114933
|
+
|
|
114934
|
+
// var [tlastTime, firstTime, fpsClock,timeStamp, progress, lastMiddleClickTime] = (function* (v) {
|
|
114935
|
+
// while (true) yield v;
|
|
114936
|
+
// })(0);
|
|
114937
|
+
|
|
114938
|
+
// var [
|
|
114939
|
+
// roaming,
|
|
114940
|
+
// firstPerSign,
|
|
114941
|
+
// canJump,
|
|
114942
|
+
// moveForward,
|
|
114943
|
+
// moveBackward,
|
|
114944
|
+
// moveLeft,
|
|
114945
|
+
// moveRight,
|
|
114946
|
+
// measureFlag,
|
|
114947
|
+
// // rotatedSceneFlag,
|
|
114948
|
+
// ] = (function* (v) {
|
|
114949
|
+
// while (true) yield v;
|
|
114950
|
+
// })(false);
|
|
114951
|
+
|
|
114952
|
+
// var [spaceUp] = (function* (v) {
|
|
114953
|
+
// while (true) yield v;
|
|
114954
|
+
// })(true);
|
|
114955
|
+
|
|
114995
114956
|
var renderedThisFrame = new Set();
|
|
114996
114957
|
function markRendered(mesh) {
|
|
114997
114958
|
mesh.onBeforeRender = function (renderer, scene, camera, geometry, material, group) {
|
|
@@ -115000,9 +114961,9 @@ function markRendered(mesh) {
|
|
|
115000
114961
|
}
|
|
115001
114962
|
|
|
115002
114963
|
// 交互期间丢弃当前帧渲染的标记
|
|
115003
|
-
|
|
114964
|
+
// let skipNextRenderFrame = false;
|
|
115004
114965
|
// 增强的交互检测标记
|
|
115005
|
-
|
|
114966
|
+
// let forceSkipRendering = false;
|
|
115006
114967
|
// let interactionFrameCount = 0; // 交互期间跳过的帧数计数
|
|
115007
114968
|
|
|
115008
114969
|
var clippingMesh = [],
|
|
@@ -115031,8 +114992,6 @@ var clippingMesh = [],
|
|
|
115031
114992
|
// 鼠标抬起时的位置
|
|
115032
114993
|
isDragging = false,
|
|
115033
114994
|
// 是否正在拖拽
|
|
115034
|
-
dragThreshold = 5,
|
|
115035
|
-
// 拖拽阈值,像素单位
|
|
115036
114995
|
sceneBoundingBox = null,
|
|
115037
114996
|
// 场景包围盒
|
|
115038
114997
|
// 包围盒显示相关变量
|
|
@@ -115040,8 +114999,6 @@ var clippingMesh = [],
|
|
|
115040
114999
|
// 场景包围盒辅助线
|
|
115041
115000
|
boundingBoxVisible = false; // 包围盒是否可见
|
|
115042
115001
|
|
|
115043
|
-
// 根据场景包围盒动态计算的最大dolly距离(对角线长度)
|
|
115044
|
-
var maxDollyDistance = Infinity;
|
|
115045
115002
|
var removeSpeed = 200,
|
|
115046
115003
|
upSpeed = 200; //控制器移动速度 , //控制跳起时的速度
|
|
115047
115004
|
var roamConfig = {
|
|
@@ -115108,6 +115065,10 @@ var isDebug = false || false === true;
|
|
|
115108
115065
|
default: function _default() {
|
|
115109
115066
|
return {};
|
|
115110
115067
|
}
|
|
115068
|
+
},
|
|
115069
|
+
containId: {
|
|
115070
|
+
type: String,
|
|
115071
|
+
default: 'fl-model'
|
|
115111
115072
|
}
|
|
115112
115073
|
},
|
|
115113
115074
|
data: function data() {
|
|
@@ -115139,7 +115100,51 @@ var isDebug = false || false === true;
|
|
|
115139
115100
|
}
|
|
115140
115101
|
};
|
|
115141
115102
|
},
|
|
115103
|
+
beforeCreate: function beforeCreate() {
|
|
115104
|
+
var _this2 = this;
|
|
115105
|
+
this.spaceUp = true;
|
|
115106
|
+
var arr = ['renderer', 'scene', 'camera', 'cameraControls', 'instructions', 'raycaster', 'mouse', 'labelRenderer', 'lineTexture', 'curve', 'downRaycaster', 'velocity', 'direction', 'clock', 'pointControls', 'threeMeasure', 'modelGroup', 'animateId', 'scenePass', 'outlineComposer', 'outlinePass', 'renderTarget', 'sceneClock', 'bizToThreeMatrix', 'threeToBizMatrix', 'stats', 'centeringDebounceTimer', 'sceneBoundingBox', 'sceneBoundingBoxHelper'];
|
|
115107
|
+
arr.forEach(function (item) {
|
|
115108
|
+
_this2[item] = null;
|
|
115109
|
+
});
|
|
115110
|
+
['roaming', 'firstPerSign', 'canJump', 'moveForward', 'moveBackward', 'moveLeft', 'moveRight', 'measureFlag', 'skipNextRenderFrame', 'forceSkipRendering', 'userInteracting', 'hasExecutedCentering', 'needsCenteringAfterInteraction', 'isDragging', 'boundingBoxVisible'].forEach(function (item) {
|
|
115111
|
+
_this2[item] = false;
|
|
115112
|
+
});
|
|
115113
|
+
['clippingMesh', 'modelActive'].forEach(function (item) {
|
|
115114
|
+
_this2[item] = [];
|
|
115115
|
+
});
|
|
115116
|
+
['removeSpeed', 'upSpeed'].forEach(function (item) {
|
|
115117
|
+
_this2[item] = 200;
|
|
115118
|
+
});
|
|
115119
|
+
this.gui = null;
|
|
115120
|
+
this.roamConfig = {
|
|
115121
|
+
loop: false,
|
|
115122
|
+
speed: 0,
|
|
115123
|
+
// 最大值为3
|
|
115124
|
+
name: ''
|
|
115125
|
+
};
|
|
115126
|
+
this.guiParams = {
|
|
115127
|
+
x轴: 0,
|
|
115128
|
+
y轴: 0,
|
|
115129
|
+
z轴: 0,
|
|
115130
|
+
'-x轴': 0,
|
|
115131
|
+
'-y轴': 0,
|
|
115132
|
+
'-z轴': 0
|
|
115133
|
+
};
|
|
115134
|
+
},
|
|
115142
115135
|
created: function created() {
|
|
115136
|
+
var _this3 = this;
|
|
115137
|
+
['lastTime', 'firstTime', 'fpsClock', 'timeStamp', 'progress'].forEach(function (item) {
|
|
115138
|
+
_this3[item] = 0;
|
|
115139
|
+
});
|
|
115140
|
+
this.mouseDownPosition = {
|
|
115141
|
+
x: 0,
|
|
115142
|
+
y: 0
|
|
115143
|
+
};
|
|
115144
|
+
this.mouseUpPosition = {
|
|
115145
|
+
x: 0,
|
|
115146
|
+
y: 0
|
|
115147
|
+
};
|
|
115143
115148
|
// 初始化非响应式的高频状态对象
|
|
115144
115149
|
this.noObserver = {
|
|
115145
115150
|
modelStateManager: {
|
|
@@ -115200,22 +115205,21 @@ var isDebug = false || false === true;
|
|
|
115200
115205
|
occlusionWorkerRequestMap: new Map(),
|
|
115201
115206
|
occlusionWorkerRequestId: 0
|
|
115202
115207
|
};
|
|
115208
|
+
this.modelGroups = [];
|
|
115209
|
+
this.modelActions = [];
|
|
115210
|
+
this.lastMiddleClickTime = 0;
|
|
115203
115211
|
CameraControls.install({
|
|
115204
115212
|
THREE: this.THREE
|
|
115205
115213
|
});
|
|
115206
|
-
bizToThreeMatrix = new this.THREE.Matrix4();
|
|
115207
|
-
bizToThreeMatrix.makeRotationX(-Math.PI / 2);
|
|
115208
|
-
threeToBizMatrix = new this.THREE.Matrix4();
|
|
115209
|
-
threeToBizMatrix.makeRotationX(Math.PI / 2);
|
|
115210
|
-
fpsClock = new this.THREE.Clock();
|
|
115211
|
-
|
|
115212
|
-
sceneClock = new this.THREE.Clock();
|
|
115213
|
-
|
|
115214
|
-
|
|
115215
|
-
width: window.innerWidth,
|
|
115216
|
-
height: window.innerHeight
|
|
115217
|
-
};
|
|
115218
|
-
com_graphicsvue_type_script_lang_js_renderTarget = new this.THREE.WebGLRenderTarget(initialRect.width, initialRect.height, {
|
|
115214
|
+
this.bizToThreeMatrix = new this.THREE.Matrix4();
|
|
115215
|
+
this.bizToThreeMatrix.makeRotationX(-Math.PI / 2);
|
|
115216
|
+
this.threeToBizMatrix = new this.THREE.Matrix4();
|
|
115217
|
+
this.threeToBizMatrix.makeRotationX(Math.PI / 2);
|
|
115218
|
+
this.fpsClock = new this.THREE.Clock();
|
|
115219
|
+
this.raycaster = new this.THREE.Raycaster();
|
|
115220
|
+
this.sceneClock = new this.THREE.Clock();
|
|
115221
|
+
this.mouse = new this.THREE.Vector2();
|
|
115222
|
+
this.renderTarget = new this.THREE.WebGLRenderTarget(window.innerWidth, window.innerHeight, {
|
|
115219
115223
|
minFilter: this.THREE.LinearFilter,
|
|
115220
115224
|
magFilter: this.THREE.LinearFilter,
|
|
115221
115225
|
format: this.THREE.RGBAFormat,
|
|
@@ -115224,7 +115228,7 @@ var isDebug = false || false === true;
|
|
|
115224
115228
|
});
|
|
115225
115229
|
},
|
|
115226
115230
|
mounted: function mounted() {
|
|
115227
|
-
instructions = document.getElementById('fl-model'
|
|
115231
|
+
this.instructions = document.getElementById(this.containId); // 'fl-model'
|
|
115228
115232
|
this.initRender();
|
|
115229
115233
|
this.initScene();
|
|
115230
115234
|
this.initCamera();
|
|
@@ -115239,11 +115243,11 @@ var isDebug = false || false === true;
|
|
|
115239
115243
|
// 判断是设备是手机还是电脑
|
|
115240
115244
|
var isMobileDevice = this.isMobileDevice();
|
|
115241
115245
|
if (isMobileDevice) {
|
|
115242
|
-
|
|
115243
|
-
|
|
115246
|
+
this.renderer.domElement.addEventListener('pointerup', this.mouseClick, false);
|
|
115247
|
+
this.renderer.domElement.addEventListener('pointerdown', this.mouseDown, false);
|
|
115244
115248
|
} else {
|
|
115245
|
-
|
|
115246
|
-
|
|
115249
|
+
this.renderer.domElement.addEventListener('mouseup', this.mouseClick, false);
|
|
115250
|
+
this.renderer.domElement.addEventListener('mousedown', this.mouseDown, false);
|
|
115247
115251
|
}
|
|
115248
115252
|
this.animate();
|
|
115249
115253
|
},
|
|
@@ -115278,13 +115282,13 @@ var isDebug = false || false === true;
|
|
|
115278
115282
|
return instancedMesh ? instancedMesh.visible === false : false;
|
|
115279
115283
|
},
|
|
115280
115284
|
pushOutlineTarget: function pushOutlineTarget(target) {
|
|
115281
|
-
if (!outlinePass || !target) return;
|
|
115282
|
-
if (!outlinePass.selectedObjects.includes(target)) {
|
|
115283
|
-
outlinePass.selectedObjects.push(target);
|
|
115285
|
+
if (!this.outlinePass || !target) return;
|
|
115286
|
+
if (!this.outlinePass.selectedObjects.includes(target)) {
|
|
115287
|
+
this.outlinePass.selectedObjects.push(target);
|
|
115284
115288
|
}
|
|
115285
115289
|
},
|
|
115286
115290
|
ensureOutlineInstanceProxy: function ensureOutlineInstanceProxy(instancedMesh, instanceIndex) {
|
|
115287
|
-
if (!
|
|
115291
|
+
if (!this.scene || !instancedMesh || !instancedMesh.isInstancedMesh) return null;
|
|
115288
115292
|
var state = this.noObserver;
|
|
115289
115293
|
if (!state || !state.outlineInstanceProxyMap) return null;
|
|
115290
115294
|
var instanceId = this.getInstanceId(instancedMesh, instanceIndex);
|
|
@@ -115319,7 +115323,7 @@ var isDebug = false || false === true;
|
|
|
115319
115323
|
instancedMeshUuid: instancedMesh.uuid,
|
|
115320
115324
|
instanceIndex: instanceIndex
|
|
115321
115325
|
};
|
|
115322
|
-
|
|
115326
|
+
this.scene.add(proxy);
|
|
115323
115327
|
state.outlineInstanceProxyMap.set(key, proxy);
|
|
115324
115328
|
return proxy;
|
|
115325
115329
|
},
|
|
@@ -115330,11 +115334,11 @@ var isDebug = false || false === true;
|
|
|
115330
115334
|
var proxy = state.outlineInstanceProxyMap.get(key);
|
|
115331
115335
|
if (!proxy) return null;
|
|
115332
115336
|
state.outlineInstanceProxyMap.delete(key);
|
|
115333
|
-
if (outlinePass) {
|
|
115334
|
-
var idx = outlinePass.selectedObjects.indexOf(proxy);
|
|
115335
|
-
if (idx !== -1) outlinePass.selectedObjects.splice(idx, 1);
|
|
115337
|
+
if (this.outlinePass) {
|
|
115338
|
+
var idx = this.outlinePass.selectedObjects.indexOf(proxy);
|
|
115339
|
+
if (idx !== -1) this.outlinePass.selectedObjects.splice(idx, 1);
|
|
115336
115340
|
}
|
|
115337
|
-
if (
|
|
115341
|
+
if (this.scene) this.scene.remove(proxy);
|
|
115338
115342
|
if (proxy.material) proxy.material.dispose && proxy.material.dispose();
|
|
115339
115343
|
return proxy;
|
|
115340
115344
|
},
|
|
@@ -115381,7 +115385,7 @@ var isDebug = false || false === true;
|
|
|
115381
115385
|
var throttleLastRan = 0;
|
|
115382
115386
|
var throttleTimer = null;
|
|
115383
115387
|
return function () {
|
|
115384
|
-
var
|
|
115388
|
+
var _this4 = this;
|
|
115385
115389
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
115386
115390
|
args[_key2] = arguments[_key2];
|
|
115387
115391
|
}
|
|
@@ -115405,7 +115409,7 @@ var isDebug = false || false === true;
|
|
|
115405
115409
|
clearTimeout(throttleTimer);
|
|
115406
115410
|
throttleTimer = setTimeout(function () {
|
|
115407
115411
|
if (Date.now() - throttleLastRan >= limit) {
|
|
115408
|
-
func.apply(
|
|
115412
|
+
func.apply(_this4, args);
|
|
115409
115413
|
throttleLastRan = Date.now();
|
|
115410
115414
|
}
|
|
115411
115415
|
}, limit - (now - throttleLastRan));
|
|
@@ -115424,7 +115428,7 @@ var isDebug = false || false === true;
|
|
|
115424
115428
|
func.apply(this, args);
|
|
115425
115429
|
} else {
|
|
115426
115430
|
timeoutId = setTimeout(function () {
|
|
115427
|
-
return func.apply(
|
|
115431
|
+
return func.apply(_this4, args);
|
|
115428
115432
|
}, currentDelay);
|
|
115429
115433
|
}
|
|
115430
115434
|
};
|
|
@@ -115478,20 +115482,20 @@ var isDebug = false || false === true;
|
|
|
115478
115482
|
};
|
|
115479
115483
|
},
|
|
115480
115484
|
scanOcclusionIndices: function scanOcclusionIndices(buffer, sw, sh, stride, maxIdx, minSampleCount) {
|
|
115481
|
-
var
|
|
115482
|
-
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function
|
|
115485
|
+
var _this5 = this;
|
|
115486
|
+
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee() {
|
|
115483
115487
|
var state, canWorker, response, restored, _syncRes, syncRes;
|
|
115484
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (
|
|
115485
|
-
while (1) switch (
|
|
115488
|
+
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context) {
|
|
115489
|
+
while (1) switch (_context.n) {
|
|
115486
115490
|
case 0:
|
|
115487
|
-
state =
|
|
115491
|
+
state = _this5.noObserver;
|
|
115488
115492
|
canWorker = state && state.occlusionWorker && buffer && buffer.buffer;
|
|
115489
115493
|
if (!canWorker) {
|
|
115490
|
-
|
|
115494
|
+
_context.n = 3;
|
|
115491
115495
|
break;
|
|
115492
115496
|
}
|
|
115493
|
-
|
|
115494
|
-
return
|
|
115497
|
+
_context.n = 1;
|
|
115498
|
+
return _this5.occlusionWorkerRequest('occlusionScan', {
|
|
115495
115499
|
buffer: buffer.buffer,
|
|
115496
115500
|
sw: sw,
|
|
115497
115501
|
sh: sh,
|
|
@@ -115500,30 +115504,30 @@ var isDebug = false || false === true;
|
|
|
115500
115504
|
minSampleCount: minSampleCount
|
|
115501
115505
|
}, [buffer.buffer]);
|
|
115502
115506
|
case 1:
|
|
115503
|
-
response =
|
|
115507
|
+
response = _context.v;
|
|
115504
115508
|
restored = response && response.buffer ? new Uint8Array(response.buffer) : buffer;
|
|
115505
115509
|
if (!(response && response.type === 'success' && response.result)) {
|
|
115506
|
-
|
|
115510
|
+
_context.n = 2;
|
|
115507
115511
|
break;
|
|
115508
115512
|
}
|
|
115509
|
-
return
|
|
115513
|
+
return _context.a(2, {
|
|
115510
115514
|
indices: response.result.indices || [],
|
|
115511
115515
|
buffer: restored.buffer
|
|
115512
115516
|
});
|
|
115513
115517
|
case 2:
|
|
115514
|
-
_syncRes =
|
|
115515
|
-
return
|
|
115518
|
+
_syncRes = _this5.scanOcclusionBufferSync(restored, sw, sh, stride, maxIdx, minSampleCount);
|
|
115519
|
+
return _context.a(2, {
|
|
115516
115520
|
indices: _syncRes.indices,
|
|
115517
115521
|
buffer: restored.buffer
|
|
115518
115522
|
});
|
|
115519
115523
|
case 3:
|
|
115520
|
-
syncRes =
|
|
115521
|
-
return
|
|
115524
|
+
syncRes = _this5.scanOcclusionBufferSync(buffer, sw, sh, stride, maxIdx, minSampleCount);
|
|
115525
|
+
return _context.a(2, {
|
|
115522
115526
|
indices: syncRes.indices,
|
|
115523
115527
|
buffer: buffer && buffer.buffer ? buffer.buffer : null
|
|
115524
115528
|
});
|
|
115525
115529
|
}
|
|
115526
|
-
},
|
|
115530
|
+
}, _callee);
|
|
115527
115531
|
}))();
|
|
115528
115532
|
},
|
|
115529
115533
|
setSceneBox: function setSceneBox(boundingBox, documentId) {
|
|
@@ -115542,7 +115546,7 @@ var isDebug = false || false === true;
|
|
|
115542
115546
|
minX = boundingBox.min_x,
|
|
115543
115547
|
minZ = boundingBox.min_z,
|
|
115544
115548
|
minY = boundingBox.min_y;
|
|
115545
|
-
var box = new this.THREE.Box3(new this.THREE.Vector3(minX, minY, minZ), new this.THREE.Vector3(maxX, maxY, maxZ)).applyMatrix4(bizToThreeMatrix);
|
|
115549
|
+
var box = new this.THREE.Box3(new this.THREE.Vector3(minX, minY, minZ), new this.THREE.Vector3(maxX, maxY, maxZ)).applyMatrix4(this.bizToThreeMatrix);
|
|
115546
115550
|
this.noObserver.sceneBoxes.set(documentId, box);
|
|
115547
115551
|
} else {
|
|
115548
115552
|
this.noObserver.sceneBoxes.delete(documentId);
|
|
@@ -115557,8 +115561,8 @@ var isDebug = false || false === true;
|
|
|
115557
115561
|
if (occScene && occScene.children && occScene.children.length > 0) {
|
|
115558
115562
|
var occBox = new this.THREE.Box3().setFromObject(occScene);
|
|
115559
115563
|
if (!occBox.isEmpty()) {
|
|
115560
|
-
sceneBoundingBox = occBox;
|
|
115561
|
-
return sceneBoundingBox;
|
|
115564
|
+
this.sceneBoundingBox = occBox;
|
|
115565
|
+
return this.sceneBoundingBox;
|
|
115562
115566
|
}
|
|
115563
115567
|
}
|
|
115564
115568
|
|
|
@@ -115582,8 +115586,8 @@ var isDebug = false || false === true;
|
|
|
115582
115586
|
if (mx.z > maxZ) maxZ = mx.z;
|
|
115583
115587
|
});
|
|
115584
115588
|
if (Number.isFinite(minX) && Number.isFinite(minY) && Number.isFinite(minZ) && Number.isFinite(maxX) && Number.isFinite(maxY) && Number.isFinite(maxZ)) {
|
|
115585
|
-
sceneBoundingBox = new this.THREE.Box3(new this.THREE.Vector3(minX, minY, minZ), new this.THREE.Vector3(maxX, maxY, maxZ));
|
|
115586
|
-
return sceneBoundingBox;
|
|
115589
|
+
this.sceneBoundingBox = new this.THREE.Box3(new this.THREE.Vector3(minX, minY, minZ), new this.THREE.Vector3(maxX, maxY, maxZ));
|
|
115590
|
+
return this.sceneBoundingBox;
|
|
115587
115591
|
}
|
|
115588
115592
|
}
|
|
115589
115593
|
var boxes = Array.from(state.sceneBoxes && state.sceneBoxes.values() || []);
|
|
@@ -115592,14 +115596,14 @@ var isDebug = false || false === true;
|
|
|
115592
115596
|
for (var i = 1; i < boxes.length; i++) {
|
|
115593
115597
|
firstBox.union(boxes[i]);
|
|
115594
115598
|
}
|
|
115595
|
-
sceneBoundingBox = firstBox;
|
|
115596
|
-
return sceneBoundingBox;
|
|
115599
|
+
this.sceneBoundingBox = firstBox;
|
|
115600
|
+
return this.sceneBoundingBox;
|
|
115597
115601
|
}
|
|
115598
|
-
sceneBoundingBox = new this.THREE.Box3();
|
|
115599
|
-
return sceneBoundingBox;
|
|
115602
|
+
this.sceneBoundingBox = new this.THREE.Box3();
|
|
115603
|
+
return this.sceneBoundingBox;
|
|
115600
115604
|
},
|
|
115601
115605
|
setBoxIndex: function setBoxIndex(boxJson, documentId) {
|
|
115602
|
-
var
|
|
115606
|
+
var _this6 = this;
|
|
115603
115607
|
var isAdd = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true;
|
|
115604
115608
|
if (!this._boxIndex) this._boxIndex = new Map();
|
|
115605
115609
|
if (!documentId) {
|
|
@@ -115607,7 +115611,7 @@ var isDebug = false || false === true;
|
|
|
115607
115611
|
if (this.noObserver && this.noObserver.documentModelIds) {
|
|
115608
115612
|
this.noObserver.documentModelIds.clear();
|
|
115609
115613
|
}
|
|
115610
|
-
hasExecutedCentering = false;
|
|
115614
|
+
this.hasExecutedCentering = false;
|
|
115611
115615
|
this.buildOctreeFromBoxIndex();
|
|
115612
115616
|
return;
|
|
115613
115617
|
}
|
|
@@ -115627,13 +115631,13 @@ var isDebug = false || false === true;
|
|
|
115627
115631
|
if (hasMatrix && it.matrix.length >= 16) {
|
|
115628
115632
|
var matrix = new this.THREE.Matrix4().fromArray(it.matrix);
|
|
115629
115633
|
var worldMatrix = matrix.clone();
|
|
115630
|
-
if (bizToThreeMatrix) {
|
|
115631
|
-
worldMatrix.premultiply(bizToThreeMatrix);
|
|
115634
|
+
if (this.bizToThreeMatrix) {
|
|
115635
|
+
worldMatrix.premultiply(this.bizToThreeMatrix);
|
|
115632
115636
|
}
|
|
115633
115637
|
boxThree.applyMatrix4(worldMatrix);
|
|
115634
|
-
} else if (bizToThreeMatrix) {
|
|
115638
|
+
} else if (this.bizToThreeMatrix) {
|
|
115635
115639
|
// 注意:applyMatrix4 会重新计算 AABB
|
|
115636
|
-
boxThree.applyMatrix4(bizToThreeMatrix);
|
|
115640
|
+
boxThree.applyMatrix4(this.bizToThreeMatrix);
|
|
115637
115641
|
}
|
|
115638
115642
|
var userData = {
|
|
115639
115643
|
flag: it.flag || 1,
|
|
@@ -115691,13 +115695,13 @@ var isDebug = false || false === true;
|
|
|
115691
115695
|
var _modelIds = this.noObserver.documentModelIds.get(documentId);
|
|
115692
115696
|
if (_modelIds) {
|
|
115693
115697
|
_modelIds.forEach(function (id) {
|
|
115694
|
-
|
|
115698
|
+
_this6._boxIndex.delete(id);
|
|
115695
115699
|
});
|
|
115696
115700
|
this.noObserver.documentModelIds.delete(documentId);
|
|
115697
115701
|
|
|
115698
115702
|
// 当前无模型了,重置相机中心状态
|
|
115699
115703
|
if (this.noObserver.documentModelIds.size == 0) {
|
|
115700
|
-
hasExecutedCentering = false;
|
|
115704
|
+
this.hasExecutedCentering = false;
|
|
115701
115705
|
}
|
|
115702
115706
|
}
|
|
115703
115707
|
}
|
|
@@ -115705,13 +115709,13 @@ var isDebug = false || false === true;
|
|
|
115705
115709
|
console.log('time end', Date.now());
|
|
115706
115710
|
},
|
|
115707
115711
|
tryInitialCenterAfterBoundsReady: function tryInitialCenterAfterBoundsReady() {
|
|
115708
|
-
if (hasExecutedCentering || userInteracting) return;
|
|
115709
|
-
if (!sceneBoundingBox || !sceneBoundingBox.isBox3 || sceneBoundingBox.isEmpty()) return;
|
|
115712
|
+
if (this.hasExecutedCentering || this.userInteracting) return;
|
|
115713
|
+
if (!this.sceneBoundingBox || !this.sceneBoundingBox.isBox3 || this.sceneBoundingBox.isEmpty()) return;
|
|
115710
115714
|
if (!this._boxIndex || this._boxIndex.size === 0) return;
|
|
115711
|
-
this.smartModelCenter(sceneBoundingBox, 0);
|
|
115715
|
+
this.smartModelCenter(this.sceneBoundingBox, 0);
|
|
115712
115716
|
},
|
|
115713
115717
|
buildOctreeFromBoxIndex: function buildOctreeFromBoxIndex() {
|
|
115714
|
-
var
|
|
115718
|
+
var _this7 = this;
|
|
115715
115719
|
if (!this._boxIndex || this._boxIndex.size === 0) {
|
|
115716
115720
|
this._octree = null;
|
|
115717
115721
|
this.updateGlobalSceneBoundingBox();
|
|
@@ -115735,7 +115739,7 @@ var isDebug = false || false === true;
|
|
|
115735
115739
|
if (mx.z > maxZ) maxZ = mx.z;
|
|
115736
115740
|
});
|
|
115737
115741
|
var rootBox = new this.THREE.Box3(new this.THREE.Vector3(minX, minY, minZ), new this.THREE.Vector3(maxX, maxY, maxZ));
|
|
115738
|
-
sceneBoundingBox = rootBox.clone();
|
|
115742
|
+
this.sceneBoundingBox = rootBox.clone();
|
|
115739
115743
|
this._octreeMaxItems = 64;
|
|
115740
115744
|
this._octreeMaxDepth = 12;
|
|
115741
115745
|
this._octree = {
|
|
@@ -115745,7 +115749,7 @@ var isDebug = false || false === true;
|
|
|
115745
115749
|
depth: 0
|
|
115746
115750
|
};
|
|
115747
115751
|
this._boxIndex.forEach(function (box, id) {
|
|
115748
|
-
|
|
115752
|
+
_this7._octreeInsert(_this7._octree, String(id), box);
|
|
115749
115753
|
});
|
|
115750
115754
|
this.updateGlobalSceneBoundingBox();
|
|
115751
115755
|
},
|
|
@@ -115815,12 +115819,12 @@ var isDebug = false || false === true;
|
|
|
115815
115819
|
},
|
|
115816
115820
|
_getCurrentFrustum: function _getCurrentFrustum() {
|
|
115817
115821
|
// 确保相机矩阵是最新的
|
|
115818
|
-
if (
|
|
115819
|
-
|
|
115820
|
-
|
|
115822
|
+
if (this.camera) {
|
|
115823
|
+
this.camera.updateMatrixWorld();
|
|
115824
|
+
this.camera.matrixWorldInverse.copy(this.camera.matrixWorld).invert();
|
|
115821
115825
|
}
|
|
115822
115826
|
var frustum = new this.THREE.Frustum();
|
|
115823
|
-
var vpMatrix = new this.THREE.Matrix4().multiplyMatrices(
|
|
115827
|
+
var vpMatrix = new this.THREE.Matrix4().multiplyMatrices(this.camera.projectionMatrix, this.camera.matrixWorldInverse);
|
|
115824
115828
|
frustum.setFromProjectionMatrix(vpMatrix);
|
|
115825
115829
|
return frustum;
|
|
115826
115830
|
},
|
|
@@ -115886,25 +115890,25 @@ var isDebug = false || false === true;
|
|
|
115886
115890
|
return results;
|
|
115887
115891
|
},
|
|
115888
115892
|
setCameraFar: function setCameraFar() {
|
|
115889
|
-
var bbox = sceneBoundingBox;
|
|
115893
|
+
var bbox = this.sceneBoundingBox;
|
|
115890
115894
|
var center = bbox.getCenter(new this.THREE.Vector3());
|
|
115891
115895
|
var size = bbox.getSize(new this.THREE.Vector3());
|
|
115892
115896
|
var maxDist = size.length();
|
|
115893
|
-
// const distance = camera.position.distanceTo(center);
|
|
115894
|
-
|
|
115895
|
-
// camera.far = 100;
|
|
115896
|
-
|
|
115897
|
+
// const distance = this.camera.position.distanceTo(center);
|
|
115898
|
+
this.camera.far = maxDist * 2;
|
|
115899
|
+
// this.camera.far = 100;
|
|
115900
|
+
this.camera.updateProjectionMatrix();
|
|
115897
115901
|
},
|
|
115898
115902
|
// 新增:当相机位于场景包围盒内时,动态调整相机远裁剪面
|
|
115899
115903
|
adjustCameraFarPlaneForSceneBox: function adjustCameraFarPlaneForSceneBox() {
|
|
115900
115904
|
try {
|
|
115901
|
-
if (!
|
|
115905
|
+
if (!this.camera || !this.sceneBoundingBox || !this.sceneBoundingBox.isBox3) return;
|
|
115902
115906
|
|
|
115903
115907
|
// 获取最新相机位置
|
|
115904
|
-
|
|
115905
|
-
var camPos = new this.THREE.Vector3().setFromMatrixPosition(
|
|
115906
|
-
var min = sceneBoundingBox.min;
|
|
115907
|
-
var max = sceneBoundingBox.max;
|
|
115908
|
+
this.camera.updateMatrixWorld(true);
|
|
115909
|
+
var camPos = new this.THREE.Vector3().setFromMatrixPosition(this.camera.matrixWorld);
|
|
115910
|
+
var min = this.sceneBoundingBox.min;
|
|
115911
|
+
var max = this.sceneBoundingBox.max;
|
|
115908
115912
|
|
|
115909
115913
|
// 包围盒八个顶点
|
|
115910
115914
|
var vertices = [new this.THREE.Vector3(min.x, min.y, min.z), new this.THREE.Vector3(min.x, min.y, max.z), new this.THREE.Vector3(min.x, max.y, min.z), new this.THREE.Vector3(min.x, max.y, max.z), new this.THREE.Vector3(max.x, min.y, min.z), new this.THREE.Vector3(max.x, min.y, max.z), new this.THREE.Vector3(max.x, max.y, min.z), new this.THREE.Vector3(max.x, max.y, max.z)];
|
|
@@ -115918,13 +115922,13 @@ var isDebug = false || false === true;
|
|
|
115918
115922
|
}
|
|
115919
115923
|
|
|
115920
115924
|
// 确保 newFar > near,且更新投影矩阵
|
|
115921
|
-
var newFar = Math.max(maxDistance,
|
|
115922
|
-
if (Math.abs(
|
|
115923
|
-
|
|
115924
|
-
|
|
115925
|
+
var newFar = Math.max(maxDistance, this.camera.near + 0.1);
|
|
115926
|
+
if (Math.abs(this.camera.far - newFar) > 1e-6) {
|
|
115927
|
+
this.camera.far = newFar;
|
|
115928
|
+
this.camera.updateProjectionMatrix();
|
|
115925
115929
|
}
|
|
115926
115930
|
|
|
115927
|
-
// console.log('camera.far', camera.far)
|
|
115931
|
+
// console.log('this.camera.far', this.camera.far)
|
|
115928
115932
|
} catch (e) {
|
|
115929
115933
|
// 防御式处理,避免交互中断
|
|
115930
115934
|
}
|
|
@@ -115933,7 +115937,7 @@ var isDebug = false || false === true;
|
|
|
115933
115937
|
* 计算当前相机视口在指定平面上的投影范围,并返回视椎体高度(min/max)。
|
|
115934
115938
|
* frustumY.min 会被限制:不小于平面在视椎体 x/z 范围内的最低 y 值(如果可计算)。
|
|
115935
115939
|
*
|
|
115936
|
-
* @param {THREE.Camera} camera
|
|
115940
|
+
* @param {THREE.Camera} this.camera
|
|
115937
115941
|
* @param {number} width
|
|
115938
115942
|
* @param {number} height
|
|
115939
115943
|
* @param {THREE.Plane} plane - three.js 的 Plane,方程为: normal.dot(p) + constant = 0
|
|
@@ -115942,12 +115946,12 @@ var isDebug = false || false === true;
|
|
|
115942
115946
|
* @returns {Object|null} { planeBox: THREE.Box3|null, frustumBox: THREE.Box3, frustumY: {min, max} } 或 null(当没有平面交点且未请求 frustumY)
|
|
115943
115947
|
*/
|
|
115944
115948
|
getScreenPlaneBounds: function getScreenPlaneBounds(camera, width, height, plane) {
|
|
115945
|
-
var
|
|
115949
|
+
var _this8 = this;
|
|
115946
115950
|
var opts = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : {};
|
|
115947
115951
|
var _opts$includeFrustumY = opts.includeFrustumY,
|
|
115948
115952
|
includeFrustumY = _opts$includeFrustumY === void 0 ? false : _opts$includeFrustumY;
|
|
115949
|
-
camera.updateMatrixWorld();
|
|
115950
|
-
if (camera.projectionMatrixNeedsUpdate) camera.updateProjectionMatrix();
|
|
115953
|
+
this.camera.updateMatrixWorld();
|
|
115954
|
+
if (this.camera.projectionMatrixNeedsUpdate) this.camera.updateProjectionMatrix();
|
|
115951
115955
|
var screenCorners = [[0, 0],
|
|
115952
115956
|
// 左下
|
|
115953
115957
|
[width, 0],
|
|
@@ -115966,10 +115970,10 @@ var isDebug = false || false === true;
|
|
|
115966
115970
|
var ndcBase = new this.THREE.Vector3(x / width * 2 - 1, -(y / height) * 2 + 1, undefined);
|
|
115967
115971
|
var ndcNear = ndcBase.clone();
|
|
115968
115972
|
ndcNear.z = -1;
|
|
115969
|
-
frustumPoints.push(ndcNear.clone().unproject(camera));
|
|
115973
|
+
frustumPoints.push(ndcNear.clone().unproject(this.camera));
|
|
115970
115974
|
var ndcFar = ndcBase.clone();
|
|
115971
115975
|
ndcFar.z = 1;
|
|
115972
|
-
frustumPoints.push(ndcFar.clone().unproject(camera));
|
|
115976
|
+
frustumPoints.push(ndcFar.clone().unproject(this.camera));
|
|
115973
115977
|
}
|
|
115974
115978
|
var frustumBox = new this.THREE.Box3().setFromPoints(frustumPoints);
|
|
115975
115979
|
|
|
@@ -115987,7 +115991,7 @@ var isDebug = false || false === true;
|
|
|
115987
115991
|
var volumeCorners = nearCorners.concat(farCorners);
|
|
115988
115992
|
var projectedPoints = volumeCorners.map(function (p) {
|
|
115989
115993
|
var yProj = -(a * p.x + c * p.z + d) / b;
|
|
115990
|
-
return new
|
|
115994
|
+
return new _this8.THREE.Vector3(p.x, yProj, p.z);
|
|
115991
115995
|
});
|
|
115992
115996
|
planeBox = new this.THREE.Box3().setFromPoints(projectedPoints);
|
|
115993
115997
|
}
|
|
@@ -116014,14 +116018,14 @@ var isDebug = false || false === true;
|
|
|
116014
116018
|
|
|
116015
116019
|
// 基于远/近裁剪面角点计算在 Y 轴的投影范围(min/max)
|
|
116016
116020
|
var nearFarY = computePlaneMinYOverBox(plane, frustumBox);
|
|
116017
|
-
var target = this.getCameraTargetOnPlane(camera, plane);
|
|
116021
|
+
var target = this.getCameraTargetOnPlane(this.camera, plane);
|
|
116018
116022
|
|
|
116019
|
-
// 将最终范围限制在 sceneBoundingBox 内(若已存在)
|
|
116023
|
+
// 将最终范围限制在 this.sceneBoundingBox 内(若已存在)
|
|
116020
116024
|
var finalMinY = nearFarY.min;
|
|
116021
116025
|
var finalMaxY = nearFarY.max;
|
|
116022
|
-
if (sceneBoundingBox && sceneBoundingBox.isBox3) {
|
|
116023
|
-
finalMinY = Math.max(finalMinY, sceneBoundingBox.min.y);
|
|
116024
|
-
finalMaxY = Math.min(finalMaxY, sceneBoundingBox.max.y);
|
|
116026
|
+
if (this.sceneBoundingBox && this.sceneBoundingBox.isBox3) {
|
|
116027
|
+
finalMinY = Math.max(finalMinY, this.sceneBoundingBox.min.y);
|
|
116028
|
+
finalMaxY = Math.min(finalMaxY, this.sceneBoundingBox.max.y);
|
|
116025
116029
|
}
|
|
116026
116030
|
return com_graphicsvue_type_script_lang_js_objectSpread({
|
|
116027
116031
|
planeBox: planeBox,
|
|
@@ -116035,54 +116039,54 @@ var isDebug = false || false === true;
|
|
|
116035
116039
|
}, target);
|
|
116036
116040
|
},
|
|
116037
116041
|
/**
|
|
116038
|
-
* 计算相机射线与场景包围盒(sceneBoundingBox)的交点,以及该点到视椎体近裁剪面。
|
|
116039
|
-
* 优先使用相机的目标点(cameraControls._target)确定射线方向;若不可用则回退为相机世界前向。
|
|
116042
|
+
* 计算相机射线与场景包围盒(this.sceneBoundingBox)的交点,以及该点到视椎体近裁剪面。
|
|
116043
|
+
* 优先使用相机的目标点(this.cameraControls._target)确定射线方向;若不可用则回退为相机世界前向。
|
|
116040
116044
|
* 若包围盒为空,回退为根据当前模型组/场景计算一次包围盒。
|
|
116041
116045
|
* 若与包围盒无交点且提供了平面参数,则回退为与该平面的交点;仍无交点则将相机位置投影到该平面。
|
|
116042
116046
|
*
|
|
116043
|
-
* @param {THREE.Camera} camera - 相机对象
|
|
116047
|
+
* @param {THREE.Camera} this.camera - 相机对象
|
|
116044
116048
|
* @param {THREE.Plane} [plane] - 可选,用于无包围盒交点时的回退平面
|
|
116045
116049
|
* @returns {Object} { targetPoint: THREE.Vector3, distanceToNearPlane: number, cameraPosition: THREE.Vector3, nearPlanePoint: THREE.Vector3 }
|
|
116046
116050
|
*/
|
|
116047
116051
|
getCameraTargetOnPlane: function getCameraTargetOnPlane(camera, plane) {
|
|
116048
|
-
camera.updateMatrixWorld();
|
|
116049
|
-
if (camera.projectionMatrixNeedsUpdate) camera.updateProjectionMatrix();
|
|
116052
|
+
this.camera.updateMatrixWorld();
|
|
116053
|
+
if (this.camera.projectionMatrixNeedsUpdate) this.camera.updateProjectionMatrix();
|
|
116050
116054
|
|
|
116051
116055
|
// 相机世界位置
|
|
116052
|
-
var cameraPosition = new this.THREE.Vector3().setFromMatrixPosition(camera.matrixWorld);
|
|
116056
|
+
var cameraPosition = new this.THREE.Vector3().setFromMatrixPosition(this.camera.matrixWorld);
|
|
116053
116057
|
|
|
116054
|
-
// 从相机指向目标点的射线方向(优先使用 cameraControls._target)
|
|
116058
|
+
// 从相机指向目标点的射线方向(优先使用 this.cameraControls._target)
|
|
116055
116059
|
var rayDirection = new this.THREE.Vector3();
|
|
116056
|
-
if (typeof cameraControls !== 'undefined' && cameraControls && cameraControls.enabled && cameraControls._target) {
|
|
116057
|
-
rayDirection.copy(cameraControls._target).sub(cameraPosition).normalize();
|
|
116060
|
+
if (typeof this.cameraControls !== 'undefined' && this.cameraControls && this.cameraControls.enabled && this.cameraControls._target) {
|
|
116061
|
+
rayDirection.copy(this.cameraControls._target).sub(cameraPosition).normalize();
|
|
116058
116062
|
} else {
|
|
116059
|
-
camera.getWorldDirection(rayDirection); // -Z 方向(世界坐标)
|
|
116063
|
+
this.camera.getWorldDirection(rayDirection); // -Z 方向(世界坐标)
|
|
116060
116064
|
}
|
|
116061
116065
|
var ray = new this.THREE.Ray(cameraPosition.clone(), rayDirection.clone());
|
|
116062
116066
|
|
|
116063
116067
|
// 准备/计算场景包围盒
|
|
116064
|
-
// if (!sceneBoundingBox) {
|
|
116068
|
+
// if (!this.sceneBoundingBox) {
|
|
116065
116069
|
// const box3 = new this.THREE.Box3();
|
|
116066
|
-
// if (typeof modelGroup !== 'undefined' && modelGroup) {
|
|
116067
|
-
// box3.expandByObject(modelGroup);
|
|
116068
|
-
// } else if (scene) {
|
|
116069
|
-
// box3.expandByObject(scene);
|
|
116070
|
+
// if (typeof this.modelGroup !== 'undefined' && this.modelGroup) {
|
|
116071
|
+
// box3.expandByObject(this.modelGroup);
|
|
116072
|
+
// } else if (this.scene) {
|
|
116073
|
+
// box3.expandByObject(this.scene);
|
|
116070
116074
|
// }
|
|
116071
|
-
// sceneBoundingBox = box3;
|
|
116075
|
+
// this.sceneBoundingBox = box3;
|
|
116072
116076
|
// }
|
|
116073
116077
|
|
|
116074
116078
|
// 与场景包围盒的交点(若无交点则进行回退)
|
|
116075
116079
|
// 计算与场景包围盒的交点(优先)
|
|
116076
116080
|
var boxHitPoint = null;
|
|
116077
116081
|
// 若包围盒不存在或为空,兜底从模型组/场景计算一次
|
|
116078
|
-
if (!sceneBoundingBox || sceneBoundingBox.isBox3 && sceneBoundingBox.isEmpty && sceneBoundingBox.isEmpty()) {
|
|
116079
|
-
var _obj = typeof modelGroup !== 'undefined' && modelGroup && modelGroup.children && modelGroup.children.length ? modelGroup :
|
|
116082
|
+
if (!this.sceneBoundingBox || this.sceneBoundingBox.isBox3 && this.sceneBoundingBox.isEmpty && this.sceneBoundingBox.isEmpty()) {
|
|
116083
|
+
var _obj = typeof this.modelGroup !== 'undefined' && this.modelGroup && this.modelGroup.children && this.modelGroup.children.length ? this.modelGroup : this.scene;
|
|
116080
116084
|
if (_obj) {
|
|
116081
|
-
sceneBoundingBox = new this.THREE.Box3().setFromObject(_obj);
|
|
116085
|
+
this.sceneBoundingBox = new this.THREE.Box3().setFromObject(_obj);
|
|
116082
116086
|
}
|
|
116083
116087
|
}
|
|
116084
|
-
if (sceneBoundingBox && sceneBoundingBox.isBox3) {
|
|
116085
|
-
boxHitPoint = ray.intersectBox(sceneBoundingBox, new this.THREE.Vector3());
|
|
116088
|
+
if (this.sceneBoundingBox && this.sceneBoundingBox.isBox3) {
|
|
116089
|
+
boxHitPoint = ray.intersectBox(this.sceneBoundingBox, new this.THREE.Vector3());
|
|
116086
116090
|
}
|
|
116087
116091
|
|
|
116088
116092
|
// targetPoint 保留原平面回退逻辑(用于其他需要点位的场景)
|
|
@@ -116123,12 +116127,12 @@ var isDebug = false || false === true;
|
|
|
116123
116127
|
isModelInFrustum: function isModelInFrustum(model) {
|
|
116124
116128
|
var instanceId = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;
|
|
116125
116129
|
var frustum = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;
|
|
116126
|
-
if (!model || !
|
|
116130
|
+
if (!model || !this.camera) return true;
|
|
116127
116131
|
|
|
116128
116132
|
// 优先使用传入的 frustum,避免重复创建
|
|
116129
116133
|
if (!frustum) {
|
|
116130
116134
|
frustum = new this.THREE.Frustum();
|
|
116131
|
-
var matrix = new this.THREE.Matrix4().multiplyMatrices(
|
|
116135
|
+
var matrix = new this.THREE.Matrix4().multiplyMatrices(this.camera.projectionMatrix, this.camera.matrixWorldInverse);
|
|
116132
116136
|
frustum.setFromProjectionMatrix(matrix);
|
|
116133
116137
|
}
|
|
116134
116138
|
var box;
|
|
@@ -116158,7 +116162,7 @@ var isDebug = false || false === true;
|
|
|
116158
116162
|
* @returns {number} SSE值
|
|
116159
116163
|
*/
|
|
116160
116164
|
calculateSSE: function calculateSSE(model) {
|
|
116161
|
-
if (!model || !
|
|
116165
|
+
if (!model || !this.camera || !this.renderer) return 0;
|
|
116162
116166
|
|
|
116163
116167
|
// 获取模型的包围盒
|
|
116164
116168
|
var box = new this.THREE.Box3().setFromObject(model);
|
|
@@ -116172,7 +116176,7 @@ var isDebug = false || false === true;
|
|
|
116172
116176
|
|
|
116173
116177
|
// 获取相机世界位置
|
|
116174
116178
|
var cameraPosition = new this.THREE.Vector3();
|
|
116175
|
-
|
|
116179
|
+
this.camera.getWorldPosition(cameraPosition);
|
|
116176
116180
|
|
|
116177
116181
|
// 计算相机到物体包围盒中心的距离
|
|
116178
116182
|
var distance = cameraPosition.distanceTo(center);
|
|
@@ -116181,10 +116185,10 @@ var isDebug = false || false === true;
|
|
|
116181
116185
|
if (distance === 0) return Infinity;
|
|
116182
116186
|
|
|
116183
116187
|
// 获取视口高度
|
|
116184
|
-
var viewportHeight =
|
|
116188
|
+
var viewportHeight = this.renderer.domElement.clientHeight;
|
|
116185
116189
|
|
|
116186
116190
|
// 计算tan(fov/2),fov是以度为单位
|
|
116187
|
-
var halfFovRad = this.THREE.MathUtils.degToRad(
|
|
116191
|
+
var halfFovRad = this.THREE.MathUtils.degToRad(this.camera.fov / 2);
|
|
116188
116192
|
var tanHalfFov = Math.tan(halfFovRad);
|
|
116189
116193
|
|
|
116190
116194
|
// 计算SSE
|
|
@@ -116196,13 +116200,13 @@ var isDebug = false || false === true;
|
|
|
116196
116200
|
},
|
|
116197
116201
|
// 针对已卸载实例的信息进行视锥体检测
|
|
116198
116202
|
isInstanceInfoInFrustum: function isInstanceInfoInFrustum(instanceInfo) {
|
|
116199
|
-
if (!instanceInfo || !
|
|
116203
|
+
if (!instanceInfo || !this.camera) return true;
|
|
116200
116204
|
var geometry = instanceInfo.geometry,
|
|
116201
116205
|
originalMatrix = instanceInfo.originalMatrix,
|
|
116202
116206
|
parent = instanceInfo.parent;
|
|
116203
116207
|
if (!geometry || !originalMatrix) return false;
|
|
116204
116208
|
var frustum = new this.THREE.Frustum();
|
|
116205
|
-
var vpMatrix = new this.THREE.Matrix4().multiplyMatrices(
|
|
116209
|
+
var vpMatrix = new this.THREE.Matrix4().multiplyMatrices(this.camera.projectionMatrix, this.camera.matrixWorldInverse);
|
|
116206
116210
|
frustum.setFromProjectionMatrix(vpMatrix);
|
|
116207
116211
|
var parentWorld = parent && parent.matrixWorld ? parent.matrixWorld : instanceInfo.parentWorldMatrix || new this.THREE.Matrix4();
|
|
116208
116212
|
var worldMatrix = parentWorld.clone().multiply(originalMatrix);
|
|
@@ -116217,33 +116221,33 @@ var isDebug = false || false === true;
|
|
|
116217
116221
|
* 执行视椎体裁切,清理视椎体外的InstancedMesh实例
|
|
116218
116222
|
*/
|
|
116219
116223
|
performFrustumCulling: function performFrustumCulling() {
|
|
116220
|
-
var
|
|
116221
|
-
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function
|
|
116224
|
+
var _this9 = this;
|
|
116225
|
+
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee2() {
|
|
116222
116226
|
var modelState, now, globalFrustum, globalVpMatrix, toUnload, bypassList, visibleIds, candidates, visibleIdSet, frustum, exclude, hits, i, occlusionState, occlusionEnabled, state, w, h, aspectRatio, sw, sh, rt, t0, opaqueCandidates, transparentCandidates, _i3, totalInstances, transparentTotal, activeIdIndexArr, transparentIdIndexArr, occObjs, asyncBuildEnabled, _occBuild, asyncState, token, opaqueSnapshot, transparentMesh, transparentCapacity, nextCap, geometry, material, tempMatrix, tempScale, tempObj, tempColor, tIdx, _i8, c, idx, r, g, b, _c$box$userData$obb, matrix, halfSize, tMaxIdx, prevToneMapping, prevTarget, prevClearColorHex, prevClearAlpha, _c3, cvs, cssW, cssH, dst, src, row, srcRow, dstRow, idIndexArr, maxIdx, totalPixels, targetSamples, baseStride, extraStride, stride, minSampleCount, scanResult, indices, _i9, id, transparentMaxIdx, tIdIndexArr, tScanResult, tIndices, _i0, _id, _i1, _i10, toLoadSet, parentsToCheck, _i13, _toUnload, _toUnload$_i, modelId, child, _t;
|
|
116223
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (
|
|
116224
|
-
while (1) switch (
|
|
116227
|
+
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context2) {
|
|
116228
|
+
while (1) switch (_context2.p = _context2.n) {
|
|
116225
116229
|
case 0:
|
|
116226
|
-
modelState =
|
|
116227
|
-
if (!(!
|
|
116228
|
-
|
|
116230
|
+
modelState = _this9.noObserver ? _this9.noObserver.modelStateManager : _this9.modelStateManager;
|
|
116231
|
+
if (!(!_this9.modelStateManager.frustumCheckEnabled || !_this9.scene)) {
|
|
116232
|
+
_context2.n = 1;
|
|
116229
116233
|
break;
|
|
116230
116234
|
}
|
|
116231
|
-
return
|
|
116235
|
+
return _context2.a(2);
|
|
116232
116236
|
case 1:
|
|
116233
116237
|
now = Date.now();
|
|
116234
116238
|
if (!(now - modelState.lastCullingTime < 100)) {
|
|
116235
|
-
|
|
116239
|
+
_context2.n = 2;
|
|
116236
116240
|
break;
|
|
116237
116241
|
}
|
|
116238
|
-
return
|
|
116242
|
+
return _context2.a(2);
|
|
116239
116243
|
case 2:
|
|
116240
116244
|
modelState.lastCullingTime = now;
|
|
116241
116245
|
|
|
116242
116246
|
// 预先创建视椎体,供后续遍历复用
|
|
116243
|
-
if (!
|
|
116244
|
-
if (!
|
|
116245
|
-
globalFrustum =
|
|
116246
|
-
globalVpMatrix =
|
|
116247
|
+
if (!_this9._frustum) _this9._frustum = new _this9.THREE.Frustum();
|
|
116248
|
+
if (!_this9._vpMatrix) _this9._vpMatrix = new _this9.THREE.Matrix4();
|
|
116249
|
+
globalFrustum = _this9._frustum;
|
|
116250
|
+
globalVpMatrix = _this9._vpMatrix.multiplyMatrices(_this9.camera.projectionMatrix, _this9.camera.matrixWorldInverse);
|
|
116247
116251
|
globalFrustum.setFromProjectionMatrix(globalVpMatrix);
|
|
116248
116252
|
|
|
116249
116253
|
// 使用局部变量收集 ID,最后一次性赋值
|
|
@@ -116257,39 +116261,39 @@ var isDebug = false || false === true;
|
|
|
116257
116261
|
});
|
|
116258
116262
|
}
|
|
116259
116263
|
visibleIdSet = new Set(visibleIds);
|
|
116260
|
-
if (!
|
|
116261
|
-
|
|
116264
|
+
if (!_this9._octree) {
|
|
116265
|
+
_context2.n = 7;
|
|
116262
116266
|
break;
|
|
116263
116267
|
}
|
|
116264
|
-
frustum =
|
|
116268
|
+
frustum = _this9._getCurrentFrustum();
|
|
116265
116269
|
exclude = bypassList || new Set();
|
|
116266
|
-
hits =
|
|
116270
|
+
hits = _this9.queryOctreeByFrustum(frustum, exclude);
|
|
116267
116271
|
i = 0;
|
|
116268
116272
|
case 3:
|
|
116269
116273
|
if (!(i < hits.length)) {
|
|
116270
|
-
|
|
116274
|
+
_context2.n = 6;
|
|
116271
116275
|
break;
|
|
116272
116276
|
}
|
|
116273
116277
|
if (!(hits[i].box && hits[i].box.userData && hits[i].box.userData.visible === false)) {
|
|
116274
|
-
|
|
116278
|
+
_context2.n = 4;
|
|
116275
116279
|
break;
|
|
116276
116280
|
}
|
|
116277
|
-
return
|
|
116281
|
+
return _context2.a(3, 5);
|
|
116278
116282
|
case 4:
|
|
116279
116283
|
candidates.push(hits[i]);
|
|
116280
116284
|
case 5:
|
|
116281
116285
|
i++;
|
|
116282
|
-
|
|
116286
|
+
_context2.n = 3;
|
|
116283
116287
|
break;
|
|
116284
116288
|
case 6:
|
|
116285
|
-
|
|
116289
|
+
_context2.n = 8;
|
|
116286
116290
|
break;
|
|
116287
116291
|
case 7:
|
|
116288
|
-
if (
|
|
116289
|
-
|
|
116292
|
+
if (_this9._boxIndex && _this9._boxIndex.size > 0) {
|
|
116293
|
+
_this9._boxIndex.forEach(function (box, modelId) {
|
|
116290
116294
|
if (bypassList && bypassList.size > 0 && bypassList.has(modelId)) return;
|
|
116291
116295
|
if (box.userData && box.userData.visible === false) return;
|
|
116292
|
-
if (
|
|
116296
|
+
if (_this9.isBoxInFrustum(box)) {
|
|
116293
116297
|
candidates.push({
|
|
116294
116298
|
modelId: modelId,
|
|
116295
116299
|
box: box
|
|
@@ -116298,36 +116302,36 @@ var isDebug = false || false === true;
|
|
|
116298
116302
|
});
|
|
116299
116303
|
}
|
|
116300
116304
|
case 8:
|
|
116301
|
-
occlusionState =
|
|
116302
|
-
occlusionEnabled =
|
|
116305
|
+
occlusionState = _this9.noObserver ? _this9.noObserver.occlusionState : _this9.occlusionState; // 从响应式对象获取开关状态
|
|
116306
|
+
occlusionEnabled = _this9.occlusionState && _this9.occlusionState.enabled;
|
|
116303
116307
|
if (!occlusionEnabled) {
|
|
116304
|
-
|
|
116308
|
+
_context2.n = 15;
|
|
116305
116309
|
break;
|
|
116306
116310
|
}
|
|
116307
116311
|
state = occlusionState;
|
|
116308
|
-
w =
|
|
116309
|
-
h =
|
|
116312
|
+
w = _this9.renderer && _this9.renderer.domElement ? _this9.renderer.domElement.clientWidth || _this9.renderer.domElement.width || 0 : 0;
|
|
116313
|
+
h = _this9.renderer && _this9.renderer.domElement ? _this9.renderer.domElement.clientHeight || _this9.renderer.domElement.height || 0 : 0; // bufferWidth/Height 仍从响应式对象读取以支持动态修改
|
|
116310
116314
|
// 性能优化:使用降采样缓冲区进行遮挡剔除,大幅减少 readPixels 耗时 (从全屏降至约 256px 宽)
|
|
116311
116315
|
aspectRatio = h > 0 ? w / h : 1;
|
|
116312
|
-
sw =
|
|
116316
|
+
sw = _this9.occlusionState.bufferWidth || 256;
|
|
116313
116317
|
sh = Math.floor(sw / aspectRatio);
|
|
116314
116318
|
sw = Math.max(1, sw);
|
|
116315
116319
|
sh = Math.max(1, sh);
|
|
116316
116320
|
rt = state._colorRT;
|
|
116317
116321
|
t0 = performance.now();
|
|
116318
|
-
|
|
116322
|
+
_context2.p = 9;
|
|
116319
116323
|
if (!rt || state._rtW !== sw || state._rtH !== sh) {
|
|
116320
116324
|
if (rt && typeof rt.dispose === 'function') rt.dispose();
|
|
116321
|
-
rt = new
|
|
116325
|
+
rt = new _this9.THREE.WebGLRenderTarget(sw, sh, {
|
|
116322
116326
|
depthBuffer: true,
|
|
116323
116327
|
stencilBuffer: false,
|
|
116324
116328
|
samples: 0
|
|
116325
116329
|
});
|
|
116326
|
-
rt.texture.minFilter =
|
|
116327
|
-
rt.texture.magFilter =
|
|
116330
|
+
rt.texture.minFilter = _this9.THREE.NearestFilter;
|
|
116331
|
+
rt.texture.magFilter = _this9.THREE.NearestFilter;
|
|
116328
116332
|
rt.texture.generateMipmaps = false;
|
|
116329
|
-
rt.texture.type =
|
|
116330
|
-
rt.texture.format =
|
|
116333
|
+
rt.texture.type = _this9.THREE.UnsignedByteType;
|
|
116334
|
+
rt.texture.format = _this9.THREE.RGBAFormat;
|
|
116331
116335
|
rt.samples = 0;
|
|
116332
116336
|
state._colorRT = rt;
|
|
116333
116337
|
state._rtW = sw;
|
|
@@ -116336,18 +116340,18 @@ var isDebug = false || false === true;
|
|
|
116336
116340
|
} else if (!state._colorBuffer || state._colorBuffer.length !== sw * sh * 4) {
|
|
116337
116341
|
state._colorBuffer = new Uint8Array(sw * sh * 4);
|
|
116338
116342
|
}
|
|
116339
|
-
if (!state._occScene) state._occScene = new
|
|
116343
|
+
if (!state._occScene) state._occScene = new _this9.THREE.Scene();
|
|
116340
116344
|
// if (!state._occPerfStats) state._occPerfStats = Object.create(null);
|
|
116341
116345
|
// const _occRecordPerf = (name, ms, meta) => {
|
|
116342
|
-
// const stats = state._occPerfStats;
|
|
116343
|
-
// const prev = stats[name];
|
|
116346
|
+
// const this.stats = state._occPerfStats;
|
|
116347
|
+
// const prev = this.stats[name];
|
|
116344
116348
|
// const next = prev || { count: 0, total: 0, max: 0, last: 0, meta: null };
|
|
116345
116349
|
// next.count++;
|
|
116346
116350
|
// next.total += ms;
|
|
116347
116351
|
// next.last = ms;
|
|
116348
116352
|
// if (ms > next.max) next.max = ms;
|
|
116349
116353
|
// if (meta) next.meta = meta;
|
|
116350
|
-
// stats[name] = next;
|
|
116354
|
+
// this.stats[name] = next;
|
|
116351
116355
|
// };
|
|
116352
116356
|
|
|
116353
116357
|
// 过滤掉透明物体
|
|
@@ -116385,7 +116389,7 @@ var isDebug = false || false === true;
|
|
|
116385
116389
|
// child.parent = null;
|
|
116386
116390
|
// // child.dispatchEvent({ type: 'removed' }); // 保持轻量,暂不触发事件
|
|
116387
116391
|
// }
|
|
116388
|
-
asyncBuildEnabled =
|
|
116392
|
+
asyncBuildEnabled = _this9.occlusionState && _this9.occlusionState.asyncBuildEnabled && !!window.requestAnimationFrame;
|
|
116389
116393
|
_occBuild = function _occBuild(opaqueList) {
|
|
116390
116394
|
var tBuild0 = performance.now();
|
|
116391
116395
|
var flag1Items = [];
|
|
@@ -116396,7 +116400,7 @@ var isDebug = false || false === true;
|
|
|
116396
116400
|
var obbData = c.box && c.box.userData ? c.box.userData.obbData : null;
|
|
116397
116401
|
if (!obbData || !obbData.length) continue;
|
|
116398
116402
|
var idx = globalIdx++;
|
|
116399
|
-
activeIdIndexArr[idx] =
|
|
116403
|
+
activeIdIndexArr[idx] = _this9.formatModelId(c.modelId);
|
|
116400
116404
|
var flag = c.box.userData && c.box.userData.flag || 1;
|
|
116401
116405
|
if (flag === 3 && c.box.userData && c.box.userData.obb) {
|
|
116402
116406
|
flag3Items.push({
|
|
@@ -116412,11 +116416,11 @@ var isDebug = false || false === true;
|
|
|
116412
116416
|
}
|
|
116413
116417
|
var maxIdx = globalIdx - 1;
|
|
116414
116418
|
activeIdIndexArr.length = maxIdx + 1;
|
|
116415
|
-
var _tempMatrix = occObjs._tempMatrix || (occObjs._tempMatrix = new
|
|
116416
|
-
var _tempColor = occObjs._tempColor || (occObjs._tempColor = new
|
|
116417
|
-
var _tempScale = occObjs._tempScale || (occObjs._tempScale = new
|
|
116418
|
-
var _tempVec3 = occObjs._tempVec3 || (occObjs._tempVec3 = new
|
|
116419
|
-
var _tempMatA = occObjs._tempMatA || (occObjs._tempMatA = new
|
|
116419
|
+
var _tempMatrix = occObjs._tempMatrix || (occObjs._tempMatrix = new _this9.THREE.Matrix4());
|
|
116420
|
+
var _tempColor = occObjs._tempColor || (occObjs._tempColor = new _this9.THREE.Color());
|
|
116421
|
+
var _tempScale = occObjs._tempScale || (occObjs._tempScale = new _this9.THREE.Vector3());
|
|
116422
|
+
var _tempVec3 = occObjs._tempVec3 || (occObjs._tempVec3 = new _this9.THREE.Vector3());
|
|
116423
|
+
var _tempMatA = occObjs._tempMatA || (occObjs._tempMatA = new _this9.THREE.Matrix4());
|
|
116420
116424
|
var boxes = occObjs.boxes;
|
|
116421
116425
|
var boxCount = flag3Items.length;
|
|
116422
116426
|
if (boxCount > 0) {
|
|
@@ -116429,16 +116433,16 @@ var isDebug = false || false === true;
|
|
|
116429
116433
|
if (boxes.mesh.material) boxes.mesh.material.dispose();
|
|
116430
116434
|
}
|
|
116431
116435
|
var nextCap = Math.max(needCapacity, capacity > 0 ? capacity * 2 : 256);
|
|
116432
|
-
var geometry = new
|
|
116433
|
-
var mat = new
|
|
116436
|
+
var geometry = new _this9.THREE.BoxGeometry(1, 1, 1);
|
|
116437
|
+
var mat = new _this9.THREE.MeshBasicMaterial({
|
|
116434
116438
|
color: 0xffffff,
|
|
116435
|
-
side:
|
|
116436
|
-
blending:
|
|
116439
|
+
side: _this9.THREE.DoubleSide,
|
|
116440
|
+
blending: _this9.THREE.NoBlending,
|
|
116437
116441
|
depthTest: true,
|
|
116438
116442
|
depthWrite: true,
|
|
116439
116443
|
toneMapped: false
|
|
116440
116444
|
});
|
|
116441
|
-
var mesh = new
|
|
116445
|
+
var mesh = new _this9.THREE.InstancedMesh(geometry, mat, nextCap);
|
|
116442
116446
|
mesh.frustumCulled = false;
|
|
116443
116447
|
mesh.matrixAutoUpdate = false;
|
|
116444
116448
|
state._occScene.add(mesh);
|
|
@@ -116463,8 +116467,8 @@ var isDebug = false || false === true;
|
|
|
116463
116467
|
_tempScale.copy(halfSize).multiplyScalar(2);
|
|
116464
116468
|
_tempMatrix.copy(matrix);
|
|
116465
116469
|
_tempMatrix.scale(_tempScale);
|
|
116466
|
-
if (typeof bizToThreeMatrix !== 'undefined' && bizToThreeMatrix) {
|
|
116467
|
-
_tempMatrix.premultiply(bizToThreeMatrix);
|
|
116470
|
+
if (typeof _this9.bizToThreeMatrix !== 'undefined' && _this9.bizToThreeMatrix) {
|
|
116471
|
+
_tempMatrix.premultiply(_this9.bizToThreeMatrix);
|
|
116468
116472
|
}
|
|
116469
116473
|
boxes.mesh.setMatrixAt(_i5, _tempMatrix);
|
|
116470
116474
|
boxes.mesh.setColorAt(_i5, _tempColor);
|
|
@@ -116493,16 +116497,16 @@ var isDebug = false || false === true;
|
|
|
116493
116497
|
var needIdx = totalIdx;
|
|
116494
116498
|
var ensureBatch1 = function ensureBatch1() {
|
|
116495
116499
|
if (batch1 && batch1.mesh && batch1.geometry && batch1.material) return;
|
|
116496
|
-
var geometry = new
|
|
116497
|
-
var material = new
|
|
116500
|
+
var geometry = new _this9.THREE.BufferGeometry();
|
|
116501
|
+
var material = new _this9.THREE.MeshBasicMaterial({
|
|
116498
116502
|
vertexColors: true,
|
|
116499
|
-
side:
|
|
116500
|
-
blending:
|
|
116503
|
+
side: _this9.THREE.DoubleSide,
|
|
116504
|
+
blending: _this9.THREE.NoBlending,
|
|
116501
116505
|
depthTest: true,
|
|
116502
116506
|
depthWrite: true,
|
|
116503
116507
|
toneMapped: false
|
|
116504
116508
|
});
|
|
116505
|
-
var mesh = new
|
|
116509
|
+
var mesh = new _this9.THREE.Mesh(geometry, material);
|
|
116506
116510
|
mesh.frustumCulled = false;
|
|
116507
116511
|
batch1 = occObjs.batch1 = {
|
|
116508
116512
|
mesh: mesh,
|
|
@@ -116526,14 +116530,14 @@ var isDebug = false || false === true;
|
|
|
116526
116530
|
batch1.positions = _positions;
|
|
116527
116531
|
batch1.colors = _colors;
|
|
116528
116532
|
batch1.indices = _indices2;
|
|
116529
|
-
var _posAttr = new
|
|
116530
|
-
var _colAttr = new
|
|
116531
|
-
_posAttr.setUsage(
|
|
116532
|
-
_colAttr.setUsage(
|
|
116533
|
+
var _posAttr = new _this9.THREE.BufferAttribute(_positions, 3);
|
|
116534
|
+
var _colAttr = new _this9.THREE.BufferAttribute(_colors, 3);
|
|
116535
|
+
_posAttr.setUsage(_this9.THREE.DynamicDrawUsage);
|
|
116536
|
+
_colAttr.setUsage(_this9.THREE.DynamicDrawUsage);
|
|
116533
116537
|
batch1.geometry.setAttribute('position', _posAttr);
|
|
116534
116538
|
batch1.geometry.setAttribute('color', _colAttr);
|
|
116535
|
-
var _idxAttr = new
|
|
116536
|
-
_idxAttr.setUsage(
|
|
116539
|
+
var _idxAttr = new _this9.THREE.BufferAttribute(_indices2, 1);
|
|
116540
|
+
_idxAttr.setUsage(_this9.THREE.DynamicDrawUsage);
|
|
116537
116541
|
batch1.geometry.setIndex(_idxAttr);
|
|
116538
116542
|
}
|
|
116539
116543
|
var positions = batch1.positions;
|
|
@@ -116553,15 +116557,15 @@ var isDebug = false || false === true;
|
|
|
116553
116557
|
var _g = (_idx2 >> 8 & 255) / 255;
|
|
116554
116558
|
var _b = (_idx2 >> 16 & 255) / 255;
|
|
116555
116559
|
var vertexCount = _obbData2.length / 3 | 0;
|
|
116556
|
-
var needTransform = matrixArr && matrixArr.length >= 16 || typeof bizToThreeMatrix !== 'undefined' && bizToThreeMatrix;
|
|
116560
|
+
var needTransform = matrixArr && matrixArr.length >= 16 || typeof _this9.bizToThreeMatrix !== 'undefined' && _this9.bizToThreeMatrix;
|
|
116557
116561
|
if (needTransform) {
|
|
116558
116562
|
if (matrixArr && matrixArr.length >= 16) {
|
|
116559
116563
|
_tempMatA.fromArray(matrixArr);
|
|
116560
116564
|
} else {
|
|
116561
116565
|
_tempMatA.identity();
|
|
116562
116566
|
}
|
|
116563
|
-
if (typeof bizToThreeMatrix !== 'undefined' && bizToThreeMatrix) {
|
|
116564
|
-
_tempMatA.premultiply(bizToThreeMatrix);
|
|
116567
|
+
if (typeof _this9.bizToThreeMatrix !== 'undefined' && _this9.bizToThreeMatrix) {
|
|
116568
|
+
_tempMatA.premultiply(_this9.bizToThreeMatrix);
|
|
116565
116569
|
}
|
|
116566
116570
|
}
|
|
116567
116571
|
if (!needTransform && ArrayBuffer.isView(_obbData2)) {
|
|
@@ -116661,7 +116665,7 @@ var isDebug = false || false === true;
|
|
|
116661
116665
|
state._occMaxIdx = 0;
|
|
116662
116666
|
activeIdIndexArr.length = 0;
|
|
116663
116667
|
}
|
|
116664
|
-
if (!state._occTransparentScene) state._occTransparentScene = new
|
|
116668
|
+
if (!state._occTransparentScene) state._occTransparentScene = new _this9.THREE.Scene();
|
|
116665
116669
|
transparentMesh = state._occTransparentMesh;
|
|
116666
116670
|
transparentCapacity = transparentMesh && transparentMesh.userData && typeof transparentMesh.userData.capacity === 'number' ? transparentMesh.userData.capacity : 0;
|
|
116667
116671
|
if (!transparentMesh || transparentCapacity < transparentTotal) {
|
|
@@ -116671,16 +116675,16 @@ var isDebug = false || false === true;
|
|
|
116671
116675
|
state._occTransparentScene.remove(transparentMesh);
|
|
116672
116676
|
}
|
|
116673
116677
|
nextCap = Math.max(transparentTotal, transparentCapacity > 0 ? transparentCapacity * 2 : 256);
|
|
116674
|
-
geometry = new
|
|
116675
|
-
material = new
|
|
116678
|
+
geometry = new _this9.THREE.BoxGeometry(1, 1, 1);
|
|
116679
|
+
material = new _this9.THREE.MeshBasicMaterial({
|
|
116676
116680
|
color: 0xffffff,
|
|
116677
|
-
side:
|
|
116678
|
-
blending:
|
|
116681
|
+
side: _this9.THREE.DoubleSide,
|
|
116682
|
+
blending: _this9.THREE.NoBlending,
|
|
116679
116683
|
depthTest: true,
|
|
116680
116684
|
depthWrite: false,
|
|
116681
116685
|
toneMapped: false
|
|
116682
116686
|
});
|
|
116683
|
-
transparentMesh = new
|
|
116687
|
+
transparentMesh = new _this9.THREE.InstancedMesh(geometry, material, nextCap);
|
|
116684
116688
|
transparentMesh.frustumCulled = false;
|
|
116685
116689
|
transparentMesh.matrixAutoUpdate = false;
|
|
116686
116690
|
transparentMesh.userData.capacity = nextCap;
|
|
@@ -116690,15 +116694,15 @@ var isDebug = false || false === true;
|
|
|
116690
116694
|
state._occTransparentScene.add(transparentMesh);
|
|
116691
116695
|
}
|
|
116692
116696
|
if (transparentTotal > 0) {
|
|
116693
|
-
tempMatrix = new
|
|
116694
|
-
tempScale = new
|
|
116695
|
-
tempObj = new
|
|
116696
|
-
tempColor = new
|
|
116697
|
+
tempMatrix = new _this9.THREE.Matrix4();
|
|
116698
|
+
tempScale = new _this9.THREE.Vector3();
|
|
116699
|
+
tempObj = new _this9.THREE.Object3D();
|
|
116700
|
+
tempColor = new _this9.THREE.Color();
|
|
116697
116701
|
tIdx = 1;
|
|
116698
116702
|
for (_i8 = 0; _i8 < transparentTotal; _i8++) {
|
|
116699
116703
|
c = transparentCandidates[_i8];
|
|
116700
116704
|
idx = tIdx++;
|
|
116701
|
-
transparentIdIndexArr[idx] =
|
|
116705
|
+
transparentIdIndexArr[idx] = _this9.formatModelId(c.modelId);
|
|
116702
116706
|
r = (idx & 255) / 255;
|
|
116703
116707
|
g = (idx >> 8 & 255) / 255;
|
|
116704
116708
|
b = (idx >> 16 & 255) / 255;
|
|
@@ -116708,8 +116712,8 @@ var isDebug = false || false === true;
|
|
|
116708
116712
|
tempMatrix.copy(matrix);
|
|
116709
116713
|
tempScale.copy(halfSize).multiplyScalar(2);
|
|
116710
116714
|
tempMatrix.scale(tempScale);
|
|
116711
|
-
if (typeof bizToThreeMatrix !== 'undefined' && bizToThreeMatrix) {
|
|
116712
|
-
tempMatrix.premultiply(bizToThreeMatrix);
|
|
116715
|
+
if (typeof _this9.bizToThreeMatrix !== 'undefined' && _this9.bizToThreeMatrix) {
|
|
116716
|
+
tempMatrix.premultiply(_this9.bizToThreeMatrix);
|
|
116713
116717
|
}
|
|
116714
116718
|
} else {
|
|
116715
116719
|
c.box.getSize(tempScale);
|
|
@@ -116736,29 +116740,29 @@ var isDebug = false || false === true;
|
|
|
116736
116740
|
state._occTransparentMaxIdx = 0;
|
|
116737
116741
|
}
|
|
116738
116742
|
|
|
116739
|
-
// console.log('renderer', renderer)
|
|
116740
|
-
prevToneMapping =
|
|
116741
|
-
prevTarget =
|
|
116743
|
+
// console.log('this.renderer', this.renderer)
|
|
116744
|
+
prevToneMapping = _this9.renderer.toneMapping;
|
|
116745
|
+
prevTarget = _this9.renderer.getRenderTarget ? _this9.renderer.getRenderTarget() : null;
|
|
116742
116746
|
prevClearColorHex = 0x000000;
|
|
116743
116747
|
prevClearAlpha = 0;
|
|
116744
116748
|
try {
|
|
116745
|
-
_c3 =
|
|
116749
|
+
_c3 = _this9.renderer.getClearColor ? _this9.renderer.getClearColor() : null;
|
|
116746
116750
|
if (_c3 && _c3.isColor) prevClearColorHex = _c3.getHex();
|
|
116747
|
-
prevClearAlpha = typeof
|
|
116751
|
+
prevClearAlpha = typeof _this9.renderer.getClearAlpha === 'function' ? _this9.renderer.getClearAlpha() : 0;
|
|
116748
116752
|
} catch (_) {}
|
|
116749
|
-
|
|
116750
|
-
|
|
116751
|
-
|
|
116752
|
-
|
|
116753
|
-
|
|
116754
|
-
|
|
116755
|
-
|
|
116753
|
+
_this9.renderer.toneMapping = _this9.THREE.NoToneMapping;
|
|
116754
|
+
_this9.renderer.setRenderTarget(rt);
|
|
116755
|
+
_this9.renderer.setClearColor(new _this9.THREE.Color(0, 0, 0), 0);
|
|
116756
|
+
_this9.renderer.clear(true, true, false);
|
|
116757
|
+
_this9.camera.updateMatrixWorld(true);
|
|
116758
|
+
_this9.renderer.render(state._occScene, _this9.camera);
|
|
116759
|
+
_this9.updateGlobalSceneBoundingBox();
|
|
116756
116760
|
// const t1 = performance.now();
|
|
116757
116761
|
// 从响应式对象读取 previewEnabled
|
|
116758
|
-
|
|
116762
|
+
_this9.$emit('updateBoundingBox');
|
|
116759
116763
|
|
|
116760
116764
|
// const tPreview0 = performance.now();
|
|
116761
|
-
if (
|
|
116765
|
+
if (_this9.occlusionState.previewEnabled) {
|
|
116762
116766
|
if (!state._previewCanvas) {
|
|
116763
116767
|
cvs = document.createElement('canvas');
|
|
116764
116768
|
cvs.style.position = 'fixed';
|
|
@@ -116776,11 +116780,11 @@ var isDebug = false || false === true;
|
|
|
116776
116780
|
}
|
|
116777
116781
|
state._previewCanvas.width = sw;
|
|
116778
116782
|
state._previewCanvas.height = sh;
|
|
116779
|
-
cssW = Math.min(
|
|
116780
|
-
cssH = Math.min(
|
|
116783
|
+
cssW = Math.min(_this9.renderer.domElement.width / 5);
|
|
116784
|
+
cssH = Math.min(_this9.renderer.domElement.height / 5);
|
|
116781
116785
|
state._previewCanvas.style.width = cssW + 'px';
|
|
116782
116786
|
state._previewCanvas.style.height = cssH + 'px';
|
|
116783
|
-
|
|
116787
|
+
_this9.renderer.readRenderTargetPixels(rt, 0, 0, sw, sh, state._previewBuffer);
|
|
116784
116788
|
if (!state._previewImageData || state._previewImageData.width !== sw || state._previewImageData.height !== sh) {
|
|
116785
116789
|
state._previewImageData = state._previewCtx.createImageData(sw, sh);
|
|
116786
116790
|
}
|
|
@@ -116803,19 +116807,19 @@ var isDebug = false || false === true;
|
|
|
116803
116807
|
}
|
|
116804
116808
|
// const tPreview1 = performance.now();
|
|
116805
116809
|
// _occRecordPerf('occ_preview_ms', tPreview1 - tPreview0, { sw, sh });
|
|
116806
|
-
|
|
116810
|
+
_this9.renderer.readRenderTargetPixels(rt, 0, 0, sw, sh, state._colorBuffer);
|
|
116807
116811
|
idIndexArr = activeIdIndexArr;
|
|
116808
116812
|
maxIdx = typeof state._occMaxIdx === 'number' ? state._occMaxIdx : 0;
|
|
116809
116813
|
totalPixels = sw * sh;
|
|
116810
116814
|
targetSamples = totalPixels;
|
|
116811
116815
|
baseStride = Math.max(1, Math.floor(Math.sqrt(totalPixels / Math.max(1, targetSamples))));
|
|
116812
|
-
extraStride =
|
|
116816
|
+
extraStride = _this9.occlusionState && _this9.occlusionState.sampleStride ? _this9.occlusionState.sampleStride : 1;
|
|
116813
116817
|
stride = Math.max(1, baseStride * Math.max(1, extraStride));
|
|
116814
|
-
minSampleCount =
|
|
116815
|
-
|
|
116816
|
-
return
|
|
116818
|
+
minSampleCount = _this9.occlusionState && _this9.occlusionState.minSampleCount ? _this9.occlusionState.minSampleCount : 1;
|
|
116819
|
+
_context2.n = 10;
|
|
116820
|
+
return _this9.scanOcclusionIndices(state._colorBuffer, sw, sh, stride, maxIdx, minSampleCount);
|
|
116817
116821
|
case 10:
|
|
116818
|
-
scanResult =
|
|
116822
|
+
scanResult = _context2.v;
|
|
116819
116823
|
if (scanResult && scanResult.buffer) {
|
|
116820
116824
|
state._colorBuffer = new Uint8Array(scanResult.buffer);
|
|
116821
116825
|
}
|
|
@@ -116828,18 +116832,18 @@ var isDebug = false || false === true;
|
|
|
116828
116832
|
}
|
|
116829
116833
|
transparentMaxIdx = typeof state._occTransparentMaxIdx === 'number' ? state._occTransparentMaxIdx : 0;
|
|
116830
116834
|
if (!(transparentMaxIdx > 0 && transparentMesh && transparentMesh.visible)) {
|
|
116831
|
-
|
|
116835
|
+
_context2.n = 12;
|
|
116832
116836
|
break;
|
|
116833
116837
|
}
|
|
116834
|
-
|
|
116835
|
-
|
|
116836
|
-
|
|
116837
|
-
|
|
116838
|
+
_this9.renderer.setClearColor(new _this9.THREE.Color(0, 0, 0), 0);
|
|
116839
|
+
_this9.renderer.clear(true, false, false);
|
|
116840
|
+
_this9.renderer.render(state._occTransparentScene, _this9.camera);
|
|
116841
|
+
_this9.renderer.readRenderTargetPixels(rt, 0, 0, sw, sh, state._colorBuffer);
|
|
116838
116842
|
tIdIndexArr = transparentIdIndexArr;
|
|
116839
|
-
|
|
116840
|
-
return
|
|
116843
|
+
_context2.n = 11;
|
|
116844
|
+
return _this9.scanOcclusionIndices(state._colorBuffer, sw, sh, stride, transparentMaxIdx, minSampleCount);
|
|
116841
116845
|
case 11:
|
|
116842
|
-
tScanResult =
|
|
116846
|
+
tScanResult = _context2.v;
|
|
116843
116847
|
if (tScanResult && tScanResult.buffer) {
|
|
116844
116848
|
state._colorBuffer = new Uint8Array(tScanResult.buffer);
|
|
116845
116849
|
}
|
|
@@ -116851,19 +116855,19 @@ var isDebug = false || false === true;
|
|
|
116851
116855
|
}
|
|
116852
116856
|
}
|
|
116853
116857
|
case 12:
|
|
116854
|
-
|
|
116855
|
-
|
|
116856
|
-
|
|
116857
|
-
|
|
116858
|
+
_this9.renderer.setRenderTarget(prevTarget);
|
|
116859
|
+
_this9.renderer.setClearColor(prevClearColorHex, prevClearAlpha);
|
|
116860
|
+
_this9.renderer.toneMapping = prevToneMapping;
|
|
116861
|
+
_context2.n = 14;
|
|
116858
116862
|
break;
|
|
116859
116863
|
case 13:
|
|
116860
|
-
|
|
116861
|
-
_t =
|
|
116864
|
+
_context2.p = 13;
|
|
116865
|
+
_t = _context2.v;
|
|
116862
116866
|
for (_i1 = 0; _i1 < candidates.length; _i1++) {
|
|
116863
116867
|
visibleIdSet.add(candidates[_i1].modelId);
|
|
116864
116868
|
}
|
|
116865
116869
|
case 14:
|
|
116866
|
-
|
|
116870
|
+
_context2.n = 16;
|
|
116867
116871
|
break;
|
|
116868
116872
|
case 15:
|
|
116869
116873
|
for (_i10 = 0; _i10 < candidates.length; _i10++) {
|
|
@@ -116876,7 +116880,7 @@ var isDebug = false || false === true;
|
|
|
116876
116880
|
});
|
|
116877
116881
|
toLoadSet = new Set(visibleIdSet);
|
|
116878
116882
|
parentsToCheck = new Set();
|
|
116879
|
-
|
|
116883
|
+
_this9.scene.traverse(function (child) {
|
|
116880
116884
|
if (!child.isInstancedMesh) return;
|
|
116881
116885
|
// 如果复用数量等于大于2个,则跳过裁剪和剔除处理(始终保留)
|
|
116882
116886
|
if (child.count >= 2) {
|
|
@@ -116890,7 +116894,7 @@ var isDebug = false || false === true;
|
|
|
116890
116894
|
var _modelId = _modelIds2[_i11];
|
|
116891
116895
|
// 检查已取消勾选模型进行卸载
|
|
116892
116896
|
var documentId = _modelId.split(':')[1];
|
|
116893
|
-
if (!
|
|
116897
|
+
if (!_this9.noObserver.documentModelIds.get(documentId)) {
|
|
116894
116898
|
toUnload.push({
|
|
116895
116899
|
modelId: _modelId,
|
|
116896
116900
|
child: child
|
|
@@ -116900,7 +116904,7 @@ var isDebug = false || false === true;
|
|
|
116900
116904
|
if (bypassList && bypassList.size > 0 && bypassList.has(_modelId)) return;
|
|
116901
116905
|
var instanceInfo = instancesMap.get(_modelId);
|
|
116902
116906
|
var instanceIndex = instanceInfo && typeof instanceInfo.instanceIndex === 'number' ? instanceInfo.instanceIndex : null;
|
|
116903
|
-
var _inFrustum =
|
|
116907
|
+
var _inFrustum = _this9.isModelInFrustum(child, instanceIndex, globalFrustum);
|
|
116904
116908
|
var _modelInVisible = toLoadSet.has(_modelId);
|
|
116905
116909
|
// console.log('modelId', modelId, 'inFrustum', inFrustum, 'modelInVisible', modelInVisible)
|
|
116906
116910
|
|
|
@@ -116919,7 +116923,7 @@ var isDebug = false || false === true;
|
|
|
116919
116923
|
}
|
|
116920
116924
|
|
|
116921
116925
|
// 仅当所有实例都不活跃时,才执行卸载
|
|
116922
|
-
if (!firstPerSign && !roaming && allInactive) {
|
|
116926
|
+
if (!_this9.firstPerSign && !_this9.roaming && allInactive) {
|
|
116923
116927
|
toUnload.push({
|
|
116924
116928
|
modelId: _modelId2,
|
|
116925
116929
|
child: child
|
|
@@ -116934,12 +116938,12 @@ var isDebug = false || false === true;
|
|
|
116934
116938
|
}
|
|
116935
116939
|
var modelId = child.parent && child.parent.userData && child.parent.userData.instanceId ? child.parent.userData.instanceId : child.uuid;
|
|
116936
116940
|
if (bypassList && bypassList.size > 0 && bypassList.has(modelId)) return;
|
|
116937
|
-
var inFrustum =
|
|
116941
|
+
var inFrustum = _this9.isModelInFrustum(child, null, globalFrustum);
|
|
116938
116942
|
var modelInVisible = toLoadSet.has(modelId);
|
|
116939
116943
|
if (modelInVisible) {
|
|
116940
116944
|
toLoadSet.delete(modelId);
|
|
116941
116945
|
}
|
|
116942
|
-
if (!firstPerSign && !roaming && (!inFrustum || !modelInVisible)) {
|
|
116946
|
+
if (!_this9.firstPerSign && !_this9.roaming && (!inFrustum || !modelInVisible)) {
|
|
116943
116947
|
toUnload.push({
|
|
116944
116948
|
modelId: modelId,
|
|
116945
116949
|
child: child
|
|
@@ -116949,26 +116953,26 @@ var isDebug = false || false === true;
|
|
|
116949
116953
|
for (_i13 = 0, _toUnload = toUnload; _i13 < _toUnload.length; _i13++) {
|
|
116950
116954
|
_toUnload$_i = _toUnload[_i13], modelId = _toUnload$_i.modelId, child = _toUnload$_i.child;
|
|
116951
116955
|
if (child && child.parent) parentsToCheck.add(child.parent);
|
|
116952
|
-
|
|
116956
|
+
_this9.unloadInstancedModel(modelId, child);
|
|
116953
116957
|
}
|
|
116954
|
-
if (
|
|
116958
|
+
if (_this9.scene) {
|
|
116955
116959
|
parentsToCheck.forEach(function (group) {
|
|
116956
116960
|
if (group && group.children && group.children.length === 0) {
|
|
116957
116961
|
group.removeFromParent();
|
|
116958
116962
|
}
|
|
116959
116963
|
});
|
|
116960
116964
|
}
|
|
116961
|
-
|
|
116965
|
+
_this9.modelStateManager.isloadedModelsIds = Object.freeze(Array.from(toLoadSet));
|
|
116962
116966
|
case 17:
|
|
116963
|
-
return
|
|
116967
|
+
return _context2.a(2);
|
|
116964
116968
|
}
|
|
116965
|
-
},
|
|
116969
|
+
}, _callee2, null, [[9, 13]]);
|
|
116966
116970
|
}))();
|
|
116967
116971
|
},
|
|
116968
116972
|
isBoxInFrustum: function isBoxInFrustum(box) {
|
|
116969
|
-
if (!
|
|
116973
|
+
if (!this.camera) return true;
|
|
116970
116974
|
var frustum = new this.THREE.Frustum();
|
|
116971
|
-
var vpMatrix = new this.THREE.Matrix4().multiplyMatrices(
|
|
116975
|
+
var vpMatrix = new this.THREE.Matrix4().multiplyMatrices(this.camera.projectionMatrix, this.camera.matrixWorldInverse);
|
|
116972
116976
|
frustum.setFromProjectionMatrix(vpMatrix);
|
|
116973
116977
|
return frustum.intersectsBox(box);
|
|
116974
116978
|
},
|
|
@@ -116985,8 +116989,8 @@ var isDebug = false || false === true;
|
|
|
116985
116989
|
|
|
116986
116990
|
// 卸载前内存快照
|
|
116987
116991
|
// this.logRendererMemory(`before unload modelId=${modelId}`);
|
|
116988
|
-
var
|
|
116989
|
-
instanceIndex =
|
|
116992
|
+
var _ref = instancedMesh.userData.instancesMap.get(modelId) || 0,
|
|
116993
|
+
instanceIndex = _ref.instanceIndex;
|
|
116990
116994
|
// const instanceIndex = instancedMesh.userData.instanceIndex || 0;
|
|
116991
116995
|
|
|
116992
116996
|
this.removeOutlineInstanceProxy(instancedMesh, instanceIndex);
|
|
@@ -117056,6 +117060,7 @@ var isDebug = false || false === true;
|
|
|
117056
117060
|
*/
|
|
117057
117061
|
init: function init() {
|
|
117058
117062
|
var config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
117063
|
+
console.log('init');
|
|
117059
117064
|
this.initStreamLoader(config.modelApi, config);
|
|
117060
117065
|
},
|
|
117061
117066
|
/**
|
|
@@ -117065,33 +117070,33 @@ var isDebug = false || false === true;
|
|
|
117065
117070
|
* @param {string} [config.projectId] - 项目ID
|
|
117066
117071
|
*/
|
|
117067
117072
|
initStreamLoader: function initStreamLoader(modelApi) {
|
|
117068
|
-
var
|
|
117073
|
+
var _this0 = this;
|
|
117069
117074
|
var config = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
117070
|
-
var
|
|
117071
|
-
projectId =
|
|
117072
|
-
restConfig = _objectWithoutProperties(
|
|
117075
|
+
var _ref2 = config || {},
|
|
117076
|
+
projectId = _ref2.projectId,
|
|
117077
|
+
restConfig = _objectWithoutProperties(_ref2, _excluded);
|
|
117073
117078
|
var streamLoader = new StreamLoader_StreamLoader(com_graphicsvue_type_script_lang_js_objectSpread({
|
|
117074
117079
|
modelApi: modelApi,
|
|
117075
117080
|
projectId: projectId,
|
|
117076
117081
|
debug: isDebug,
|
|
117077
117082
|
renderModelData: this.renderModelData.bind(this),
|
|
117078
117083
|
ensureNotInteracting: function () {
|
|
117079
|
-
var _ensureNotInteracting = com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function
|
|
117080
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (
|
|
117081
|
-
while (1) switch (
|
|
117084
|
+
var _ensureNotInteracting = com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee3(abortSignal) {
|
|
117085
|
+
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context3) {
|
|
117086
|
+
while (1) switch (_context3.n) {
|
|
117082
117087
|
case 0:
|
|
117083
|
-
if (!(userInteracting ||
|
|
117084
|
-
|
|
117088
|
+
if (!(_this0.userInteracting || _this0.noObserver.batchLoadingState.interactionState.isInteracting)) {
|
|
117089
|
+
_context3.n = 1;
|
|
117085
117090
|
break;
|
|
117086
117091
|
}
|
|
117087
|
-
|
|
117092
|
+
_context3.n = 1;
|
|
117088
117093
|
return new Promise(function (resolve) {
|
|
117089
117094
|
return setTimeout(resolve, 0);
|
|
117090
117095
|
});
|
|
117091
117096
|
case 1:
|
|
117092
|
-
return
|
|
117097
|
+
return _context3.a(2);
|
|
117093
117098
|
}
|
|
117094
|
-
},
|
|
117099
|
+
}, _callee3);
|
|
117095
117100
|
}));
|
|
117096
117101
|
function ensureNotInteracting(_x) {
|
|
117097
117102
|
return _ensureNotInteracting.apply(this, arguments);
|
|
@@ -117100,22 +117105,22 @@ var isDebug = false || false === true;
|
|
|
117100
117105
|
}(),
|
|
117101
117106
|
batchSize: this.noObserver.batchLoadingState.batchSize,
|
|
117102
117107
|
onCancelRequestId: function () {
|
|
117103
|
-
var _onCancelRequestId = com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function
|
|
117104
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (
|
|
117105
|
-
while (1) switch (
|
|
117108
|
+
var _onCancelRequestId = com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee4(requestId) {
|
|
117109
|
+
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context4) {
|
|
117110
|
+
while (1) switch (_context4.n) {
|
|
117106
117111
|
case 0:
|
|
117107
117112
|
if (!(modelApi && typeof modelApi.postCanceledRequest === 'function')) {
|
|
117108
|
-
|
|
117113
|
+
_context4.n = 2;
|
|
117109
117114
|
break;
|
|
117110
117115
|
}
|
|
117111
|
-
|
|
117116
|
+
_context4.n = 1;
|
|
117112
117117
|
return modelApi.postCanceledRequest(requestId);
|
|
117113
117118
|
case 1:
|
|
117114
|
-
return
|
|
117119
|
+
return _context4.a(2, _context4.v);
|
|
117115
117120
|
case 2:
|
|
117116
|
-
return
|
|
117121
|
+
return _context4.a(2, null);
|
|
117117
117122
|
}
|
|
117118
|
-
},
|
|
117123
|
+
}, _callee4);
|
|
117119
117124
|
}));
|
|
117120
117125
|
function onCancelRequestId(_x2) {
|
|
117121
117126
|
return _onCancelRequestId.apply(this, arguments);
|
|
@@ -117130,9 +117135,9 @@ var isDebug = false || false === true;
|
|
|
117130
117135
|
this.noObserver.occlusionWorkerRequestMap = new Map();
|
|
117131
117136
|
streamLoader.worker.addEventListener('message', function (e) {
|
|
117132
117137
|
var payload = e.data || {};
|
|
117133
|
-
var pending =
|
|
117138
|
+
var pending = _this0.noObserver.occlusionWorkerRequestMap.get(payload.id);
|
|
117134
117139
|
if (!pending) return;
|
|
117135
|
-
|
|
117140
|
+
_this0.noObserver.occlusionWorkerRequestMap.delete(payload.id);
|
|
117136
117141
|
pending.resolve(payload);
|
|
117137
117142
|
});
|
|
117138
117143
|
}
|
|
@@ -117143,13 +117148,13 @@ var isDebug = false || false === true;
|
|
|
117143
117148
|
* @param {Object} materialData - 材质数据
|
|
117144
117149
|
*/
|
|
117145
117150
|
setStreamModel: function setStreamModel(item, materialData) {
|
|
117146
|
-
var
|
|
117151
|
+
var _this1 = this;
|
|
117147
117152
|
if (this.noObserver.streamLoader) {
|
|
117148
117153
|
this.noObserver.streamLoader.setCurrentModel(item, materialData);
|
|
117149
117154
|
// 设置完模型后,尝试触发一次范围加载以渲染初始视图
|
|
117150
117155
|
// 使用 setTimeout 确保在下一帧执行,避免当前栈还在初始化中
|
|
117151
117156
|
setTimeout(function () {
|
|
117152
|
-
|
|
117157
|
+
_this1.getRangeStream();
|
|
117153
117158
|
}, 0);
|
|
117154
117159
|
} else {}
|
|
117155
117160
|
},
|
|
@@ -117157,48 +117162,48 @@ var isDebug = false || false === true;
|
|
|
117157
117162
|
* 批量加载区域(供外部调用)
|
|
117158
117163
|
*/
|
|
117159
117164
|
batchLoadRegions: function batchLoadRegions(item, divideData, materialData) {
|
|
117160
|
-
var
|
|
117161
|
-
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function
|
|
117162
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (
|
|
117163
|
-
while (1) switch (
|
|
117165
|
+
var _this10 = this;
|
|
117166
|
+
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee5() {
|
|
117167
|
+
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context5) {
|
|
117168
|
+
while (1) switch (_context5.n) {
|
|
117164
117169
|
case 0:
|
|
117165
|
-
if (!
|
|
117166
|
-
|
|
117170
|
+
if (!_this10.noObserver.streamLoader) {
|
|
117171
|
+
_context5.n = 1;
|
|
117167
117172
|
break;
|
|
117168
117173
|
}
|
|
117169
|
-
|
|
117170
|
-
return
|
|
117174
|
+
_context5.n = 1;
|
|
117175
|
+
return _this10.noObserver.streamLoader.batchLoadRegions(item, divideData, materialData);
|
|
117171
117176
|
case 1:
|
|
117172
|
-
return
|
|
117177
|
+
return _context5.a(2);
|
|
117173
117178
|
}
|
|
117174
|
-
},
|
|
117179
|
+
}, _callee5);
|
|
117175
117180
|
}))();
|
|
117176
117181
|
},
|
|
117177
117182
|
/**
|
|
117178
117183
|
* 获取批量加载详情(供外部调用)
|
|
117179
117184
|
*/
|
|
117180
117185
|
loadModelByIds: function loadModelByIds(options) {
|
|
117181
|
-
var
|
|
117182
|
-
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function
|
|
117183
|
-
var
|
|
117184
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (
|
|
117185
|
-
while (1) switch (
|
|
117186
|
+
var _this11 = this;
|
|
117187
|
+
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee6() {
|
|
117188
|
+
var _ref3, ids;
|
|
117189
|
+
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context6) {
|
|
117190
|
+
while (1) switch (_context6.n) {
|
|
117186
117191
|
case 0:
|
|
117187
117192
|
// 绕过剔除模型
|
|
117188
|
-
|
|
117189
|
-
|
|
117190
|
-
if (!
|
|
117191
|
-
|
|
117193
|
+
_ref3 = options.params || {}, ids = _ref3.ids;
|
|
117194
|
+
_this11.addBypassCullingModelIds(ids);
|
|
117195
|
+
if (!_this11.noObserver.streamLoader) {
|
|
117196
|
+
_context6.n = 2;
|
|
117192
117197
|
break;
|
|
117193
117198
|
}
|
|
117194
|
-
|
|
117195
|
-
return
|
|
117199
|
+
_context6.n = 1;
|
|
117200
|
+
return _this11.noObserver.streamLoader.loadModelByIds(options);
|
|
117196
117201
|
case 1:
|
|
117197
|
-
return
|
|
117202
|
+
return _context6.a(2, _context6.v);
|
|
117198
117203
|
case 2:
|
|
117199
|
-
return
|
|
117204
|
+
return _context6.a(2, null);
|
|
117200
117205
|
}
|
|
117201
|
-
},
|
|
117206
|
+
}, _callee6);
|
|
117202
117207
|
}))();
|
|
117203
117208
|
},
|
|
117204
117209
|
/**
|
|
@@ -117206,35 +117211,35 @@ var isDebug = false || false === true;
|
|
|
117206
117211
|
*/
|
|
117207
117212
|
processModelItem: function processModelItem(item) {
|
|
117208
117213
|
var _arguments = arguments,
|
|
117209
|
-
|
|
117210
|
-
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function
|
|
117214
|
+
_this12 = this;
|
|
117215
|
+
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee7() {
|
|
117211
117216
|
var _options$onComplete;
|
|
117212
117217
|
var options, res;
|
|
117213
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (
|
|
117214
|
-
while (1) switch (
|
|
117218
|
+
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context7) {
|
|
117219
|
+
while (1) switch (_context7.n) {
|
|
117215
117220
|
case 0:
|
|
117216
117221
|
options = _arguments.length > 1 && _arguments[1] !== undefined ? _arguments[1] : {};
|
|
117217
|
-
|
|
117218
|
-
return
|
|
117222
|
+
_context7.n = 1;
|
|
117223
|
+
return _this12.noObserver.streamLoader.processModelItem(item, options);
|
|
117219
117224
|
case 1:
|
|
117220
|
-
res =
|
|
117225
|
+
res = _context7.v;
|
|
117221
117226
|
// item.id is the documentId
|
|
117222
117227
|
if (item && item.id) {
|
|
117223
117228
|
if (res && res.sceneBox) {
|
|
117224
|
-
|
|
117229
|
+
_this12.setSceneBox(res.sceneBox, item.id, true);
|
|
117225
117230
|
}
|
|
117226
117231
|
if (res && res.boxIndex) {
|
|
117227
|
-
|
|
117232
|
+
_this12.setBoxIndex(res.boxIndex, item.id, true);
|
|
117228
117233
|
}
|
|
117229
|
-
|
|
117234
|
+
_this12.tryInitialCenterAfterBoundsReady();
|
|
117230
117235
|
// this.setBoxIndex(boxJson.data, item.id, true);
|
|
117231
117236
|
}
|
|
117232
117237
|
(_options$onComplete = options.onComplete) === null || _options$onComplete === void 0 || _options$onComplete.call(options);
|
|
117233
|
-
|
|
117238
|
+
_this12.notifyCameraChange(); // 触发场景更新
|
|
117234
117239
|
case 2:
|
|
117235
|
-
return
|
|
117240
|
+
return _context7.a(2);
|
|
117236
117241
|
}
|
|
117237
|
-
},
|
|
117242
|
+
}, _callee7);
|
|
117238
117243
|
}))();
|
|
117239
117244
|
},
|
|
117240
117245
|
/**
|
|
@@ -117254,17 +117259,17 @@ var isDebug = false || false === true;
|
|
|
117254
117259
|
* 同步获取当前WebGL画面的截图数据,解决preserveDrawingBuffer为false时html2canvas截黑屏的问题
|
|
117255
117260
|
*/
|
|
117256
117261
|
getScreenshotDataURL: function getScreenshotDataURL() {
|
|
117257
|
-
if (!
|
|
117262
|
+
if (!this.renderer || !this.scene || !this.camera) return null;
|
|
117258
117263
|
|
|
117259
117264
|
// 强制渲染一帧
|
|
117260
|
-
if (outlineComposer) {
|
|
117261
|
-
outlineComposer.render();
|
|
117265
|
+
if (this.outlineComposer) {
|
|
117266
|
+
this.outlineComposer.render();
|
|
117262
117267
|
} else {
|
|
117263
|
-
|
|
117268
|
+
this.renderer.render(this.scene, this.camera);
|
|
117264
117269
|
}
|
|
117265
117270
|
|
|
117266
117271
|
// 立即同步提取像素数据
|
|
117267
|
-
return
|
|
117272
|
+
return this.renderer.domElement.toDataURL('image/png', 1.0);
|
|
117268
117273
|
},
|
|
117269
117274
|
/**
|
|
117270
117275
|
* 内部渲染流式数据方法
|
|
@@ -117335,7 +117340,7 @@ var isDebug = false || false === true;
|
|
|
117335
117340
|
},
|
|
117336
117341
|
computeFrustumAABB: function computeFrustumAABB() {
|
|
117337
117342
|
// 确保相机矩阵最新
|
|
117338
|
-
|
|
117343
|
+
this.camera.updateMatrixWorld(true);
|
|
117339
117344
|
|
|
117340
117345
|
// NDC 八个角
|
|
117341
117346
|
var ndcCorners = {
|
|
@@ -117357,8 +117362,8 @@ var isDebug = false || false === true;
|
|
|
117357
117362
|
};
|
|
117358
117363
|
for (var key in ndcCorners) {
|
|
117359
117364
|
var v = com_graphicsvue_type_script_lang_js_construct(this.THREE.Vector3, com_graphicsvue_type_script_lang_js_toConsumableArray(ndcCorners[key]));
|
|
117360
|
-
v.unproject(
|
|
117361
|
-
v.applyMatrix4(threeToBizMatrix); // world → biz
|
|
117365
|
+
v.unproject(this.camera); // NDC → world
|
|
117366
|
+
v.applyMatrix4(this.threeToBizMatrix); // world → biz
|
|
117362
117367
|
ndcCorners[key] = v;
|
|
117363
117368
|
}
|
|
117364
117369
|
|
|
@@ -117393,76 +117398,77 @@ var isDebug = false || false === true;
|
|
|
117393
117398
|
};
|
|
117394
117399
|
},
|
|
117395
117400
|
initRender: function initRender() {
|
|
117396
|
-
|
|
117401
|
+
this.renderer = new this.THREE.WebGLRenderer({
|
|
117397
117402
|
antialias: true,
|
|
117398
117403
|
alpha: true,
|
|
117399
117404
|
logarithmicDepthBuffer: true,
|
|
117400
117405
|
powerPreference: 'high-performance',
|
|
117401
117406
|
preserveDrawingBuffer: false //保留图形缓冲区 TODO 临时截图使用
|
|
117402
117407
|
});
|
|
117403
|
-
|
|
117404
|
-
|
|
117405
|
-
|
|
117406
|
-
var rect = instructions.getBoundingClientRect();
|
|
117407
|
-
|
|
117408
|
-
|
|
117409
|
-
|
|
117410
|
-
|
|
117411
|
-
instructions.appendChild(
|
|
117412
|
-
|
|
117408
|
+
this.renderer.debug.checkShaderErrors = false;
|
|
117409
|
+
this.renderer.info.autoReset = false;
|
|
117410
|
+
this.renderer.setPixelRatio(window.devicePixelRatio);
|
|
117411
|
+
var rect = this.instructions.getBoundingClientRect();
|
|
117412
|
+
this.renderer.setSize(rect.width, rect.height);
|
|
117413
|
+
this.renderer.domElement.id = 'three-model-' + this.containId;
|
|
117414
|
+
this.renderer.shadowMap.enabled = true;
|
|
117415
|
+
this.renderer.outputEncoding = this.THREE.sRGBEncoding;
|
|
117416
|
+
this.instructions.appendChild(this.renderer.domElement);
|
|
117417
|
+
this.renderer.setClearAlpha(0);
|
|
117413
117418
|
|
|
117414
117419
|
// 监听体系已重构至 initCameraChangeObserver,此处仅保留必要的初始化
|
|
117415
117420
|
// 原始的 wheel 监听逻辑已迁移
|
|
117416
|
-
// renderer.domElement.addEventListener('wheel', this._wheelHandler);
|
|
117421
|
+
// this.renderer.domElement.addEventListener('wheel', this._wheelHandler);
|
|
117417
117422
|
|
|
117418
117423
|
// 与校审截图功能冲突,暂时先注释掉
|
|
117419
117424
|
// -----------
|
|
117420
|
-
// renderer.autoClear = false;
|
|
117421
|
-
// renderer.autoClearColor = false;
|
|
117422
|
-
// renderer.autoClearDepth = false;
|
|
117423
|
-
// renderer.autoClearStencil = false;
|
|
117425
|
+
// this.renderer.autoClear = false;
|
|
117426
|
+
// this.renderer.autoClearColor = false;
|
|
117427
|
+
// this.renderer.autoClearDepth = false;
|
|
117428
|
+
// this.renderer.autoClearStencil = false;
|
|
117424
117429
|
// -----------
|
|
117425
117430
|
},
|
|
117426
117431
|
initPostProcessing: function initPostProcessing() {
|
|
117427
|
-
outlineComposer = new EffectComposer_EffectComposer(
|
|
117428
|
-
var renderPass = new RenderPass_RenderPass(
|
|
117429
|
-
outlineComposer.addPass(renderPass);
|
|
117430
|
-
var rect = instructions.getBoundingClientRect();
|
|
117431
|
-
outlinePass = new OutlinePass_OutlinePass(new this.THREE.Vector2(rect.width, rect.height),
|
|
117432
|
-
outlinePass.edgeStrength = 3;
|
|
117433
|
-
outlinePass.edgeGlow = 0.5; // 边缘模糊度
|
|
117434
|
-
outlinePass.edgeThickness = 2; // 轮廓线宽度
|
|
117435
|
-
outlinePass.visibleEdgeColor.set('#ffffff'); // 默认白色,后续可动态调整
|
|
117436
|
-
outlinePass.hiddenEdgeColor.set('#ffffff');
|
|
117437
|
-
outlineComposer.addPass(outlinePass);
|
|
117432
|
+
this.outlineComposer = new EffectComposer_EffectComposer(this.renderer, this.renderTarget);
|
|
117433
|
+
var renderPass = new RenderPass_RenderPass(this.scene, this.camera);
|
|
117434
|
+
this.outlineComposer.addPass(renderPass);
|
|
117435
|
+
var rect = this.instructions.getBoundingClientRect();
|
|
117436
|
+
this.outlinePass = new OutlinePass_OutlinePass(new this.THREE.Vector2(rect.width, rect.height), this.scene, this.camera);
|
|
117437
|
+
this.outlinePass.edgeStrength = 3;
|
|
117438
|
+
this.outlinePass.edgeGlow = 0.5; // 边缘模糊度
|
|
117439
|
+
this.outlinePass.edgeThickness = 2; // 轮廓线宽度
|
|
117440
|
+
this.outlinePass.visibleEdgeColor.set('#ffffff'); // 默认白色,后续可动态调整
|
|
117441
|
+
this.outlinePass.hiddenEdgeColor.set('#ffffff');
|
|
117442
|
+
this.outlineComposer.addPass(this.outlinePass);
|
|
117438
117443
|
var outputPass = new OutputPass_OutputPass();
|
|
117439
|
-
outlineComposer.addPass(outputPass);
|
|
117444
|
+
this.outlineComposer.addPass(outputPass);
|
|
117440
117445
|
},
|
|
117441
117446
|
initScene: function initScene() {
|
|
117442
|
-
modelGroup = new this.THREE.Group();
|
|
117443
|
-
|
|
117447
|
+
this.modelGroup = new this.THREE.Group();
|
|
117448
|
+
this.scene = new this.THREE.Scene();
|
|
117444
117449
|
if (isDebug) {
|
|
117445
|
-
stats = new stats_module();
|
|
117446
|
-
document.body.appendChild(stats.dom);
|
|
117450
|
+
this.stats = new stats_module();
|
|
117451
|
+
document.body.appendChild(this.stats.dom);
|
|
117447
117452
|
}
|
|
117448
117453
|
},
|
|
117449
117454
|
initCamera: function initCamera() {
|
|
117450
|
-
var rect = instructions.getBoundingClientRect();
|
|
117451
|
-
|
|
117455
|
+
var rect = this.instructions.getBoundingClientRect();
|
|
117456
|
+
this.camera = new this.THREE.PerspectiveCamera(45, rect.width / rect.height, 0.1, 1000000);
|
|
117452
117457
|
// camera.position.set(0, 100, 150);
|
|
117458
|
+
// this.camera.position.set(0, 100, 150);
|
|
117453
117459
|
},
|
|
117454
117460
|
initControl: function initControl() {
|
|
117455
117461
|
// 初始化控件
|
|
117456
|
-
cameraControls = new CameraControls(
|
|
117457
|
-
cameraControls.dollyToCursor = true;
|
|
117458
|
-
cameraControls.smoothTime = 0.1;
|
|
117459
|
-
cameraControls.draggingSmoothTime = 0.05;
|
|
117460
|
-
cameraControls.truckSpeed = 2.0;
|
|
117461
|
-
cameraControls.infinityDolly = true;
|
|
117462
|
-
cameraControls.minDistance = 10;
|
|
117462
|
+
this.cameraControls = new CameraControls(this.camera, this.renderer.domElement);
|
|
117463
|
+
this.cameraControls.dollyToCursor = true;
|
|
117464
|
+
this.cameraControls.smoothTime = 0.1;
|
|
117465
|
+
this.cameraControls.draggingSmoothTime = 0.05;
|
|
117466
|
+
this.cameraControls.truckSpeed = 2.0;
|
|
117467
|
+
this.cameraControls.infinityDolly = true;
|
|
117468
|
+
this.cameraControls.minDistance = 10;
|
|
117463
117469
|
// 若已存在场景包围盒,初始化时设置最大dolly距离为其对角线长度
|
|
117464
117470
|
|
|
117465
|
-
cameraControls.dollySpeed = 0.15; // 鼠标滚轮每次移动速度倍率
|
|
117471
|
+
this.cameraControls.dollySpeed = 0.15; // 鼠标滚轮每次移动速度倍率
|
|
117466
117472
|
},
|
|
117467
117473
|
setCameraObserverEnabled: function setCameraObserverEnabled(enabled) {
|
|
117468
117474
|
this.noObserver.isObserverEnabled = enabled;
|
|
@@ -117472,46 +117478,46 @@ var isDebug = false || false === true;
|
|
|
117472
117478
|
* 统一监听:用户交互(Wheel/Control)、程序化动画、API调用
|
|
117473
117479
|
*/
|
|
117474
117480
|
initCameraChangeObserver: function initCameraChangeObserver() {
|
|
117475
|
-
var
|
|
117481
|
+
var _this13 = this;
|
|
117476
117482
|
// 初始化 control 状态标志
|
|
117477
117483
|
this.noObserver.isControlActive = false;
|
|
117478
|
-
|
|
117484
|
+
var _this = this;
|
|
117479
117485
|
// 1. 创建统一的响应触发器 (Debounced)
|
|
117480
117486
|
this._cameraChangeObserver = this.debounce(/*#__PURE__*/function () {
|
|
117481
|
-
var
|
|
117482
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (
|
|
117483
|
-
while (1) switch (
|
|
117487
|
+
var _ref4 = com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee8(source) {
|
|
117488
|
+
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context8) {
|
|
117489
|
+
while (1) switch (_context8.n) {
|
|
117484
117490
|
case 0:
|
|
117485
|
-
if (
|
|
117486
|
-
|
|
117491
|
+
if (_this13.noObserver.isObserverEnabled) {
|
|
117492
|
+
_context8.n = 1;
|
|
117487
117493
|
break;
|
|
117488
117494
|
}
|
|
117489
|
-
return
|
|
117495
|
+
return _context8.a(2);
|
|
117490
117496
|
case 1:
|
|
117491
|
-
if (!(source === 'rest' &&
|
|
117492
|
-
|
|
117497
|
+
if (!(source === 'rest' && _this13.noObserver.isControlActive)) {
|
|
117498
|
+
_context8.n = 2;
|
|
117493
117499
|
break;
|
|
117494
117500
|
}
|
|
117495
|
-
return
|
|
117501
|
+
return _context8.a(2);
|
|
117496
117502
|
case 2:
|
|
117497
|
-
if (!
|
|
117498
|
-
|
|
117503
|
+
if (!_this13.modelStateManager.frustumCheckEnabled) {
|
|
117504
|
+
_context8.n = 3;
|
|
117499
117505
|
break;
|
|
117500
117506
|
}
|
|
117501
|
-
|
|
117502
|
-
return
|
|
117507
|
+
_context8.n = 3;
|
|
117508
|
+
return _this13.performFrustumCulling();
|
|
117503
117509
|
case 3:
|
|
117504
117510
|
// 执行流式加载请求
|
|
117505
|
-
if (
|
|
117506
|
-
|
|
117511
|
+
if (_this13.modelStateManager.isloadedModelsIds && _this13.modelStateManager.isloadedModelsIds.length > 0) {
|
|
117512
|
+
_this13.getRangeStream(false);
|
|
117507
117513
|
}
|
|
117508
117514
|
case 4:
|
|
117509
|
-
return
|
|
117515
|
+
return _context8.a(2);
|
|
117510
117516
|
}
|
|
117511
|
-
},
|
|
117517
|
+
}, _callee8);
|
|
117512
117518
|
}));
|
|
117513
117519
|
return function (_x3) {
|
|
117514
|
-
return
|
|
117520
|
+
return _ref4.apply(this, arguments);
|
|
117515
117521
|
};
|
|
117516
117522
|
}(), function (source) {
|
|
117517
117523
|
// 漫游模式下,或者第一人称移动时,使用节流策略(每300ms触发一次)
|
|
@@ -117528,18 +117534,18 @@ var isDebug = false || false === true;
|
|
|
117528
117534
|
// 2. 公开API:允许外部或业务逻辑手动触发更新
|
|
117529
117535
|
this.notifyCameraChange = function () {
|
|
117530
117536
|
var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'api';
|
|
117531
|
-
|
|
117537
|
+
_this13._cameraChangeObserver(source);
|
|
117532
117538
|
};
|
|
117533
117539
|
|
|
117534
117540
|
// 3. 监听器 - Wheel (用户滚轮)
|
|
117535
117541
|
this._wheelHandler = function (res) {
|
|
117536
|
-
|
|
117542
|
+
_this13.$emit('wheelStart', res);
|
|
117537
117543
|
|
|
117538
117544
|
// 统一交互开始处理
|
|
117539
|
-
|
|
117545
|
+
_this13.beginInteraction('wheel');
|
|
117540
117546
|
|
|
117541
117547
|
// 设置滚轮交互的结束检测
|
|
117542
|
-
|
|
117548
|
+
_this13.scheduleWheelInteractionEnd(res, 100);
|
|
117543
117549
|
|
|
117544
117550
|
// 滚轮逻辑:infinityDolly 与 maxDollyDistance 控制
|
|
117545
117551
|
var event = res;
|
|
@@ -117548,17 +117554,17 @@ var isDebug = false || false === true;
|
|
|
117548
117554
|
var isZoomIn = deltaY < 0; // 靠近
|
|
117549
117555
|
|
|
117550
117556
|
// if (isZoomOut) {
|
|
117551
|
-
// cameraControls.infinityDolly = false; // 向外遵守 maxDistance
|
|
117557
|
+
// this.cameraControls.infinityDolly = false; // 向外遵守 maxDistance
|
|
117552
117558
|
// } else if (isZoomIn) {
|
|
117553
|
-
// cameraControls.infinityDolly = true; // 向前允许推进(超越 minDistance)
|
|
117559
|
+
// this.cameraControls.infinityDolly = true; // 向前允许推进(超越 minDistance)
|
|
117554
117560
|
// }
|
|
117555
117561
|
|
|
117556
117562
|
// dolly最大距离限制
|
|
117557
117563
|
try {
|
|
117558
|
-
if (sceneBoundingBox && isFinite(maxDollyDistance)) {
|
|
117564
|
+
if (_this13.sceneBoundingBox && isFinite(maxDollyDistance)) {
|
|
117559
117565
|
if (isZoomOut) {
|
|
117560
|
-
|
|
117561
|
-
var currentDistance =
|
|
117566
|
+
_this13.camera.updateMatrixWorld(true);
|
|
117567
|
+
var currentDistance = _this13.camera.position.distanceTo(_this13.cameraControls._target);
|
|
117562
117568
|
if (currentDistance >= maxDollyDistance) {
|
|
117563
117569
|
event.preventDefault && event.preventDefault();
|
|
117564
117570
|
event.stopImmediatePropagation && event.stopImmediatePropagation();
|
|
@@ -117571,88 +117577,88 @@ var isDebug = false || false === true;
|
|
|
117571
117577
|
}
|
|
117572
117578
|
|
|
117573
117579
|
// 触发观察者
|
|
117574
|
-
|
|
117580
|
+
_this13._cameraChangeObserver('wheel');
|
|
117575
117581
|
};
|
|
117576
|
-
|
|
117582
|
+
this.renderer.domElement.addEventListener('wheel', this._wheelHandler);
|
|
117577
117583
|
|
|
117578
117584
|
// 4. 监听器 - Controls (用户拖拽/操作)
|
|
117579
117585
|
this._onControlStart = function (res) {
|
|
117580
|
-
|
|
117586
|
+
_this13.noObserver.isControlActive = true;
|
|
117581
117587
|
|
|
117582
117588
|
// 统一交互开始处理(相机)
|
|
117583
|
-
|
|
117584
|
-
|
|
117589
|
+
_this13.beginInteraction('this.camera');
|
|
117590
|
+
_this13.$emit('controlStart', res);
|
|
117585
117591
|
|
|
117586
117592
|
// 记录鼠标按下时的位置
|
|
117587
117593
|
var event = res.originalEvent || window.event;
|
|
117588
117594
|
if (event) {
|
|
117589
|
-
mouseDownPosition.x = event.clientX || 0;
|
|
117590
|
-
mouseDownPosition.y = event.clientY || 0;
|
|
117591
|
-
isDragging = false;
|
|
117595
|
+
_this.mouseDownPosition.x = event.clientX || 0;
|
|
117596
|
+
_this.mouseDownPosition.y = event.clientY || 0;
|
|
117597
|
+
_this.isDragging = false;
|
|
117592
117598
|
}
|
|
117593
117599
|
};
|
|
117594
117600
|
this._onControlEnd = function (res) {
|
|
117595
|
-
|
|
117596
|
-
|
|
117601
|
+
_this.noObserver.isControlActive = false;
|
|
117602
|
+
_this13.$emit('controlEnd', res);
|
|
117597
117603
|
|
|
117598
117604
|
// 统一交互结束处理(相机)
|
|
117599
|
-
|
|
117605
|
+
_this13.endInteraction('this.camera', res, {
|
|
117600
117606
|
immediateResume: false
|
|
117601
117607
|
});
|
|
117602
117608
|
|
|
117603
117609
|
// 记录鼠标抬起时的位置并计算是否发生了拖拽
|
|
117604
117610
|
var event = res.originalEvent || window.event;
|
|
117605
117611
|
if (event) {
|
|
117606
|
-
mouseUpPosition.x = event.clientX || 0;
|
|
117607
|
-
mouseUpPosition.y = event.clientY || 0;
|
|
117608
|
-
var deltaX = Math.abs(mouseUpPosition.x - mouseDownPosition.x);
|
|
117609
|
-
var deltaY = Math.abs(mouseUpPosition.y - mouseDownPosition.y);
|
|
117612
|
+
_this.mouseUpPosition.x = event.clientX || 0;
|
|
117613
|
+
_this.mouseUpPosition.y = event.clientY || 0;
|
|
117614
|
+
var deltaX = Math.abs(_this.mouseUpPosition.x - _this.mouseDownPosition.x);
|
|
117615
|
+
var deltaY = Math.abs(_this.mouseUpPosition.y - _this.mouseDownPosition.y);
|
|
117610
117616
|
var distance = Math.sqrt(deltaX * deltaX + deltaY * deltaY);
|
|
117611
|
-
isDragging = distance > dragThreshold;
|
|
117617
|
+
_this.isDragging = distance > dragThreshold;
|
|
117612
117618
|
}
|
|
117613
117619
|
|
|
117614
117620
|
// 只有在实际发生拖拽时才执行相关操作
|
|
117615
|
-
if (isDragging) {
|
|
117621
|
+
if (_this.isDragging) {
|
|
117616
117622
|
// 居中逻辑
|
|
117617
|
-
// if (needsCenteringAfterInteraction && !hasExecutedCentering) {
|
|
117623
|
+
// if (this.needsCenteringAfterInteraction && !this.hasExecutedCentering) {
|
|
117618
117624
|
// setTimeout(() => {
|
|
117619
|
-
// if (modelGroups.length > 0) {
|
|
117620
|
-
// this.setModelCenter(modelGroups[modelGroups.length - 1]);
|
|
117621
|
-
// hasExecutedCentering = true;
|
|
117622
|
-
// needsCenteringAfterInteraction = false;
|
|
117625
|
+
// if (this.modelGroups.length > 0) {
|
|
117626
|
+
// this.setModelCenter(this.modelGroups[this.modelGroups.length - 1]);
|
|
117627
|
+
// this.hasExecutedCentering = true;
|
|
117628
|
+
// this.needsCenteringAfterInteraction = false;
|
|
117623
117629
|
// }
|
|
117624
117630
|
// }, 300);
|
|
117625
117631
|
// }
|
|
117626
117632
|
|
|
117627
117633
|
// 触发观察者
|
|
117628
|
-
|
|
117634
|
+
_this13._cameraChangeObserver('control');
|
|
117629
117635
|
}
|
|
117630
117636
|
};
|
|
117631
|
-
cameraControls.addEventListener('controlstart', this._onControlStart);
|
|
117632
|
-
cameraControls.addEventListener('controlend', this._onControlEnd);
|
|
117637
|
+
this.cameraControls.addEventListener('controlstart', this._onControlStart);
|
|
117638
|
+
this.cameraControls.addEventListener('controlend', this._onControlEnd);
|
|
117633
117639
|
|
|
117634
117640
|
// 5. 监听器 - Programmatic (程序化动画/过渡结束)
|
|
117635
|
-
// 监听 rest 事件,捕获 cameraControls.setLookAt(..., true) 等动画结束(以及阻尼停止)
|
|
117641
|
+
// 监听 rest 事件,捕获 this.cameraControls.setLookAt(..., true) 等动画结束(以及阻尼停止)
|
|
117636
117642
|
// 注意:rest 事件在用户交互完全静止时也会触发,与 controlEnd 有部分重叠,但 Observer 有防抖,影响不大
|
|
117637
117643
|
this._onRest = function () {
|
|
117638
|
-
|
|
117644
|
+
_this13._cameraChangeObserver('rest');
|
|
117639
117645
|
};
|
|
117640
|
-
cameraControls.addEventListener('rest', this._onRest);
|
|
117646
|
+
this.cameraControls.addEventListener('rest', this._onRest);
|
|
117641
117647
|
},
|
|
117642
117648
|
// 初始化光源
|
|
117643
117649
|
initLight: function initLight() {
|
|
117644
|
-
var pmremGenerator = new this.THREE.PMREMGenerator(
|
|
117645
|
-
|
|
117650
|
+
var pmremGenerator = new this.THREE.PMREMGenerator(this.renderer);
|
|
117651
|
+
this.scene.environment = pmremGenerator.fromScene(new RoomEnvironment_RoomEnvironment(), 0.04).texture;
|
|
117646
117652
|
},
|
|
117647
117653
|
// 初始化文字画布
|
|
117648
117654
|
initLabelRender: function initLabelRender() {
|
|
117649
|
-
labelRenderer = new CSS2DRenderer();
|
|
117650
|
-
var rect = instructions.getBoundingClientRect();
|
|
117651
|
-
labelRenderer.setSize(rect.width, rect.height);
|
|
117652
|
-
labelRenderer.domElement.style.position = 'absolute';
|
|
117653
|
-
labelRenderer.domElement.style.top = '0';
|
|
117654
|
-
labelRenderer.domElement.style.pointerEvents = 'none';
|
|
117655
|
-
instructions.appendChild(labelRenderer.domElement);
|
|
117655
|
+
this.labelRenderer = new CSS2DRenderer();
|
|
117656
|
+
var rect = this.instructions.getBoundingClientRect();
|
|
117657
|
+
this.labelRenderer.setSize(rect.width, rect.height);
|
|
117658
|
+
this.labelRenderer.domElement.style.position = 'absolute';
|
|
117659
|
+
this.labelRenderer.domElement.style.top = '0';
|
|
117660
|
+
this.labelRenderer.domElement.style.pointerEvents = 'none';
|
|
117661
|
+
this.instructions.appendChild(this.labelRenderer.domElement);
|
|
117656
117662
|
},
|
|
117657
117663
|
// 根据模型数据绘制模型实体 业务平台可调用此方法加载模型
|
|
117658
117664
|
/*
|
|
@@ -117661,32 +117667,33 @@ var isDebug = false || false === true;
|
|
|
117661
117667
|
meshNameConfig: {}
|
|
117662
117668
|
*/
|
|
117663
117669
|
drawModel: function drawModel(data) {
|
|
117664
|
-
var
|
|
117670
|
+
var _this14 = this;
|
|
117665
117671
|
var color = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
|
|
117666
117672
|
var meshNameConfig = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
117667
117673
|
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
|
|
117674
|
+
console.log(data);
|
|
117668
117675
|
// data = require('./mock.json');
|
|
117669
117676
|
// 使用新的分帧加载方法,提供进度回调
|
|
117670
117677
|
return this.drawModelWithBatchLoading(data, color, meshNameConfig, options, function (progress) {
|
|
117671
117678
|
// 触发原有的进度事件
|
|
117672
|
-
|
|
117679
|
+
_this14.$emit('loadProgress', _this14.progress);
|
|
117673
117680
|
}, function (complete) {
|
|
117674
117681
|
var _options$onComplete2;
|
|
117675
117682
|
options === null || options === void 0 || (_options$onComplete2 = options.onComplete) === null || _options$onComplete2 === void 0 || _options$onComplete2.call(options, complete);
|
|
117676
117683
|
console.log('加载完成');
|
|
117677
117684
|
// 触发原有的完成事件
|
|
117678
|
-
|
|
117685
|
+
_this14.$emit('loadComplete');
|
|
117679
117686
|
});
|
|
117680
117687
|
},
|
|
117681
117688
|
// 动态设置视角滚轮的距离
|
|
117682
117689
|
setCameraConfig: function setCameraConfig() {
|
|
117683
|
-
// let box3 = new this.THREE.Box3().setFromObject(sceneBoundingBox);
|
|
117690
|
+
// let box3 = new this.THREE.Box3().setFromObject(this.sceneBoundingBox);
|
|
117684
117691
|
var size = new this.THREE.Vector3();
|
|
117685
|
-
sceneBoundingBox.getSize(size);
|
|
117692
|
+
this.sceneBoundingBox.getSize(size);
|
|
117686
117693
|
var maxBorder = Math.max(size.x, size.y, size.z);
|
|
117687
|
-
// cameraControls.camera.far = maxBorder * 10; // 设置相机的远裁剪面
|
|
117688
|
-
cameraControls.minDistance = maxBorder * 0.2; // 动态设置视角滚轮的距离
|
|
117689
|
-
|
|
117694
|
+
// this.cameraControls.this.camera.far = maxBorder * 10; // 设置相机的远裁剪面
|
|
117695
|
+
this.cameraControls.minDistance = maxBorder * 0.2; // 动态设置视角滚轮的距离
|
|
117696
|
+
this.camera.updateProjectionMatrix();
|
|
117690
117697
|
},
|
|
117691
117698
|
// 获取mesh的中心点
|
|
117692
117699
|
getMeshCenterAndVolume: function getMeshCenterAndVolume(mesh) {
|
|
@@ -117702,13 +117709,13 @@ var isDebug = false || false === true;
|
|
|
117702
117709
|
},
|
|
117703
117710
|
mouseDown: function mouseDown(event) {
|
|
117704
117711
|
// 在鼠标按下时启用渲染中断以提升响应性
|
|
117705
|
-
forceSkipRendering = true;
|
|
117706
|
-
skipNextRenderFrame = true;
|
|
117712
|
+
this.forceSkipRendering = true;
|
|
117713
|
+
this.skipNextRenderFrame = true;
|
|
117707
117714
|
var intersects = this.getRaycasterObjects(event);
|
|
117708
|
-
firstTime = new Date().getTime();
|
|
117715
|
+
this.firstTime = new Date().getTime();
|
|
117709
117716
|
var params = {
|
|
117710
117717
|
event: event,
|
|
117711
|
-
firstTime: firstTime
|
|
117718
|
+
firstTime: this.firstTime
|
|
117712
117719
|
};
|
|
117713
117720
|
intersects.length && (params.v3Position = {
|
|
117714
117721
|
x: intersects[0].point.x,
|
|
@@ -117719,18 +117726,18 @@ var isDebug = false || false === true;
|
|
|
117719
117726
|
},
|
|
117720
117727
|
getRaycasterObjects: function getRaycasterObjects(event) {
|
|
117721
117728
|
// 保护空值,避免在未初始化或销毁后触发错误
|
|
117722
|
-
if (!
|
|
117729
|
+
if (!this.renderer || !this.renderer.domElement || !this.camera || !this.scene) return [];
|
|
117723
117730
|
// 获取元素在页面中的偏移位置
|
|
117724
|
-
var rect =
|
|
117731
|
+
var rect = this.renderer.domElement.getBoundingClientRect();
|
|
117725
117732
|
var x = event.clientX - rect.left;
|
|
117726
117733
|
var y = event.clientY - rect.top;
|
|
117727
117734
|
|
|
117728
|
-
// mouse.x = (event.clientX / instructions.offsetWidth) * 2 - 1;
|
|
117729
|
-
// mouse.y = -(event.clientY / instructions.offsetHeight) * 2 + 1;
|
|
117730
|
-
|
|
117731
|
-
|
|
117732
|
-
|
|
117733
|
-
return
|
|
117735
|
+
// this.mouse.x = (event.clientX / this.instructions.offsetWidth) * 2 - 1;
|
|
117736
|
+
// this.mouse.y = -(event.clientY / this.instructions.offsetHeight) * 2 + 1;
|
|
117737
|
+
this.mouse.x = x / rect.width * 2 - 1;
|
|
117738
|
+
this.mouse.y = -(y / rect.height) * 2 + 1;
|
|
117739
|
+
this.raycaster.setFromCamera(this.mouse, this.camera);
|
|
117740
|
+
return this.scene && this.scene.children ? this.raycaster.intersectObjects(this.scene.children, true) : [];
|
|
117734
117741
|
},
|
|
117735
117742
|
getInstanceId: function getInstanceId(instancedMesh, instanceIndex, options) {
|
|
117736
117743
|
if (!instancedMesh || instanceIndex === undefined || instanceIndex === null) {
|
|
@@ -117753,31 +117760,31 @@ var isDebug = false || false === true;
|
|
|
117753
117760
|
}
|
|
117754
117761
|
},
|
|
117755
117762
|
mouseClick: function mouseClick(event) {
|
|
117756
|
-
var
|
|
117763
|
+
var _this15 = this;
|
|
117757
117764
|
// 鼠标抬起时重置渲染中断标记
|
|
117758
117765
|
setTimeout(function () {
|
|
117759
|
-
forceSkipRendering = false;
|
|
117766
|
+
_this15.forceSkipRendering = false;
|
|
117760
117767
|
// interactionFrameCount = 0;
|
|
117761
117768
|
// 恢复批次加载操作
|
|
117762
|
-
|
|
117769
|
+
_this15.resumeBatchLoading();
|
|
117763
117770
|
}, 50); // 短暂延迟确保交互完成
|
|
117764
117771
|
|
|
117765
117772
|
// 在测量模式下,不进行事件暴露
|
|
117766
|
-
if (!measureFlag) {
|
|
117767
|
-
|
|
117768
|
-
if (
|
|
117773
|
+
if (!this.measureFlag) {
|
|
117774
|
+
this.lastTime = new Date().getTime();
|
|
117775
|
+
if (this.lastTime - this.firstTime < 300) {
|
|
117769
117776
|
var intersects = this.getRaycasterObjects(event);
|
|
117770
117777
|
var params = {};
|
|
117771
117778
|
var cameraData = {
|
|
117772
117779
|
position: {
|
|
117773
|
-
x: cameraControls.camera.position.x,
|
|
117774
|
-
y: cameraControls.camera.position.y,
|
|
117775
|
-
z: cameraControls.camera.position.z
|
|
117780
|
+
x: this.cameraControls.camera.position.x,
|
|
117781
|
+
y: this.cameraControls.camera.position.y,
|
|
117782
|
+
z: this.cameraControls.camera.position.z
|
|
117776
117783
|
},
|
|
117777
117784
|
lookAt: {
|
|
117778
|
-
heading: cameraControls._target.x,
|
|
117779
|
-
pitch: cameraControls._target.y,
|
|
117780
|
-
roll: cameraControls._target.z
|
|
117785
|
+
heading: this.cameraControls._target.x,
|
|
117786
|
+
pitch: this.cameraControls._target.y,
|
|
117787
|
+
roll: this.cameraControls._target.z
|
|
117781
117788
|
}
|
|
117782
117789
|
};
|
|
117783
117790
|
if (intersects.length > 0) {
|
|
@@ -117817,11 +117824,11 @@ var isDebug = false || false === true;
|
|
|
117817
117824
|
if (event.button === 0) {
|
|
117818
117825
|
this.$emit('leftClick', params);
|
|
117819
117826
|
} else if (event.button === 1) {
|
|
117820
|
-
if (
|
|
117827
|
+
if (this.lastTime - this.lastMiddleClickTime < 2000) {
|
|
117821
117828
|
this.$emit('middleDblClick', params);
|
|
117822
|
-
lastMiddleClickTime = 0;
|
|
117829
|
+
this.lastMiddleClickTime = 0;
|
|
117823
117830
|
} else {
|
|
117824
|
-
lastMiddleClickTime =
|
|
117831
|
+
this.lastMiddleClickTime = this.lastTime;
|
|
117825
117832
|
}
|
|
117826
117833
|
}
|
|
117827
117834
|
}
|
|
@@ -117829,24 +117836,24 @@ var isDebug = false || false === true;
|
|
|
117829
117836
|
},
|
|
117830
117837
|
// 窗口发生改变时, 更新渲染器与相机的大小
|
|
117831
117838
|
resize: function resize(width, height) {
|
|
117832
|
-
if (
|
|
117833
|
-
|
|
117834
|
-
|
|
117835
|
-
|
|
117836
|
-
if (
|
|
117837
|
-
|
|
117839
|
+
if (this.camera) {
|
|
117840
|
+
this.camera.aspect = width / height;
|
|
117841
|
+
this.camera.updateProjectionMatrix();
|
|
117842
|
+
this.renderer.setSize(width, height, true);
|
|
117843
|
+
if (this.renderTarget) {
|
|
117844
|
+
this.renderTarget.setSize(width, height);
|
|
117838
117845
|
}
|
|
117839
|
-
if (outlineComposer) {
|
|
117840
|
-
outlineComposer.setSize(width, height);
|
|
117846
|
+
if (this.outlineComposer) {
|
|
117847
|
+
this.outlineComposer.setSize(width, height);
|
|
117841
117848
|
}
|
|
117842
|
-
if (outlinePass) {
|
|
117843
|
-
outlinePass.setSize(width, height);
|
|
117849
|
+
if (this.outlinePass) {
|
|
117850
|
+
this.outlinePass.setSize(width, height);
|
|
117844
117851
|
}
|
|
117845
|
-
labelRenderer.setSize(width, height);
|
|
117852
|
+
this.labelRenderer.setSize(width, height);
|
|
117846
117853
|
// this.timeRender()
|
|
117847
117854
|
// 这里也要更新测量
|
|
117848
|
-
if (threeMeasure) {
|
|
117849
|
-
threeMeasure.updateParams(width, height);
|
|
117855
|
+
if (this.threeMeasure) {
|
|
117856
|
+
this.threeMeasure.updateParams(width, height);
|
|
117850
117857
|
}
|
|
117851
117858
|
}
|
|
117852
117859
|
},
|
|
@@ -117885,7 +117892,7 @@ var isDebug = false || false === true;
|
|
|
117885
117892
|
roll: center.z,
|
|
117886
117893
|
enableTransition: options.enableTransition
|
|
117887
117894
|
});
|
|
117888
|
-
// cameraControls.setLookAt(
|
|
117895
|
+
// this.cameraControls.setLookAt(
|
|
117889
117896
|
// center.x,
|
|
117890
117897
|
// center.y + size.y,
|
|
117891
117898
|
// center.z + size.z / 2,
|
|
@@ -117894,39 +117901,39 @@ var isDebug = false || false === true;
|
|
|
117894
117901
|
// center.z,
|
|
117895
117902
|
// true
|
|
117896
117903
|
// );
|
|
117897
|
-
// cameraControls.update(0);
|
|
117898
|
-
// camera.updateProjectionMatrix();
|
|
117899
|
-
// cameraControls.saveState();
|
|
117904
|
+
// this.cameraControls.update(0);
|
|
117905
|
+
// this.camera.updateProjectionMatrix();
|
|
117906
|
+
// this.cameraControls.saveState();
|
|
117900
117907
|
},
|
|
117901
117908
|
// 带防抖和用户交互检测的智能居中方法
|
|
117902
117909
|
smartModelCenter: function smartModelCenter(mesh) {
|
|
117903
|
-
var
|
|
117910
|
+
var _this16 = this;
|
|
117904
117911
|
var debounceDelay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
|
|
117905
|
-
// if (hasExecutedCentering) {
|
|
117912
|
+
// if (this.hasExecutedCentering) {
|
|
117906
117913
|
// return;
|
|
117907
117914
|
// }
|
|
117908
117915
|
|
|
117909
117916
|
// 如果用户正在交互,标记需要在交互结束后居中
|
|
117910
|
-
if (userInteracting) {
|
|
117911
|
-
needsCenteringAfterInteraction = true;
|
|
117917
|
+
if (this.userInteracting) {
|
|
117918
|
+
this.needsCenteringAfterInteraction = true;
|
|
117912
117919
|
return;
|
|
117913
117920
|
}
|
|
117914
117921
|
|
|
117915
117922
|
// 清除之前的防抖定时器
|
|
117916
|
-
if (centeringDebounceTimer) {
|
|
117917
|
-
clearTimeout(centeringDebounceTimer);
|
|
117923
|
+
if (this.centeringDebounceTimer) {
|
|
117924
|
+
clearTimeout(this.centeringDebounceTimer);
|
|
117918
117925
|
}
|
|
117919
117926
|
|
|
117920
117927
|
// 设置新的防抖定时器
|
|
117921
|
-
centeringDebounceTimer = setTimeout(function () {
|
|
117928
|
+
this.centeringDebounceTimer = setTimeout(function () {
|
|
117922
117929
|
// 如果已经执行过居中操作,则不再执行
|
|
117923
|
-
if (!userInteracting && !hasExecutedCentering &&
|
|
117924
|
-
|
|
117930
|
+
if (!_this16.userInteracting && !_this16.hasExecutedCentering && _this16.noObserver.documentModelIds.size > 0) {
|
|
117931
|
+
_this16.setModelCenter(mesh, {
|
|
117925
117932
|
enableTransition: false
|
|
117926
117933
|
});
|
|
117927
|
-
hasExecutedCentering = true;
|
|
117934
|
+
_this16.hasExecutedCentering = true;
|
|
117928
117935
|
// 触发场景更新
|
|
117929
|
-
|
|
117936
|
+
_this16.notifyCameraChange();
|
|
117930
117937
|
}
|
|
117931
117938
|
}, debounceDelay);
|
|
117932
117939
|
},
|
|
@@ -117946,16 +117953,18 @@ var isDebug = false || false === true;
|
|
|
117946
117953
|
* '#ff0000'
|
|
117947
117954
|
* '#f00'
|
|
117948
117955
|
* 'red'
|
|
117956
|
+
* hasOutline 是否需要加上高亮边。默认为true
|
|
117949
117957
|
* }
|
|
117950
117958
|
*/
|
|
117951
117959
|
updateProperty: function updateProperty(list) {
|
|
117952
|
-
var
|
|
117960
|
+
var _this17 = this;
|
|
117961
|
+
var hasOutline = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
117953
117962
|
var isUpdate = false;
|
|
117954
117963
|
var _loop = function _loop() {
|
|
117955
117964
|
var ele = list[index];
|
|
117956
117965
|
var type = ele.type || 'mesh';
|
|
117957
117966
|
var instanceId = ele.name;
|
|
117958
|
-
var targetObj =
|
|
117967
|
+
var targetObj = _this17.getObjectByName(instanceId);
|
|
117959
117968
|
var _loop2 = function _loop2(key) {
|
|
117960
117969
|
switch (key) {
|
|
117961
117970
|
case 'color':
|
|
@@ -117963,18 +117972,20 @@ var isDebug = false || false === true;
|
|
|
117963
117972
|
if (children.isMesh) {
|
|
117964
117973
|
var _children$userData$in = children.userData.instancesMap.get(instanceId),
|
|
117965
117974
|
instanceIndex = _children$userData$in.instanceIndex;
|
|
117966
|
-
children.setColorAt(instanceIndex, new
|
|
117975
|
+
children.setColorAt(instanceIndex, new _this17.THREE.Color(ele.attr[key]));
|
|
117967
117976
|
children.instanceColor.needsUpdate = true;
|
|
117968
|
-
if (!
|
|
117969
|
-
|
|
117977
|
+
if (!_this17.isCurrentVisible(instanceId, children)) {
|
|
117978
|
+
_this17.removeOutlineObject(children, instanceIndex);
|
|
117970
117979
|
return;
|
|
117971
117980
|
}
|
|
117972
|
-
if (
|
|
117973
|
-
if (
|
|
117974
|
-
|
|
117975
|
-
|
|
117976
|
-
|
|
117977
|
-
|
|
117981
|
+
if (hasOutline) {
|
|
117982
|
+
if (_this17.outlinePass) {
|
|
117983
|
+
if (children.isInstancedMesh) {
|
|
117984
|
+
var proxy = _this17.ensureOutlineInstanceProxy(children, instanceIndex);
|
|
117985
|
+
_this17.pushOutlineTarget(proxy);
|
|
117986
|
+
} else if (!_this17.isSourceHiddenInstance(children, instanceId)) {
|
|
117987
|
+
_this17.pushOutlineTarget(children);
|
|
117988
|
+
}
|
|
117978
117989
|
}
|
|
117979
117990
|
}
|
|
117980
117991
|
}
|
|
@@ -117986,10 +117997,10 @@ var isDebug = false || false === true;
|
|
|
117986
117997
|
isUpdate = true;
|
|
117987
117998
|
}
|
|
117988
117999
|
var requestedVisible = Boolean(ele.attr[key]);
|
|
117989
|
-
var nextBoxVisible = requestedVisible &&
|
|
117990
|
-
var boxKey =
|
|
117991
|
-
if (
|
|
117992
|
-
var boxData =
|
|
118000
|
+
var nextBoxVisible = requestedVisible && _this17.isSourceVisible(instanceId);
|
|
118001
|
+
var boxKey = _this17._boxIndex && _this17._boxIndex.has(String(instanceId)) ? String(instanceId) : instanceId;
|
|
118002
|
+
if (_this17._boxIndex && _this17._boxIndex.has(boxKey)) {
|
|
118003
|
+
var boxData = _this17._boxIndex.get(boxKey);
|
|
117993
118004
|
if (boxData && boxData.userData) {
|
|
117994
118005
|
boxData.userData.visible = nextBoxVisible;
|
|
117995
118006
|
}
|
|
@@ -117998,21 +118009,21 @@ var isDebug = false || false === true;
|
|
|
117998
118009
|
var instanceInfo = children.userData.instancesMap.get(instanceId);
|
|
117999
118010
|
var instanceIndex = instanceInfo.instanceIndex,
|
|
118000
118011
|
copyMatrix = instanceInfo.copyMatrix;
|
|
118001
|
-
var nextVisible = requestedVisible &&
|
|
118012
|
+
var nextVisible = requestedVisible && _this17.isSourceVisible(instanceId, children);
|
|
118002
118013
|
instanceInfo.visible = nextVisible;
|
|
118003
118014
|
if (nextVisible) {
|
|
118004
|
-
var restoreMatrix = new
|
|
118015
|
+
var restoreMatrix = new _this17.THREE.Matrix4().copy(copyMatrix || children.userData.copyMatrix);
|
|
118005
118016
|
children.setMatrixAt(instanceIndex, restoreMatrix);
|
|
118006
118017
|
} else {
|
|
118007
|
-
var _copyMatrix =
|
|
118018
|
+
var _copyMatrix = _this17.getInstanceCopyMatrix(children, instanceId);
|
|
118008
118019
|
if (!_copyMatrix) return;
|
|
118009
|
-
var offsetMatrix = new
|
|
118020
|
+
var offsetMatrix = new _this17.THREE.Matrix4().copy(_copyMatrix || children.userData.copyMatrix).makeTranslation(9999999, 9999999, 9999999);
|
|
118010
118021
|
children.setMatrixAt(instanceIndex, offsetMatrix);
|
|
118011
|
-
|
|
118022
|
+
_this17.removeOutlineObject(children, instanceIndex);
|
|
118012
118023
|
}
|
|
118013
118024
|
children.instanceMatrix.needsUpdate = true;
|
|
118014
118025
|
});
|
|
118015
|
-
|
|
118026
|
+
_this17.notifyCameraChange(); // 触发场景更新
|
|
118016
118027
|
break;
|
|
118017
118028
|
}
|
|
118018
118029
|
case 'opacity':
|
|
@@ -118047,17 +118058,17 @@ var isDebug = false || false === true;
|
|
|
118047
118058
|
}
|
|
118048
118059
|
},
|
|
118049
118060
|
setAllModelVisible: function setAllModelVisible(visible) {
|
|
118050
|
-
var
|
|
118061
|
+
var _this18 = this;
|
|
118051
118062
|
var isVisible = Boolean(visible);
|
|
118052
118063
|
var matrixCache = new this.THREE.Matrix4();
|
|
118053
118064
|
if (this._boxIndex && this._boxIndex.size > 0) {
|
|
118054
118065
|
this._boxIndex.forEach(function (box, modelId) {
|
|
118055
118066
|
if (!box || !box.userData) return;
|
|
118056
|
-
box.userData.visible = isVisible &&
|
|
118067
|
+
box.userData.visible = isVisible && _this18.isSourceVisible(modelId);
|
|
118057
118068
|
});
|
|
118058
118069
|
}
|
|
118059
|
-
if (
|
|
118060
|
-
|
|
118070
|
+
if (this.scene) {
|
|
118071
|
+
this.scene.traverse(function (child) {
|
|
118061
118072
|
if (!child || !child.isInstancedMesh) return;
|
|
118062
118073
|
var userData = child.userData || {};
|
|
118063
118074
|
if (!(userData.instancesMap instanceof Map) || userData.instancesMap.size === 0) return;
|
|
@@ -118066,7 +118077,7 @@ var isDebug = false || false === true;
|
|
|
118066
118077
|
var instanceIndex = instanceInfo && typeof instanceInfo.instanceIndex === 'number' ? instanceInfo.instanceIndex : null;
|
|
118067
118078
|
if (instanceIndex === null) return;
|
|
118068
118079
|
var copyMatrix = instanceInfo.copyMatrix || userData.copyMatrix;
|
|
118069
|
-
if (isVisible &&
|
|
118080
|
+
if (isVisible && _this18.isSourceVisible(instanceId, child)) {
|
|
118070
118081
|
instanceInfo.visible = true;
|
|
118071
118082
|
matrixCache.copy(copyMatrix);
|
|
118072
118083
|
child.setMatrixAt(instanceIndex, matrixCache);
|
|
@@ -118074,7 +118085,7 @@ var isDebug = false || false === true;
|
|
|
118074
118085
|
instanceInfo.visible = false;
|
|
118075
118086
|
matrixCache.copy(copyMatrix).makeTranslation(9999999, 9999999, 9999999);
|
|
118076
118087
|
child.setMatrixAt(instanceIndex, matrixCache);
|
|
118077
|
-
|
|
118088
|
+
_this18.removeOutlineObject(child, instanceIndex);
|
|
118078
118089
|
}
|
|
118079
118090
|
});
|
|
118080
118091
|
child.instanceMatrix.needsUpdate = true;
|
|
@@ -118086,47 +118097,47 @@ var isDebug = false || false === true;
|
|
|
118086
118097
|
}
|
|
118087
118098
|
},
|
|
118088
118099
|
showOutlinePass: function showOutlinePass(instanceId) {
|
|
118089
|
-
var
|
|
118100
|
+
var _this19 = this;
|
|
118090
118101
|
var targetObj = this.getObjectByName(instanceId);
|
|
118091
118102
|
targetObj.forEach(function (children) {
|
|
118092
118103
|
if (children.isMesh) {
|
|
118093
118104
|
var _children$userData$in3 = children.userData.instancesMap.get(instanceId),
|
|
118094
118105
|
instanceIndex = _children$userData$in3.instanceIndex;
|
|
118095
|
-
if (!
|
|
118096
|
-
|
|
118106
|
+
if (!_this19.isSourceVisible(instanceId, children)) {
|
|
118107
|
+
_this19.removeOutlineObject(children, instanceIndex);
|
|
118097
118108
|
return;
|
|
118098
118109
|
}
|
|
118099
|
-
if (!
|
|
118100
|
-
|
|
118110
|
+
if (!_this19.isCurrentVisible(instanceId, children)) {
|
|
118111
|
+
_this19.removeOutlineObject(children, instanceIndex);
|
|
118101
118112
|
return;
|
|
118102
118113
|
}
|
|
118103
|
-
if (outlinePass) {
|
|
118114
|
+
if (_this19.outlinePass) {
|
|
118104
118115
|
if (children.isInstancedMesh) {
|
|
118105
|
-
var proxy =
|
|
118106
|
-
|
|
118116
|
+
var proxy = _this19.ensureOutlineInstanceProxy(children, instanceIndex);
|
|
118117
|
+
_this19.pushOutlineTarget(proxy);
|
|
118107
118118
|
} else {
|
|
118108
|
-
|
|
118119
|
+
_this19.pushOutlineTarget(children);
|
|
118109
118120
|
}
|
|
118110
118121
|
}
|
|
118111
118122
|
}
|
|
118112
118123
|
});
|
|
118113
118124
|
},
|
|
118114
118125
|
hideOutlinePass: function hideOutlinePass(instanceId) {
|
|
118115
|
-
var
|
|
118126
|
+
var _this20 = this;
|
|
118116
118127
|
var targetObj = this.getObjectByName(instanceId);
|
|
118117
118128
|
targetObj.forEach(function (children) {
|
|
118118
118129
|
if (children.isMesh) {
|
|
118119
118130
|
var _children$userData$in4 = children.userData.instancesMap.get(instanceId),
|
|
118120
118131
|
instanceIndex = _children$userData$in4.instanceIndex;
|
|
118121
|
-
|
|
118132
|
+
_this20.removeOutlineObject(children, instanceIndex);
|
|
118122
118133
|
}
|
|
118123
118134
|
});
|
|
118124
118135
|
},
|
|
118125
118136
|
// 恢复模型原来的状态
|
|
118126
118137
|
updateWholeProperty: function updateWholeProperty() {
|
|
118127
118138
|
throw new Error('该方法已暂停使用,请使用restore方法。');
|
|
118128
|
-
// if (scene) {
|
|
118129
|
-
// scene.traverse(obj => {
|
|
118139
|
+
// if (this.scene) {
|
|
118140
|
+
// this.scene.traverse(obj => {
|
|
118130
118141
|
// if (obj instanceof this.THREE.Mesh) {
|
|
118131
118142
|
// // 恢复颜色
|
|
118132
118143
|
// obj.setColorAt(obj.userData.instanceIndex, obj.material.userData.nColor)
|
|
@@ -118141,17 +118152,17 @@ var isDebug = false || false === true;
|
|
|
118141
118152
|
},
|
|
118142
118153
|
// 修改材质的自定义数据
|
|
118143
118154
|
updateMaterialUserData: function updateMaterialUserData(list) {
|
|
118144
|
-
var
|
|
118155
|
+
var _this21 = this;
|
|
118145
118156
|
var _loop3 = function _loop3() {
|
|
118146
118157
|
var ele = list[index];
|
|
118147
118158
|
var instanceId = ele.name;
|
|
118148
|
-
var targetObj =
|
|
118159
|
+
var targetObj = _this21.getObjectByName(instanceId);
|
|
118149
118160
|
var _loop4 = function _loop4(key) {
|
|
118150
118161
|
switch (key) {
|
|
118151
118162
|
case 'nColor':
|
|
118152
118163
|
targetObj.forEach(function (children) {
|
|
118153
118164
|
if (children.isMesh) {
|
|
118154
|
-
children.material.userData[key] = new
|
|
118165
|
+
children.material.userData[key] = new _this21.THREE.Color(ele.attr[key]);
|
|
118155
118166
|
}
|
|
118156
118167
|
});
|
|
118157
118168
|
break;
|
|
@@ -118167,12 +118178,12 @@ var isDebug = false || false === true;
|
|
|
118167
118178
|
},
|
|
118168
118179
|
// 重置
|
|
118169
118180
|
resetMaterialUserData: function resetMaterialUserData(list) {
|
|
118170
|
-
var
|
|
118181
|
+
var _this22 = this;
|
|
118171
118182
|
console.log('resetMaterialUserData');
|
|
118172
118183
|
var _loop5 = function _loop5() {
|
|
118173
118184
|
var ele = list[index];
|
|
118174
118185
|
var instanceId = ele.name;
|
|
118175
|
-
var targetObj =
|
|
118186
|
+
var targetObj = _this22.getObjectByName(instanceId);
|
|
118176
118187
|
var _loop6 = function _loop6(key) {
|
|
118177
118188
|
switch (key) {
|
|
118178
118189
|
case 'nColor':
|
|
@@ -118198,11 +118209,11 @@ var isDebug = false || false === true;
|
|
|
118198
118209
|
},
|
|
118199
118210
|
// 清除上一次的属性修改操作 为了方便业务平台参数跟updateProperty方法的参数一样
|
|
118200
118211
|
resetProperty: function resetProperty(list) {
|
|
118201
|
-
var
|
|
118212
|
+
var _this23 = this;
|
|
118202
118213
|
var _loop7 = function _loop7() {
|
|
118203
118214
|
var ele = list[index];
|
|
118204
118215
|
var instanceId = ele.name;
|
|
118205
|
-
var obj =
|
|
118216
|
+
var obj = _this23.getObjectByName(instanceId);
|
|
118206
118217
|
if (obj) {
|
|
118207
118218
|
for (var key in ele.attr) {
|
|
118208
118219
|
switch (key) {
|
|
@@ -118213,12 +118224,12 @@ var isDebug = false || false === true;
|
|
|
118213
118224
|
instanceIndex = _children$userData$in6.instanceIndex;
|
|
118214
118225
|
children.setColorAt(instanceIndex, children.material.userData.nColor);
|
|
118215
118226
|
children.instanceColor.needsUpdate = true;
|
|
118216
|
-
if (outlinePass) {
|
|
118227
|
+
if (_this23.outlinePass) {
|
|
118217
118228
|
if (children.isInstancedMesh) {
|
|
118218
|
-
|
|
118229
|
+
_this23.removeOutlineInstanceProxy(children, instanceIndex);
|
|
118219
118230
|
} else {
|
|
118220
|
-
var idx = outlinePass.selectedObjects.indexOf(children);
|
|
118221
|
-
if (idx !== -1) outlinePass.selectedObjects.splice(idx, 1);
|
|
118231
|
+
var idx = _this23.outlinePass.selectedObjects.indexOf(children);
|
|
118232
|
+
if (idx !== -1) _this23.outlinePass.selectedObjects.splice(idx, 1);
|
|
118222
118233
|
}
|
|
118223
118234
|
}
|
|
118224
118235
|
}
|
|
@@ -118230,15 +118241,15 @@ var isDebug = false || false === true;
|
|
|
118230
118241
|
var instanceInfo = children.userData.instancesMap.get(instanceId);
|
|
118231
118242
|
var instanceIndex = instanceInfo.instanceIndex,
|
|
118232
118243
|
copyMatrix = instanceInfo.copyMatrix;
|
|
118233
|
-
if (
|
|
118244
|
+
if (_this23.isSourceVisible(instanceId, children)) {
|
|
118234
118245
|
instanceInfo.visible = true;
|
|
118235
|
-
var restoreMatrix = new
|
|
118246
|
+
var restoreMatrix = new _this23.THREE.Matrix4().copy(copyMatrix);
|
|
118236
118247
|
children.setMatrixAt(instanceIndex, restoreMatrix);
|
|
118237
118248
|
} else {
|
|
118238
118249
|
instanceInfo.visible = false;
|
|
118239
|
-
var offsetMatrix = new
|
|
118250
|
+
var offsetMatrix = new _this23.THREE.Matrix4().copy(copyMatrix).makeTranslation(9999999, 9999999, 9999999);
|
|
118240
118251
|
children.setMatrixAt(instanceIndex, offsetMatrix);
|
|
118241
|
-
|
|
118252
|
+
_this23.removeOutlineObject(children, instanceIndex);
|
|
118242
118253
|
}
|
|
118243
118254
|
children.instanceMatrix.needsUpdate = true;
|
|
118244
118255
|
});
|
|
@@ -118265,12 +118276,12 @@ var isDebug = false || false === true;
|
|
|
118265
118276
|
// 定位到模型
|
|
118266
118277
|
// name 模型名称 可以是数组
|
|
118267
118278
|
locateModel: function locateModel(name) {
|
|
118268
|
-
var
|
|
118269
|
-
if (!
|
|
118279
|
+
var _this24 = this;
|
|
118280
|
+
if (!this.scene) return;
|
|
118270
118281
|
if (Array.isArray(name)) {
|
|
118271
118282
|
var box3 = new this.THREE.Box3();
|
|
118272
118283
|
name.forEach(function (n) {
|
|
118273
|
-
var arr =
|
|
118284
|
+
var arr = _this24.getObjectByName(n);
|
|
118274
118285
|
arr.forEach(function (o) {
|
|
118275
118286
|
box3.expandByObject(o);
|
|
118276
118287
|
});
|
|
@@ -118286,7 +118297,7 @@ var isDebug = false || false === true;
|
|
|
118286
118297
|
}
|
|
118287
118298
|
var obj = this.getObjectByName(name)[0];
|
|
118288
118299
|
if (obj) {
|
|
118289
|
-
// cameraControls.fitToSphere(obj.parent, true); // TODO 待处理,先用 setModelCenter 进行定位
|
|
118300
|
+
// this.cameraControls.fitToSphere(obj.parent, true); // TODO 待处理,先用 setModelCenter 进行定位
|
|
118290
118301
|
if (obj.isGroup) {
|
|
118291
118302
|
this.setModelCenter(obj);
|
|
118292
118303
|
} else if (obj.isMesh) {
|
|
@@ -118310,14 +118321,14 @@ var isDebug = false || false === true;
|
|
|
118310
118321
|
}
|
|
118311
118322
|
*/
|
|
118312
118323
|
updatePropertyByCustom: function updatePropertyByCustom(params) {
|
|
118313
|
-
var
|
|
118314
|
-
if (!
|
|
118315
|
-
|
|
118324
|
+
var _this25 = this;
|
|
118325
|
+
if (!this.scene) return;
|
|
118326
|
+
this.scene.traverse(function (child) {
|
|
118316
118327
|
if (child.isMesh && child.userData[params.customName] === params.customValue) {
|
|
118317
118328
|
for (var key in params.attr) {
|
|
118318
118329
|
switch (key) {
|
|
118319
118330
|
case 'color':
|
|
118320
|
-
child.setColorAt(obj.userData.instanceIndex, new
|
|
118331
|
+
child.setColorAt(obj.userData.instanceIndex, new _this25.THREE.Color(params.attr[key]));
|
|
118321
118332
|
child.instanceColor.needsUpdate = true;
|
|
118322
118333
|
break;
|
|
118323
118334
|
case 'visible':
|
|
@@ -118342,8 +118353,8 @@ var isDebug = false || false === true;
|
|
|
118342
118353
|
cameraLocation: function cameraLocation(params) {
|
|
118343
118354
|
var _params$enableTransit = params.enableTransition,
|
|
118344
118355
|
enableTransition = _params$enableTransit === void 0 ? true : _params$enableTransit;
|
|
118345
|
-
cameraControls.setLookAt(params.x, params.y, params.z, params.heading, params.pitch, params.roll, enableTransition);
|
|
118346
|
-
cameraControls.update(0);
|
|
118356
|
+
this.cameraControls.setLookAt(params.x, params.y, params.z, params.heading, params.pitch, params.roll, enableTransition);
|
|
118357
|
+
this.cameraControls.update(0);
|
|
118347
118358
|
},
|
|
118348
118359
|
// 使用中心点和实体的长宽高进行定位
|
|
118349
118360
|
/*
|
|
@@ -118357,7 +118368,7 @@ var isDebug = false || false === true;
|
|
|
118357
118368
|
var viewAll = options && options.viewAll || false;
|
|
118358
118369
|
var maxDim = Math.max(size.x, size.y, size.z);
|
|
118359
118370
|
var minDim = Math.min(size.x, size.y, size.z);
|
|
118360
|
-
var fov =
|
|
118371
|
+
var fov = this.camera.fov * (Math.PI / 180);
|
|
118361
118372
|
// let baseDistance = viewAll
|
|
118362
118373
|
// ? Math.abs((minDim * 1.0) / Math.sin(fov / 2))
|
|
118363
118374
|
// : Math.abs((maxDim * 1.0) / Math.sin(fov / 2));
|
|
@@ -118366,7 +118377,7 @@ var isDebug = false || false === true;
|
|
|
118366
118377
|
var direction = new this.THREE.Vector3(1, 1, 1).normalize();
|
|
118367
118378
|
var p = new this.THREE.Vector3().copy(center).add(direction.multiplyScalar(distance));
|
|
118368
118379
|
var cameraCenter = viewAll ? new this.THREE.Vector3(p.x, p.y, p.z) : new this.THREE.Vector3(p.x, p.y, p.z).addScalar(Math.max(size.x, size.y, size.z));
|
|
118369
|
-
cameraControls.setLookAt(cameraCenter.x, cameraCenter.y, cameraCenter.z, center.x, center.y, center.z, true);
|
|
118380
|
+
this.cameraControls.setLookAt(cameraCenter.x, cameraCenter.y, cameraCenter.z, center.x, center.y, center.z, true);
|
|
118370
118381
|
},
|
|
118371
118382
|
// 添加广告牌
|
|
118372
118383
|
/*
|
|
@@ -118378,11 +118389,11 @@ var isDebug = false || false === true;
|
|
|
118378
118389
|
}
|
|
118379
118390
|
*/
|
|
118380
118391
|
billboard: function billboard(data) {
|
|
118381
|
-
if (!
|
|
118392
|
+
if (!this.scene) return null;
|
|
118382
118393
|
var divLabel = new CSS2DRenderer_CSS2DObject(data.billboard);
|
|
118383
118394
|
divLabel.name = data.labelClass; // 这个是用来清除广告牌用的
|
|
118384
118395
|
divLabel.position.set(data.x, data.y, data.z);
|
|
118385
|
-
|
|
118396
|
+
this.scene.add(divLabel);
|
|
118386
118397
|
return divLabel;
|
|
118387
118398
|
},
|
|
118388
118399
|
// 通过名字获取实体对象, 返回数组
|
|
@@ -118392,10 +118403,10 @@ var isDebug = false || false === true;
|
|
|
118392
118403
|
*/
|
|
118393
118404
|
getObjectByName: function getObjectByName(name) {
|
|
118394
118405
|
var passType = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'group';
|
|
118395
|
-
if (!
|
|
118406
|
+
if (!this.scene) return [];
|
|
118396
118407
|
var object = [];
|
|
118397
118408
|
var instancedMeshProps = instanceToInstancedMeshMap.get(name);
|
|
118398
|
-
|
|
118409
|
+
this.scene.traverse(function (item) {
|
|
118399
118410
|
var tempName = instancedMeshProps ? instancedMeshProps.drawObjectId : name;
|
|
118400
118411
|
if (item.name == tempName && item.type.toLowerCase() != passType.toLowerCase()) {
|
|
118401
118412
|
object.push(item);
|
|
@@ -118405,20 +118416,20 @@ var isDebug = false || false === true;
|
|
|
118405
118416
|
},
|
|
118406
118417
|
// 通过id获取实体对象, 返回查找到的对象
|
|
118407
118418
|
getObjectById: function getObjectById(id) {
|
|
118408
|
-
if (!
|
|
118409
|
-
return
|
|
118419
|
+
if (!this.scene) return null;
|
|
118420
|
+
return this.scene.getObjectById(id);
|
|
118410
118421
|
},
|
|
118411
118422
|
getColorConfig: function getColorConfig() {
|
|
118412
118423
|
var modelState = this.noObserver ? this.noObserver.modelStateManager : this.modelStateManager;
|
|
118413
118424
|
return modelState.colorConfig;
|
|
118414
118425
|
},
|
|
118415
118426
|
addBypassCullingModelIds: function addBypassCullingModelIds(modelIds) {
|
|
118416
|
-
var
|
|
118427
|
+
var _this26 = this;
|
|
118417
118428
|
var modelState = this.noObserver ? this.noObserver.modelStateManager : this.modelStateManager;
|
|
118418
118429
|
if (!modelIds) return;
|
|
118419
118430
|
if (Array.isArray(modelIds)) {
|
|
118420
118431
|
modelIds.forEach(function (id) {
|
|
118421
|
-
var modelId =
|
|
118432
|
+
var modelId = _this26.formatModelId(id);
|
|
118422
118433
|
modelState.bypassCullingModelIds.add(modelId);
|
|
118423
118434
|
});
|
|
118424
118435
|
} else {
|
|
@@ -118431,12 +118442,12 @@ var isDebug = false || false === true;
|
|
|
118431
118442
|
return com_graphicsvue_type_script_lang_js_toConsumableArray(modelState.bypassCullingModelIds);
|
|
118432
118443
|
},
|
|
118433
118444
|
removeBypassCullingModelIds: function removeBypassCullingModelIds(modelIds) {
|
|
118434
|
-
var
|
|
118445
|
+
var _this27 = this;
|
|
118435
118446
|
var modelState = this.noObserver ? this.noObserver.modelStateManager : this.modelStateManager;
|
|
118436
118447
|
if (!modelIds) return;
|
|
118437
118448
|
if (Array.isArray(modelIds)) {
|
|
118438
118449
|
modelIds.forEach(function (id) {
|
|
118439
|
-
var modelId =
|
|
118450
|
+
var modelId = _this27.formatModelId(id);
|
|
118440
118451
|
modelState.bypassCullingModelIds.delete(modelId);
|
|
118441
118452
|
});
|
|
118442
118453
|
} else {
|
|
@@ -118450,7 +118461,8 @@ var isDebug = false || false === true;
|
|
|
118450
118461
|
},
|
|
118451
118462
|
// 通过id删除对象
|
|
118452
118463
|
removeObjectById: function removeObjectById(id) {
|
|
118453
|
-
|
|
118464
|
+
var _this28 = this;
|
|
118465
|
+
if (!this.scene) return;
|
|
118454
118466
|
var array = this.getObjectByName(id);
|
|
118455
118467
|
array.forEach(function (item) {
|
|
118456
118468
|
if (item.name === id) {
|
|
@@ -118459,13 +118471,14 @@ var isDebug = false || false === true;
|
|
|
118459
118471
|
if (item.isMesh) {
|
|
118460
118472
|
item.clear();
|
|
118461
118473
|
}
|
|
118462
|
-
|
|
118474
|
+
_this28.scene.remove(item);
|
|
118463
118475
|
}
|
|
118464
118476
|
});
|
|
118465
118477
|
},
|
|
118466
118478
|
// 通过名称删除对象
|
|
118467
118479
|
removeObjectByName: function removeObjectByName(name) {
|
|
118468
|
-
|
|
118480
|
+
var _this29 = this;
|
|
118481
|
+
if (!this.scene) return;
|
|
118469
118482
|
var array = this.getObjectByName(name);
|
|
118470
118483
|
array.forEach(function (item) {
|
|
118471
118484
|
item.material && item.material.dispose();
|
|
@@ -118473,16 +118486,16 @@ var isDebug = false || false === true;
|
|
|
118473
118486
|
if (item.isMesh) {
|
|
118474
118487
|
item.clear();
|
|
118475
118488
|
}
|
|
118476
|
-
if (
|
|
118489
|
+
if (_this29.scene) _this29.scene.remove(item);
|
|
118477
118490
|
});
|
|
118478
118491
|
},
|
|
118479
118492
|
// 删除场景中所有的实体
|
|
118480
118493
|
removeAll: function removeAll() {
|
|
118481
|
-
var
|
|
118494
|
+
var _this30 = this;
|
|
118482
118495
|
return new Promise(function (resolve) {
|
|
118483
|
-
if (
|
|
118484
|
-
|
|
118485
|
-
|
|
118496
|
+
if (_this30.scene) {
|
|
118497
|
+
_this30.removeTraverse();
|
|
118498
|
+
_this30.removeModelByDocumentId();
|
|
118486
118499
|
resolve();
|
|
118487
118500
|
} else {
|
|
118488
118501
|
resolve();
|
|
@@ -118490,10 +118503,11 @@ var isDebug = false || false === true;
|
|
|
118490
118503
|
});
|
|
118491
118504
|
},
|
|
118492
118505
|
removeTraverse: function removeTraverse() {
|
|
118493
|
-
|
|
118494
|
-
|
|
118506
|
+
var _this31 = this;
|
|
118507
|
+
if (!this.modelGroup) return;
|
|
118508
|
+
var length = this.modelGroup.children.length;
|
|
118495
118509
|
if (length > 0) {
|
|
118496
|
-
var list = modelGroup.children[0];
|
|
118510
|
+
var list = this.modelGroup.children[0];
|
|
118497
118511
|
if (!list) return;
|
|
118498
118512
|
list.traverse(function (item) {
|
|
118499
118513
|
if (item.isMesh) {
|
|
@@ -118502,40 +118516,41 @@ var isDebug = false || false === true;
|
|
|
118502
118516
|
item.clear();
|
|
118503
118517
|
item.material = null;
|
|
118504
118518
|
item.geometry = null;
|
|
118505
|
-
modelGroup && modelGroup.remove(item);
|
|
118519
|
+
_this31.modelGroup && _this31.modelGroup.remove(item);
|
|
118506
118520
|
item = null;
|
|
118507
118521
|
}
|
|
118508
118522
|
});
|
|
118509
|
-
modelGroup && modelGroup.remove(list);
|
|
118523
|
+
this.modelGroup && this.modelGroup.remove(list);
|
|
118510
118524
|
this.removeTraverse();
|
|
118511
118525
|
} else {
|
|
118512
118526
|
// 在这里清除一些标记之类的
|
|
118513
|
-
modelGroup.clear();
|
|
118514
|
-
|
|
118515
|
-
|
|
118516
|
-
modelGroup = null;
|
|
118517
|
-
modelGroup = new this.THREE.Group();
|
|
118527
|
+
this.modelGroup.clear();
|
|
118528
|
+
this.scene.remove(this.modelGroup);
|
|
118529
|
+
this.renderer.clear();
|
|
118530
|
+
this.modelGroup = null;
|
|
118531
|
+
this.modelGroup = new this.THREE.Group();
|
|
118518
118532
|
}
|
|
118519
118533
|
},
|
|
118520
118534
|
// 销毁场景 释放内存
|
|
118521
118535
|
destroyScene: function destroyScene() {
|
|
118522
|
-
|
|
118536
|
+
var _this32 = this;
|
|
118537
|
+
cancelAnimationFrame(this.animateId);
|
|
118523
118538
|
if (this.noObserver && this.noObserver.outlineInstanceProxyMap) {
|
|
118524
118539
|
this.noObserver.outlineInstanceProxyMap.forEach(function (proxy) {
|
|
118525
|
-
if (outlinePass) {
|
|
118526
|
-
var idx = outlinePass.selectedObjects.indexOf(proxy);
|
|
118527
|
-
if (idx !== -1) outlinePass.selectedObjects.splice(idx, 1);
|
|
118540
|
+
if (_this32.outlinePass) {
|
|
118541
|
+
var idx = _this32.outlinePass.selectedObjects.indexOf(proxy);
|
|
118542
|
+
if (idx !== -1) _this32.outlinePass.selectedObjects.splice(idx, 1);
|
|
118528
118543
|
}
|
|
118529
|
-
if (
|
|
118544
|
+
if (_this32.scene) _this32.scene.remove(proxy);
|
|
118530
118545
|
if (proxy && proxy.material && proxy.material.dispose) proxy.material.dispose();
|
|
118531
118546
|
});
|
|
118532
118547
|
this.noObserver.outlineInstanceProxyMap.clear();
|
|
118533
118548
|
}
|
|
118534
118549
|
this.batchLoadingState = this.noObserver ? this.noObserver.batchLoadingState : this.batchLoadingState;
|
|
118535
118550
|
// 清理防抖定时器和重置状态
|
|
118536
|
-
if (centeringDebounceTimer) {
|
|
118537
|
-
clearTimeout(centeringDebounceTimer);
|
|
118538
|
-
centeringDebounceTimer = null;
|
|
118551
|
+
if (this.centeringDebounceTimer) {
|
|
118552
|
+
clearTimeout(this.centeringDebounceTimer);
|
|
118553
|
+
this.centeringDebounceTimer = null;
|
|
118539
118554
|
}
|
|
118540
118555
|
|
|
118541
118556
|
// 清理渲染暂停/恢复相关的定时器
|
|
@@ -118552,9 +118567,9 @@ var isDebug = false || false === true;
|
|
|
118552
118567
|
|
|
118553
118568
|
// 停止批量加载
|
|
118554
118569
|
this.stopBatchLoading();
|
|
118555
|
-
hasExecutedCentering = false;
|
|
118556
|
-
needsCenteringAfterInteraction = false;
|
|
118557
|
-
userInteracting = false;
|
|
118570
|
+
this.hasExecutedCentering = false;
|
|
118571
|
+
this.needsCenteringAfterInteraction = false;
|
|
118572
|
+
this.userInteracting = false;
|
|
118558
118573
|
|
|
118559
118574
|
// 关闭视椎体裁切并清理防抖定时器
|
|
118560
118575
|
this.modelStateManager.frustumCheckEnabled = false;
|
|
@@ -118563,36 +118578,36 @@ var isDebug = false || false === true;
|
|
|
118563
118578
|
this.modelStateManager.debounceTimer = null;
|
|
118564
118579
|
}
|
|
118565
118580
|
this.clearBypassCullingModelIds();
|
|
118566
|
-
if (
|
|
118581
|
+
if (this.scene) {
|
|
118567
118582
|
this.removeTraverse();
|
|
118568
|
-
|
|
118569
|
-
|
|
118583
|
+
this.scene.clear();
|
|
118584
|
+
this.scene = null;
|
|
118570
118585
|
}
|
|
118571
118586
|
|
|
118572
118587
|
// 移除滚轮事件监听器
|
|
118573
|
-
if (
|
|
118574
|
-
|
|
118588
|
+
if (this.renderer && this.renderer.domElement && this._wheelHandler) {
|
|
118589
|
+
this.renderer.domElement.removeEventListener('wheel', this._wheelHandler);
|
|
118575
118590
|
this._wheelHandler = null;
|
|
118576
118591
|
}
|
|
118577
118592
|
|
|
118578
118593
|
// 移除鼠标点击/按下事件监听器
|
|
118579
|
-
if (
|
|
118580
|
-
|
|
118581
|
-
|
|
118582
|
-
|
|
118583
|
-
|
|
118594
|
+
if (this.renderer && this.renderer.domElement) {
|
|
118595
|
+
this.renderer.domElement.removeEventListener('mouseup', this.mouseClick, false);
|
|
118596
|
+
this.renderer.domElement.removeEventListener('mousedown', this.mouseDown, false);
|
|
118597
|
+
this.renderer.domElement.removeEventListener('pointerup', this.mouseClick, false);
|
|
118598
|
+
this.renderer.domElement.removeEventListener('pointerdown', this.mouseDown, false);
|
|
118584
118599
|
}
|
|
118585
118600
|
|
|
118586
118601
|
// 取消 pointer lock 并移除相关键盘事件
|
|
118587
|
-
if (pointControls) {
|
|
118602
|
+
if (this.pointControls) {
|
|
118588
118603
|
if (this._onFirstPersonChange) {
|
|
118589
118604
|
try {
|
|
118590
|
-
pointControls.removeEventListener('change', this._onFirstPersonChange);
|
|
118605
|
+
this.pointControls.removeEventListener('change', this._onFirstPersonChange);
|
|
118591
118606
|
} catch (e) {}
|
|
118592
118607
|
this._onFirstPersonChange = null;
|
|
118593
118608
|
}
|
|
118594
118609
|
try {
|
|
118595
|
-
pointControls.unlock && pointControls.unlock();
|
|
118610
|
+
this.pointControls.unlock && this.pointControls.unlock();
|
|
118596
118611
|
} catch (e) {}
|
|
118597
118612
|
}
|
|
118598
118613
|
if (this.noObserver) {
|
|
@@ -118603,35 +118618,35 @@ var isDebug = false || false === true;
|
|
|
118603
118618
|
document.removeEventListener('keydown', this.handleMeasureKeyDown, false);
|
|
118604
118619
|
|
|
118605
118620
|
// 关闭测量工具
|
|
118606
|
-
if (threeMeasure) {
|
|
118621
|
+
if (this.threeMeasure) {
|
|
118607
118622
|
try {
|
|
118608
|
-
threeMeasure.close && threeMeasure.close();
|
|
118623
|
+
this.threeMeasure.close && this.threeMeasure.close();
|
|
118609
118624
|
} catch (e) {}
|
|
118610
|
-
threeMeasure = null;
|
|
118625
|
+
this.threeMeasure = null;
|
|
118611
118626
|
}
|
|
118612
118627
|
|
|
118613
|
-
// 移除 cameraControls 事件监听
|
|
118614
|
-
if (cameraControls) {
|
|
118615
|
-
if (this._onControlStart) cameraControls.removeEventListener('controlstart', this._onControlStart);
|
|
118616
|
-
if (this._onControlEnd) cameraControls.removeEventListener('controlend', this._onControlEnd);
|
|
118628
|
+
// 移除 this.cameraControls 事件监听
|
|
118629
|
+
if (this.cameraControls) {
|
|
118630
|
+
if (this._onControlStart) this.cameraControls.removeEventListener('controlstart', this._onControlStart);
|
|
118631
|
+
if (this._onControlEnd) this.cameraControls.removeEventListener('controlend', this._onControlEnd);
|
|
118617
118632
|
this._onControlStart = null;
|
|
118618
118633
|
this._onControlEnd = null;
|
|
118619
118634
|
}
|
|
118620
118635
|
|
|
118621
118636
|
// 清理 Label 渲染器 DOM
|
|
118622
|
-
if (labelRenderer && labelRenderer.domElement && instructions) {
|
|
118637
|
+
if (this.labelRenderer && this.labelRenderer.domElement && this.instructions) {
|
|
118623
118638
|
try {
|
|
118624
|
-
instructions.removeChild(labelRenderer.domElement);
|
|
118639
|
+
this.instructions.removeChild(this.labelRenderer.domElement);
|
|
118625
118640
|
} catch (e) {}
|
|
118626
118641
|
}
|
|
118627
|
-
labelRenderer = null;
|
|
118628
|
-
|
|
118629
|
-
|
|
118630
|
-
|
|
118631
|
-
cameraControls = null;
|
|
118632
|
-
pointControls = null;
|
|
118633
|
-
|
|
118634
|
-
|
|
118642
|
+
this.labelRenderer = null;
|
|
118643
|
+
this.renderer.forceContextLoss();
|
|
118644
|
+
this.renderer.dispose();
|
|
118645
|
+
this.camera = null;
|
|
118646
|
+
this.cameraControls = null;
|
|
118647
|
+
this.pointControls = null;
|
|
118648
|
+
this.renderer.domElement = null;
|
|
118649
|
+
this.renderer = null;
|
|
118635
118650
|
},
|
|
118636
118651
|
// 绘制曲线
|
|
118637
118652
|
/*
|
|
@@ -118643,15 +118658,15 @@ var isDebug = false || false === true;
|
|
|
118643
118658
|
}
|
|
118644
118659
|
*/
|
|
118645
118660
|
drawCurve: function drawCurve(params) {
|
|
118646
|
-
var
|
|
118661
|
+
var _this33 = this;
|
|
118647
118662
|
this.removeObjectByName(params.name);
|
|
118648
118663
|
var route = [];
|
|
118649
118664
|
params.path.forEach(function (element) {
|
|
118650
|
-
route.push(new
|
|
118665
|
+
route.push(new _this33.THREE.Vector3(element.x, element.y, element.z));
|
|
118651
118666
|
});
|
|
118652
118667
|
if (route.length > 1) {
|
|
118653
|
-
|
|
118654
|
-
var geometryLine = new this.THREE.BufferGeometry().setFromPoints(
|
|
118668
|
+
this.curve = new this.THREE.CatmullRomCurve3(route);
|
|
118669
|
+
var geometryLine = new this.THREE.BufferGeometry().setFromPoints(this.curve.getPoints(5000));
|
|
118655
118670
|
var materialLine = new this.THREE.LineBasicMaterial({
|
|
118656
118671
|
color: params.color,
|
|
118657
118672
|
depthTest: false,
|
|
@@ -118659,7 +118674,7 @@ var isDebug = false || false === true;
|
|
|
118659
118674
|
});
|
|
118660
118675
|
var line = new this.THREE.Line(geometryLine, materialLine);
|
|
118661
118676
|
line.name = params.name;
|
|
118662
|
-
if (
|
|
118677
|
+
if (this.scene) this.scene.add(line);
|
|
118663
118678
|
}
|
|
118664
118679
|
},
|
|
118665
118680
|
// 绘制贴图曲线
|
|
@@ -118671,34 +118686,34 @@ var isDebug = false || false === true;
|
|
|
118671
118686
|
}
|
|
118672
118687
|
*/
|
|
118673
118688
|
drawTextureCurve: function drawTextureCurve(params) {
|
|
118674
|
-
var
|
|
118689
|
+
var _this34 = this;
|
|
118675
118690
|
this.removeObjectByName(params.name);
|
|
118676
118691
|
var route = [];
|
|
118677
118692
|
params.path.forEach(function (element) {
|
|
118678
|
-
route.push(new
|
|
118693
|
+
route.push(new _this34.THREE.Vector3(element.x, element.y, element.z));
|
|
118679
118694
|
});
|
|
118680
118695
|
// 画曲线
|
|
118681
118696
|
if (route.length > 1) {
|
|
118682
118697
|
// 曲线 作为路径
|
|
118683
|
-
|
|
118684
|
-
var geometry = new this.THREE.TubeGeometry(
|
|
118698
|
+
this.curve = new this.THREE.CatmullRomCurve3(route, false, 'catmullrom', 0);
|
|
118699
|
+
var geometry = new this.THREE.TubeGeometry(this.curve, 5000, 0.5, 4);
|
|
118685
118700
|
//加载纹理
|
|
118686
|
-
lineTexture = new this.THREE.TextureLoader().load('/static/arrow/arrow-right.png');
|
|
118687
|
-
lineTexture.wrapS = this.THREE.RepeatWrapping;
|
|
118688
|
-
lineTexture.wrapT = this.THREE.RepeatWrapping;
|
|
118689
|
-
lineTexture.repeat.set(20, 1); //水平重复20次
|
|
118690
|
-
lineTexture.needsUpdate = true;
|
|
118691
|
-
lineTexture.offset.y = 0.5;
|
|
118701
|
+
this.lineTexture = new this.THREE.TextureLoader().load('/static/arrow/arrow-right.png');
|
|
118702
|
+
this.lineTexture.wrapS = this.THREE.RepeatWrapping;
|
|
118703
|
+
this.lineTexture.wrapT = this.THREE.RepeatWrapping;
|
|
118704
|
+
this.lineTexture.repeat.set(20, 1); //水平重复20次
|
|
118705
|
+
this.lineTexture.needsUpdate = true;
|
|
118706
|
+
this.lineTexture.offset.y = 0.5;
|
|
118692
118707
|
var material = new this.THREE.MeshBasicMaterial({
|
|
118693
|
-
map: lineTexture,
|
|
118708
|
+
map: this.lineTexture,
|
|
118694
118709
|
side: this.THREE.BackSide,
|
|
118695
118710
|
//显示背面
|
|
118696
118711
|
transparent: true
|
|
118697
118712
|
});
|
|
118698
118713
|
var line = new this.THREE.Line(geometry, material);
|
|
118699
118714
|
line.name = params.name;
|
|
118700
|
-
if (
|
|
118701
|
-
clock = new this.THREE.Clock();
|
|
118715
|
+
if (this.scene) this.scene.add(line);
|
|
118716
|
+
this.clock = new this.THREE.Clock();
|
|
118702
118717
|
}
|
|
118703
118718
|
},
|
|
118704
118719
|
//
|
|
@@ -118711,8 +118726,8 @@ var isDebug = false || false === true;
|
|
|
118711
118726
|
name: '', 路径的名称,用来清除用的
|
|
118712
118727
|
*/
|
|
118713
118728
|
startRoam: function startRoam(params) {
|
|
118714
|
-
progress = 0;
|
|
118715
|
-
roamConfig = {
|
|
118729
|
+
this.progress = 0;
|
|
118730
|
+
this.roamConfig = {
|
|
118716
118731
|
loop: params.loop,
|
|
118717
118732
|
speed: params.speed
|
|
118718
118733
|
};
|
|
@@ -118720,7 +118735,7 @@ var isDebug = false || false === true;
|
|
|
118720
118735
|
name: params.name,
|
|
118721
118736
|
path: params.path
|
|
118722
118737
|
});
|
|
118723
|
-
roaming = true;
|
|
118738
|
+
this.roaming = true;
|
|
118724
118739
|
},
|
|
118725
118740
|
// 更新漫游的配置
|
|
118726
118741
|
/*
|
|
@@ -118728,51 +118743,51 @@ var isDebug = false || false === true;
|
|
|
118728
118743
|
*/
|
|
118729
118744
|
updateRoamConfig: function updateRoamConfig(params) {
|
|
118730
118745
|
for (var key in params) {
|
|
118731
|
-
roamConfig[key] = params[key];
|
|
118746
|
+
this.roamConfig[key] = params[key];
|
|
118732
118747
|
}
|
|
118733
118748
|
},
|
|
118734
118749
|
// 结束/退出漫游
|
|
118735
118750
|
endRoam: function endRoam() {
|
|
118736
|
-
roaming = false;
|
|
118737
|
-
progress = 0;
|
|
118738
|
-
this.removeObjectByName(roamConfig.name);
|
|
118739
|
-
roamConfig = {
|
|
118751
|
+
this.roaming = false;
|
|
118752
|
+
this.progress = 0;
|
|
118753
|
+
this.removeObjectByName(this.roamConfig.name);
|
|
118754
|
+
this.roamConfig = {
|
|
118740
118755
|
loop: false,
|
|
118741
118756
|
speed: 0,
|
|
118742
118757
|
name: ''
|
|
118743
118758
|
};
|
|
118744
|
-
roaming = false;
|
|
118745
|
-
lineTexture = null;
|
|
118759
|
+
this.roaming = false;
|
|
118760
|
+
this.lineTexture = null;
|
|
118746
118761
|
},
|
|
118747
118762
|
// 相机跟随轨道
|
|
118748
118763
|
cameraTrack: function cameraTrack() {
|
|
118749
|
-
if (roaming) {
|
|
118764
|
+
if (this.roaming) {
|
|
118750
118765
|
// renderEnabled = true
|
|
118751
|
-
lineTexture.offset.x -= 0.05;
|
|
118766
|
+
this.lineTexture.offset.x -= 0.05;
|
|
118752
118767
|
// 相机和控制器的偏移
|
|
118753
|
-
var offset = 10 /
|
|
118754
|
-
// progress 取值范围为0~1。getPoint(0)表示曲线起点,getPoint(1)表示曲线终点
|
|
118755
|
-
if (progress <= 1 - offset) {
|
|
118768
|
+
var offset = 10 / this.curve.getLength();
|
|
118769
|
+
// this.progress 取值范围为0~1。getPoint(0)表示曲线起点,getPoint(1)表示曲线终点
|
|
118770
|
+
if (this.progress <= 1 - offset) {
|
|
118756
118771
|
// this.timeRender()
|
|
118757
|
-
var point =
|
|
118758
|
-
var pointBox =
|
|
118759
|
-
|
|
118760
|
-
|
|
118761
|
-
cameraControls.setPosition(point.x, point.y + 5, point.z, false);
|
|
118762
|
-
cameraControls.setTarget(pointBox.x, pointBox.y + 5, pointBox.z, false);
|
|
118763
|
-
progress += roamConfig.speed / 300;
|
|
118772
|
+
var point = this.curve.getPointAt(this.progress);
|
|
118773
|
+
var pointBox = this.curve.getPointAt(this.progress + offset);
|
|
118774
|
+
this.camera.position.set(point.x, point.y + 5, point.z);
|
|
118775
|
+
this.camera.lookAt(pointBox.x, pointBox.y + 5, pointBox.z);
|
|
118776
|
+
this.cameraControls.setPosition(point.x, point.y + 5, point.z, false);
|
|
118777
|
+
this.cameraControls.setTarget(pointBox.x, pointBox.y + 5, pointBox.z, false);
|
|
118778
|
+
this.progress += this.roamConfig.speed / 300;
|
|
118764
118779
|
if (typeof this._cameraChangeObserver === 'function') {
|
|
118765
118780
|
this._cameraChangeObserver('roam');
|
|
118766
118781
|
}
|
|
118767
118782
|
} else {
|
|
118768
118783
|
// 循环漫游
|
|
118769
|
-
if (roamConfig.loop) {
|
|
118770
|
-
progress = 0;
|
|
118784
|
+
if (this.roamConfig.loop) {
|
|
118785
|
+
this.progress = 0;
|
|
118771
118786
|
}
|
|
118772
118787
|
}
|
|
118773
118788
|
} else {
|
|
118774
|
-
lineTexture = null;
|
|
118775
|
-
progress = 0;
|
|
118789
|
+
this.lineTexture = null;
|
|
118790
|
+
this.progress = 0;
|
|
118776
118791
|
}
|
|
118777
118792
|
},
|
|
118778
118793
|
// 全局整体炸开
|
|
@@ -118780,14 +118795,14 @@ var isDebug = false || false === true;
|
|
|
118780
118795
|
* 参数val: 爆炸的值
|
|
118781
118796
|
*/
|
|
118782
118797
|
globalBomb: function globalBomb(val) {
|
|
118783
|
-
var
|
|
118784
|
-
if (
|
|
118785
|
-
for (var i = 0; i <
|
|
118786
|
-
console.log('scene',
|
|
118787
|
-
|
|
118798
|
+
var _this35 = this;
|
|
118799
|
+
if (this.scene.children.length === 0) return;
|
|
118800
|
+
for (var i = 0; i < this.scene.children.length; i++) {
|
|
118801
|
+
console.log('this.scene', this.scene);
|
|
118802
|
+
this.scene.children[i].traverse(function (item) {
|
|
118788
118803
|
if (!item.isMesh || !item.worldDir) return;
|
|
118789
118804
|
// 爆炸公式
|
|
118790
|
-
|
|
118805
|
+
_this35.computedBomb(item, val);
|
|
118791
118806
|
});
|
|
118792
118807
|
}
|
|
118793
118808
|
// this.timeRender();
|
|
@@ -118813,7 +118828,7 @@ var isDebug = false || false === true;
|
|
|
118813
118828
|
},
|
|
118814
118829
|
getClippingPlanes: function getClippingPlanes() {
|
|
118815
118830
|
var clippingPlanesConstant = [];
|
|
118816
|
-
|
|
118831
|
+
this.renderer.clippingPlanes.forEach(function (item) {
|
|
118817
118832
|
clippingPlanesConstant.push(item.constant);
|
|
118818
118833
|
});
|
|
118819
118834
|
return clippingPlanesConstant;
|
|
@@ -118825,14 +118840,14 @@ var isDebug = false || false === true;
|
|
|
118825
118840
|
*/
|
|
118826
118841
|
setGlobalClipping: function setGlobalClipping() {
|
|
118827
118842
|
var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
118828
|
-
var box3 = new this.THREE.Box3().setFromObject(
|
|
118843
|
+
var box3 = new this.THREE.Box3().setFromObject(this.scene.children[0]);
|
|
118829
118844
|
var max = box3.max;
|
|
118830
118845
|
var min = box3.min;
|
|
118831
118846
|
var clippingPlanes = [new this.THREE.Plane(new this.THREE.Vector3(-1, 0, 0), this.clippingPlanesConstants ? this.clippingPlanesConstants[0] : Math.ceil(max.x)), new this.THREE.Plane(new this.THREE.Vector3(0, -1, 0), this.clippingPlanesConstants ? this.clippingPlanesConstants[1] : Math.ceil(max.y)), new this.THREE.Plane(new this.THREE.Vector3(0, 0, -1), this.clippingPlanesConstants ? this.clippingPlanesConstants[2] : Math.ceil(max.z)), new this.THREE.Plane(new this.THREE.Vector3(1, 0, 0), this.clippingPlanesConstants ? this.clippingPlanesConstants[3] : Math.ceil(-min.x)), new this.THREE.Plane(new this.THREE.Vector3(0, 1, 0), this.clippingPlanesConstants ? this.clippingPlanesConstants[4] : Math.ceil(-min.y)), new this.THREE.Plane(new this.THREE.Vector3(0, 0, 1), this.clippingPlanesConstants ? this.clippingPlanesConstants[5] : Math.ceil(-min.z))];
|
|
118832
|
-
|
|
118847
|
+
this.renderer.clippingPlanes = clippingPlanes;
|
|
118833
118848
|
if (flag) {
|
|
118834
118849
|
// 全局剖切的初始值
|
|
118835
|
-
guiParams = {
|
|
118850
|
+
this.guiParams = {
|
|
118836
118851
|
x轴: Math.ceil(clippingPlanes[0].constant),
|
|
118837
118852
|
y轴: Math.ceil(clippingPlanes[2].constant),
|
|
118838
118853
|
z轴: Math.ceil(clippingPlanes[1].constant),
|
|
@@ -118870,13 +118885,13 @@ var isDebug = false || false === true;
|
|
|
118870
118885
|
z: 2
|
|
118871
118886
|
};
|
|
118872
118887
|
for (var key in params) {
|
|
118873
|
-
|
|
118888
|
+
this.renderer.clippingPlanes[axis[key]].constant = params[key];
|
|
118874
118889
|
}
|
|
118875
118890
|
// this.timeRender()
|
|
118876
118891
|
},
|
|
118877
118892
|
// 取消全局剖切
|
|
118878
118893
|
cancelGlobalClipping: function cancelGlobalClipping() {
|
|
118879
|
-
guiParams = {
|
|
118894
|
+
this.guiParams = {
|
|
118880
118895
|
x轴: 0,
|
|
118881
118896
|
y轴: 0,
|
|
118882
118897
|
z轴: 0,
|
|
@@ -118885,15 +118900,15 @@ var isDebug = false || false === true;
|
|
|
118885
118900
|
'-z轴': 0
|
|
118886
118901
|
};
|
|
118887
118902
|
this.clippingPlanesConstants = null;
|
|
118888
|
-
|
|
118889
|
-
gui && gui.destroy();
|
|
118903
|
+
this.renderer.clippingPlanes = Object.freeze([]);
|
|
118904
|
+
this.gui && this.gui.destroy();
|
|
118890
118905
|
},
|
|
118891
118906
|
// 单个实体的剖切/ 局部剖切 obj 实体对象 flag 代表是否使用图形组件自带的剖切面板 默认为true
|
|
118892
118907
|
setLocalClipping: function setLocalClipping(obj) {
|
|
118893
118908
|
var flag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
118894
|
-
clippingMesh.splice(0);
|
|
118895
|
-
clippingMesh.push(obj);
|
|
118896
|
-
|
|
118909
|
+
this.clippingMesh.splice(0);
|
|
118910
|
+
this.clippingMesh.push(obj);
|
|
118911
|
+
this.renderer.localClippingEnabled = true;
|
|
118897
118912
|
// mesh的boundingBox 可以获取到该对象位置的最大最小值 但是在这里我们需要把y、z轴互换
|
|
118898
118913
|
var boundingBox = new this.THREE.Box3().copy(obj.boundingBox);
|
|
118899
118914
|
boundingBox.applyMatrix4(obj.matrixWorld);
|
|
@@ -118902,7 +118917,7 @@ var isDebug = false || false === true;
|
|
|
118902
118917
|
obj.material.needsUpdate = true;
|
|
118903
118918
|
// 将局部剖切的对象记录下来
|
|
118904
118919
|
if (flag) {
|
|
118905
|
-
guiParams = {
|
|
118920
|
+
this.guiParams = {
|
|
118906
118921
|
x轴: clippingPlanes[0].constant,
|
|
118907
118922
|
y轴: clippingPlanes[2].constant,
|
|
118908
118923
|
z轴: clippingPlanes[1].constant,
|
|
@@ -118933,7 +118948,7 @@ var isDebug = false || false === true;
|
|
|
118933
118948
|
y: 1,
|
|
118934
118949
|
z: 2
|
|
118935
118950
|
};
|
|
118936
|
-
var obj = clippingMesh[clippingMesh.length - 1];
|
|
118951
|
+
var obj = this.clippingMesh[this.clippingMesh.length - 1];
|
|
118937
118952
|
for (var key in params) {
|
|
118938
118953
|
obj.material.clippingPlanes[axis[key]].constant = params[key];
|
|
118939
118954
|
obj.material.needsUpdate = true;
|
|
@@ -118942,7 +118957,7 @@ var isDebug = false || false === true;
|
|
|
118942
118957
|
},
|
|
118943
118958
|
// 取消局部/单个实体的剖切
|
|
118944
118959
|
cancelLocalClipping: function cancelLocalClipping() {
|
|
118945
|
-
guiParams = {
|
|
118960
|
+
this.guiParams = {
|
|
118946
118961
|
x轴: 0,
|
|
118947
118962
|
y轴: 0,
|
|
118948
118963
|
z轴: 0,
|
|
@@ -118950,157 +118965,157 @@ var isDebug = false || false === true;
|
|
|
118950
118965
|
'-y轴': 0,
|
|
118951
118966
|
'-z轴': 0
|
|
118952
118967
|
};
|
|
118953
|
-
gui && gui.destroy();
|
|
118954
|
-
clippingMesh.forEach(function (item) {
|
|
118968
|
+
this.gui && this.gui.destroy();
|
|
118969
|
+
this.clippingMesh.forEach(function (item) {
|
|
118955
118970
|
item.material.clippingPlanes = Object.freeze([]);
|
|
118956
118971
|
item.material.needsUpdate = true;
|
|
118957
118972
|
});
|
|
118958
|
-
clippingMesh.splice(0);
|
|
118973
|
+
this.clippingMesh.splice(0);
|
|
118959
118974
|
},
|
|
118960
118975
|
// 添加剖切轴工具
|
|
118961
118976
|
addClippingGui: function addClippingGui(title, boudingValue, objClipp1, objClipp2) {
|
|
118962
|
-
gui = new lil_gui_module_min_g({
|
|
118977
|
+
this.gui = new lil_gui_module_min_g({
|
|
118963
118978
|
title: title
|
|
118964
118979
|
});
|
|
118965
|
-
gui.add(guiParams, 'x轴').step(0.001).min(boudingValue.min.x).max(boudingValue.max.x).onChange(function (d) {
|
|
118980
|
+
this.gui.add(this.guiParams, 'x轴').step(0.001).min(boudingValue.min.x).max(boudingValue.max.x).onChange(function (d) {
|
|
118966
118981
|
objClipp1[0].constant = d;
|
|
118967
118982
|
objClipp2 && (objClipp2[0].constant = d);
|
|
118968
118983
|
});
|
|
118969
|
-
gui.add(guiParams, '-x轴').step(0.001).min(boudingValue.min.x).max(boudingValue.max.x).onChange(function (d) {
|
|
118984
|
+
this.gui.add(this.guiParams, '-x轴').step(0.001).min(boudingValue.min.x).max(boudingValue.max.x).onChange(function (d) {
|
|
118970
118985
|
objClipp1[3].constant = -d;
|
|
118971
118986
|
objClipp2 && (objClipp2[3].constant = -d);
|
|
118972
118987
|
});
|
|
118973
|
-
gui.add(guiParams, 'y轴').step(0.001).min(boudingValue.min.y).max(boudingValue.max.y).onChange(function (d) {
|
|
118988
|
+
this.gui.add(this.guiParams, 'y轴').step(0.001).min(boudingValue.min.y).max(boudingValue.max.y).onChange(function (d) {
|
|
118974
118989
|
objClipp1[2].constant = d;
|
|
118975
118990
|
objClipp2 && (objClipp2[2].constant = d);
|
|
118976
118991
|
});
|
|
118977
|
-
gui.add(guiParams, '-y轴').step(0.001).min(boudingValue.min.y).max(boudingValue.max.y).onChange(function (d) {
|
|
118992
|
+
this.gui.add(this.guiParams, '-y轴').step(0.001).min(boudingValue.min.y).max(boudingValue.max.y).onChange(function (d) {
|
|
118978
118993
|
objClipp1[5].constant = -d;
|
|
118979
118994
|
objClipp2 && (objClipp2[5].constant = -d);
|
|
118980
118995
|
});
|
|
118981
|
-
gui.add(guiParams, 'z轴').step(0.001).min(boudingValue.min.z).max(boudingValue.max.z).onChange(function (d) {
|
|
118996
|
+
this.gui.add(this.guiParams, 'z轴').step(0.001).min(boudingValue.min.z).max(boudingValue.max.z).onChange(function (d) {
|
|
118982
118997
|
objClipp1[1].constant = d;
|
|
118983
118998
|
objClipp2 && (objClipp2[1].constant = d);
|
|
118984
118999
|
});
|
|
118985
|
-
gui.add(guiParams, '-z轴').step(0.001).min(boudingValue.min.z).max(boudingValue.max.z).onChange(function (d) {
|
|
119000
|
+
this.gui.add(this.guiParams, '-z轴').step(0.001).min(boudingValue.min.z).max(boudingValue.max.z).onChange(function (d) {
|
|
118986
119001
|
objClipp1[4].constant = -d;
|
|
118987
119002
|
objClipp2 && (objClipp2[4].constant = -d);
|
|
118988
119003
|
});
|
|
118989
119004
|
},
|
|
118990
119005
|
// 开启第一视角
|
|
118991
119006
|
startFirstPer: function startFirstPer(options) {
|
|
118992
|
-
var
|
|
118993
|
-
|
|
118994
|
-
moveSpeed =
|
|
118995
|
-
|
|
118996
|
-
jumpSpeed =
|
|
118997
|
-
removeSpeed = moveSpeed;
|
|
118998
|
-
upSpeed = jumpSpeed;
|
|
118999
|
-
clock = new this.THREE.Clock();
|
|
119000
|
-
downRaycaster = new this.THREE.Raycaster(new this.THREE.Vector3(), new this.THREE.Vector3(0, -1, 0), 0, 10);
|
|
119001
|
-
velocity = new this.THREE.Vector3(); //移动速度变量
|
|
119002
|
-
|
|
119003
|
-
firstPerSign = true;
|
|
119007
|
+
var _ref5 = options || {},
|
|
119008
|
+
_ref5$moveSpeed = _ref5.moveSpeed,
|
|
119009
|
+
moveSpeed = _ref5$moveSpeed === void 0 ? 200 : _ref5$moveSpeed,
|
|
119010
|
+
_ref5$jumpSpeed = _ref5.jumpSpeed,
|
|
119011
|
+
jumpSpeed = _ref5$jumpSpeed === void 0 ? 200 : _ref5$jumpSpeed;
|
|
119012
|
+
this.removeSpeed = moveSpeed;
|
|
119013
|
+
this.upSpeed = jumpSpeed;
|
|
119014
|
+
this.clock = new this.THREE.Clock();
|
|
119015
|
+
this.downRaycaster = new this.THREE.Raycaster(new this.THREE.Vector3(), new this.THREE.Vector3(0, -1, 0), 0, 10);
|
|
119016
|
+
this.velocity = new this.THREE.Vector3(); //移动速度变量
|
|
119017
|
+
this.direction = new this.THREE.Vector3(); //移动的方向变量
|
|
119018
|
+
this.firstPerSign = true;
|
|
119004
119019
|
this.initPointerLock();
|
|
119005
119020
|
},
|
|
119006
119021
|
// 页面是否锁定
|
|
119007
119022
|
initPointerLock: function initPointerLock() {
|
|
119008
|
-
var
|
|
119023
|
+
var _this36 = this;
|
|
119009
119024
|
this.home();
|
|
119010
119025
|
setTimeout(function () {
|
|
119011
119026
|
// 开启第一视角时,将相机与水平面保持水平
|
|
119012
|
-
|
|
119013
|
-
|
|
119014
|
-
pointControls = new PointerLockControls(
|
|
119015
|
-
pointControls.lock();
|
|
119016
|
-
if (!
|
|
119017
|
-
|
|
119018
|
-
if (typeof
|
|
119019
|
-
|
|
119027
|
+
_this36.camera.rotation.x = 0;
|
|
119028
|
+
_this36.camera.rotation.z = 0;
|
|
119029
|
+
_this36.pointControls = new PointerLockControls(_this36.camera, _this36.renderer.domElement);
|
|
119030
|
+
_this36.pointControls.lock();
|
|
119031
|
+
if (!_this36._onFirstPersonChange) {
|
|
119032
|
+
_this36._onFirstPersonChange = function () {
|
|
119033
|
+
if (typeof _this36._cameraChangeObserver === 'function') {
|
|
119034
|
+
_this36._cameraChangeObserver('firstPerson');
|
|
119020
119035
|
}
|
|
119021
119036
|
};
|
|
119022
119037
|
}
|
|
119023
119038
|
try {
|
|
119024
|
-
pointControls.addEventListener('change',
|
|
119039
|
+
_this36.pointControls.addEventListener('change', _this36._onFirstPersonChange);
|
|
119025
119040
|
} catch (e) {}
|
|
119026
119041
|
// 锁定
|
|
119027
|
-
pointControls.addEventListener('lock', function () {
|
|
119028
|
-
cameraControls.enabled = false;
|
|
119029
|
-
window.addEventListener('keydown',
|
|
119030
|
-
window.addEventListener('keyup',
|
|
119031
|
-
|
|
119032
|
-
|
|
119033
|
-
if (typeof
|
|
119034
|
-
|
|
119042
|
+
_this36.pointControls.addEventListener('lock', function () {
|
|
119043
|
+
_this36.cameraControls.enabled = false;
|
|
119044
|
+
window.addEventListener('keydown', _this36.onKeyDown, false);
|
|
119045
|
+
window.addEventListener('keyup', _this36.onKeyUp, false);
|
|
119046
|
+
_this36.renderer.domElement.removeEventListener('mouseup', _this36.mouseClick, false);
|
|
119047
|
+
_this36.renderer.domElement.removeEventListener('mousedown', _this36.mouseDown, false);
|
|
119048
|
+
if (typeof _this36._cameraChangeObserver === 'function') {
|
|
119049
|
+
_this36._cameraChangeObserver('firstPersonLock');
|
|
119035
119050
|
}
|
|
119036
119051
|
});
|
|
119037
119052
|
// 解锁
|
|
119038
|
-
pointControls.addEventListener('unlock', function () {
|
|
119039
|
-
firstPerSign = false;
|
|
119040
|
-
cameraControls.enabled = true;
|
|
119053
|
+
_this36.pointControls.addEventListener('unlock', function () {
|
|
119054
|
+
_this36.firstPerSign = false;
|
|
119055
|
+
_this36.cameraControls.enabled = true;
|
|
119041
119056
|
// 返回初始视角
|
|
119042
|
-
|
|
119057
|
+
_this36.home();
|
|
119043
119058
|
try {
|
|
119044
|
-
if (
|
|
119045
|
-
pointControls.removeEventListener('change',
|
|
119059
|
+
if (_this36._onFirstPersonChange && _this36.pointControls) {
|
|
119060
|
+
_this36.pointControls.removeEventListener('change', _this36._onFirstPersonChange);
|
|
119046
119061
|
}
|
|
119047
119062
|
} catch (e) {}
|
|
119048
|
-
if (
|
|
119049
|
-
|
|
119063
|
+
if (_this36.noObserver) {
|
|
119064
|
+
_this36.noObserver._firstPersonLastPos = null;
|
|
119050
119065
|
}
|
|
119051
119066
|
setTimeout(function () {
|
|
119052
|
-
window.removeEventListener('keydown',
|
|
119053
|
-
window.removeEventListener('keyup',
|
|
119054
|
-
|
|
119055
|
-
|
|
119067
|
+
window.removeEventListener('keydown', _this36.onKeyDown);
|
|
119068
|
+
window.removeEventListener('keyup', _this36.onKeyUp);
|
|
119069
|
+
_this36.renderer.domElement.addEventListener('mouseup', _this36.mouseClick, false);
|
|
119070
|
+
_this36.renderer.domElement.addEventListener('mousedown', _this36.mouseDown, false);
|
|
119056
119071
|
// this.timeRender()
|
|
119057
119072
|
}, 0);
|
|
119058
|
-
if (typeof
|
|
119059
|
-
|
|
119073
|
+
if (typeof _this36._cameraChangeObserver === 'function') {
|
|
119074
|
+
_this36._cameraChangeObserver('firstPersonUnlock');
|
|
119060
119075
|
}
|
|
119061
119076
|
});
|
|
119062
|
-
if (
|
|
119077
|
+
if (_this36.scene) _this36.scene.add(_this36.pointControls.object);
|
|
119063
119078
|
}, 10);
|
|
119064
119079
|
},
|
|
119065
119080
|
// 第一视角运动
|
|
119066
119081
|
firstPerspective: function firstPerspective() {
|
|
119067
|
-
if (!cameraControls.enabled && firstPerSign) {
|
|
119082
|
+
if (!this.cameraControls.enabled && this.firstPerSign) {
|
|
119068
119083
|
// 获取到控制器对象
|
|
119069
|
-
var control = pointControls.object;
|
|
119084
|
+
var control = this.pointControls.object;
|
|
119070
119085
|
// 获取刷新时间
|
|
119071
|
-
var delta = clock.getDelta();
|
|
119086
|
+
var delta = this.clock.getDelta();
|
|
119072
119087
|
// velocity每次的速度,为了保证有过渡
|
|
119073
|
-
velocity.x -= velocity.x * 10.0 * delta;
|
|
119074
|
-
velocity.z -= velocity.z * 10.0 * delta;
|
|
119075
|
-
velocity.y -= 9.8 * 100.0 * delta; // 默认下降的速度
|
|
119088
|
+
this.velocity.x -= this.velocity.x * 10.0 * delta;
|
|
119089
|
+
this.velocity.z -= this.velocity.z * 10.0 * delta;
|
|
119090
|
+
this.velocity.y -= 9.8 * 100.0 * delta; // 默认下降的速度
|
|
119076
119091
|
// 获取当前按键的方向并获取朝哪个方向移动
|
|
119077
|
-
|
|
119078
|
-
|
|
119092
|
+
this.direction.z = Number(this.moveForward) - Number(this.moveBackward);
|
|
119093
|
+
this.direction.x = Number(this.moveRight) - Number(this.moveLeft);
|
|
119079
119094
|
// 将法向量的值归一化
|
|
119080
|
-
|
|
119081
|
-
if (moveForward || moveBackward) velocity.z -=
|
|
119082
|
-
if (moveLeft || moveRight) velocity.x -=
|
|
119095
|
+
this.direction.normalize();
|
|
119096
|
+
if (this.moveForward || this.moveBackward) this.velocity.z -= this.direction.z * this.removeSpeed * delta;
|
|
119097
|
+
if (this.moveLeft || this.moveRight) this.velocity.x -= this.direction.x * this.removeSpeed * delta;
|
|
119083
119098
|
// }
|
|
119084
119099
|
// 复制相机的位置
|
|
119085
|
-
downRaycaster.ray.origin.copy(control.position);
|
|
119100
|
+
this.downRaycaster.ray.origin.copy(control.position);
|
|
119086
119101
|
// 获取相机靠下5的位置
|
|
119087
|
-
downRaycaster.ray.origin.y += 5;
|
|
119102
|
+
this.downRaycaster.ray.origin.y += 5;
|
|
119088
119103
|
// 判断是否停留在了立方体上面
|
|
119089
|
-
var intersections =
|
|
119104
|
+
var intersections = this.scene && this.scene.children ? this.downRaycaster.intersectObjects(this.scene.children, true) : [];
|
|
119090
119105
|
var onObject = intersections.length > 0;
|
|
119091
119106
|
if (onObject === true) {
|
|
119092
|
-
velocity.y = Math.max(0, velocity.y);
|
|
119093
|
-
canJump = true;
|
|
119107
|
+
this.velocity.y = Math.max(0, this.velocity.y);
|
|
119108
|
+
this.canJump = true;
|
|
119094
119109
|
}
|
|
119095
119110
|
// 根据速度值移动控制器
|
|
119096
|
-
pointControls.moveRight(-velocity.x * delta);
|
|
119097
|
-
pointControls.moveForward(-velocity.z * delta);
|
|
119098
|
-
control.position.y += velocity.y * delta;
|
|
119111
|
+
this.pointControls.this.moveRight(-this.velocity.x * delta);
|
|
119112
|
+
this.pointControls.this.moveForward(-this.velocity.z * delta);
|
|
119113
|
+
control.position.y += this.velocity.y * delta;
|
|
119099
119114
|
// 保证控制器的y轴在平面上
|
|
119100
119115
|
if (control.position.y < 3 - 0 / 10) {
|
|
119101
|
-
velocity.y = -0 / 10;
|
|
119116
|
+
this.velocity.y = -0 / 10;
|
|
119102
119117
|
control.position.y = 3 - 0 / 10;
|
|
119103
|
-
canJump = true;
|
|
119118
|
+
this.canJump = true;
|
|
119104
119119
|
}
|
|
119105
119120
|
if (this.noObserver) {
|
|
119106
119121
|
if (!this.noObserver._firstPersonLastPos) {
|
|
@@ -119125,27 +119140,27 @@ var isDebug = false || false === true;
|
|
|
119125
119140
|
// 前进
|
|
119126
119141
|
case 38:
|
|
119127
119142
|
case 87:
|
|
119128
|
-
moveForward = true;
|
|
119143
|
+
this.moveForward = true;
|
|
119129
119144
|
break;
|
|
119130
119145
|
// 向左
|
|
119131
119146
|
case 37:
|
|
119132
119147
|
case 65:
|
|
119133
|
-
moveLeft = true;
|
|
119148
|
+
this.moveLeft = true;
|
|
119134
119149
|
break;
|
|
119135
119150
|
// 后退
|
|
119136
119151
|
case 40:
|
|
119137
119152
|
case 83:
|
|
119138
|
-
moveBackward = true;
|
|
119153
|
+
this.moveBackward = true;
|
|
119139
119154
|
break;
|
|
119140
119155
|
// 向右
|
|
119141
119156
|
case 39:
|
|
119142
119157
|
case 68:
|
|
119143
|
-
moveRight = true;
|
|
119158
|
+
this.moveRight = true;
|
|
119144
119159
|
break;
|
|
119145
119160
|
// 跳跃
|
|
119146
119161
|
case 32:
|
|
119147
|
-
if (canJump && spaceUp) velocity.y += upSpeed;
|
|
119148
|
-
canJump = false;
|
|
119162
|
+
if (this.canJump && spaceUp) this.velocity.y += this.upSpeed;
|
|
119163
|
+
this.canJump = false;
|
|
119149
119164
|
spaceUp = false;
|
|
119150
119165
|
break;
|
|
119151
119166
|
}
|
|
@@ -119157,22 +119172,22 @@ var isDebug = false || false === true;
|
|
|
119157
119172
|
// 前进
|
|
119158
119173
|
case 38:
|
|
119159
119174
|
case 87:
|
|
119160
|
-
moveForward = false;
|
|
119175
|
+
this.moveForward = false;
|
|
119161
119176
|
break;
|
|
119162
119177
|
// 向左
|
|
119163
119178
|
case 37:
|
|
119164
119179
|
case 65:
|
|
119165
|
-
moveLeft = false;
|
|
119180
|
+
this.moveLeft = false;
|
|
119166
119181
|
break;
|
|
119167
119182
|
// 后退
|
|
119168
119183
|
case 40:
|
|
119169
119184
|
case 83:
|
|
119170
|
-
moveBackward = false;
|
|
119185
|
+
this.moveBackward = false;
|
|
119171
119186
|
break;
|
|
119172
119187
|
// 向右
|
|
119173
119188
|
case 39:
|
|
119174
119189
|
case 68:
|
|
119175
|
-
moveRight = false;
|
|
119190
|
+
this.moveRight = false;
|
|
119176
119191
|
break;
|
|
119177
119192
|
// 跳跃
|
|
119178
119193
|
case 32:
|
|
@@ -119182,12 +119197,12 @@ var isDebug = false || false === true;
|
|
|
119182
119197
|
},
|
|
119183
119198
|
// 返回主视角/恢复相机初始状态
|
|
119184
119199
|
home: function home() {
|
|
119185
|
-
hasExecutedCentering = true;
|
|
119186
|
-
if (roaming) {
|
|
119200
|
+
this.hasExecutedCentering = true;
|
|
119201
|
+
if (this.roaming) {
|
|
119187
119202
|
this.endRoam();
|
|
119188
119203
|
}
|
|
119189
|
-
var center = sceneBoundingBox.getCenter(new this.THREE.Vector3());
|
|
119190
|
-
var size = sceneBoundingBox.getSize(new this.THREE.Vector3());
|
|
119204
|
+
var center = this.sceneBoundingBox.getCenter(new this.THREE.Vector3());
|
|
119205
|
+
var size = this.sceneBoundingBox.getSize(new this.THREE.Vector3());
|
|
119191
119206
|
var maxDim = Math.max(size.x, size.y, size.z);
|
|
119192
119207
|
this.cameraLocation({
|
|
119193
119208
|
x: center.x,
|
|
@@ -119198,8 +119213,8 @@ var isDebug = false || false === true;
|
|
|
119198
119213
|
roll: center.z
|
|
119199
119214
|
});
|
|
119200
119215
|
this.setCameraConfig();
|
|
119201
|
-
// cameraControls.reset(true);
|
|
119202
|
-
// cameraControls.update(0);
|
|
119216
|
+
// this.cameraControls.reset(true);
|
|
119217
|
+
// this.cameraControls.update(0);
|
|
119203
119218
|
// this.timeRender()
|
|
119204
119219
|
},
|
|
119205
119220
|
// 测量
|
|
@@ -119207,39 +119222,39 @@ var isDebug = false || false === true;
|
|
|
119207
119222
|
参数: type: '', distance、area、angle、height, 暂时只提供距离、面积、角度、高度这四种方式
|
|
119208
119223
|
*/
|
|
119209
119224
|
openMeasure: function openMeasure(type) {
|
|
119210
|
-
if (threeMeasure) {
|
|
119211
|
-
threeMeasure.close();
|
|
119212
|
-
threeMeasure = null;
|
|
119225
|
+
if (this.threeMeasure) {
|
|
119226
|
+
this.threeMeasure.close(false);
|
|
119227
|
+
this.threeMeasure = null;
|
|
119213
119228
|
}
|
|
119214
|
-
measureFlag = true;
|
|
119229
|
+
this.measureFlag = true;
|
|
119215
119230
|
// renderEnabled = true
|
|
119216
119231
|
switch (type) {
|
|
119217
119232
|
case 'distance':
|
|
119218
|
-
threeMeasure = new measure_distance.MeasureDistance(
|
|
119219
|
-
threeMeasure.start();
|
|
119233
|
+
this.threeMeasure = new measure_distance.MeasureDistance(this.renderer, this.scene, this.camera, this.instructions.offsetWidth, this.instructions.offsetHeight);
|
|
119234
|
+
this.threeMeasure.start();
|
|
119220
119235
|
break;
|
|
119221
119236
|
case 'area':
|
|
119222
|
-
threeMeasure = new measure_area.MeasureArea(
|
|
119223
|
-
threeMeasure.start();
|
|
119237
|
+
this.threeMeasure = new measure_area.MeasureArea(this.renderer, this.scene, this.camera, this.instructions.offsetWidth, this.instructions.offsetHeight);
|
|
119238
|
+
this.threeMeasure.start();
|
|
119224
119239
|
break;
|
|
119225
119240
|
case 'angle':
|
|
119226
|
-
threeMeasure = new measure_angle.MeasureAngle(
|
|
119227
|
-
threeMeasure.start();
|
|
119241
|
+
this.threeMeasure = new measure_angle.MeasureAngle(this.renderer, this.scene, this.camera, this.instructions.offsetWidth, this.instructions.offsetHeight);
|
|
119242
|
+
this.threeMeasure.start();
|
|
119228
119243
|
break;
|
|
119229
119244
|
case 'height':
|
|
119230
|
-
threeMeasure = new measure_height.MeasureHeight(
|
|
119231
|
-
threeMeasure.start();
|
|
119245
|
+
this.threeMeasure = new measure_height.MeasureHeight(this.renderer, this.scene, this.camera, this.instructions.offsetWidth, this.instructions.offsetHeight);
|
|
119246
|
+
this.threeMeasure.start();
|
|
119232
119247
|
break;
|
|
119233
119248
|
}
|
|
119234
119249
|
// 添加键盘事件监听器
|
|
119235
119250
|
document.addEventListener('keydown', this.handleMeasureKeyDown, false);
|
|
119236
119251
|
},
|
|
119237
|
-
// 关闭测量
|
|
119238
|
-
closeMeasure: function closeMeasure() {
|
|
119239
|
-
measureFlag = false;
|
|
119240
|
-
if (threeMeasure) {
|
|
119241
|
-
threeMeasure.close();
|
|
119242
|
-
threeMeasure = null;
|
|
119252
|
+
// 关闭测量 isClear代表是否清除测量结果
|
|
119253
|
+
closeMeasure: function closeMeasure(isClear) {
|
|
119254
|
+
this.measureFlag = false;
|
|
119255
|
+
if (this.threeMeasure) {
|
|
119256
|
+
this.threeMeasure.close(isClear);
|
|
119257
|
+
!isClear && (this.threeMeasure = null);
|
|
119243
119258
|
// this.timeRender()
|
|
119244
119259
|
}
|
|
119245
119260
|
// 移除键盘事件监听器
|
|
@@ -119306,12 +119321,12 @@ var isDebug = false || false === true;
|
|
|
119306
119321
|
参数: object, 目标实体,
|
|
119307
119322
|
*/
|
|
119308
119323
|
isolate: function isolate(object) {
|
|
119309
|
-
var
|
|
119310
|
-
if (!
|
|
119324
|
+
var _this37 = this;
|
|
119325
|
+
if (!this.scene) return;
|
|
119311
119326
|
// 隔离 将目标实体以外的实体隐藏掉
|
|
119312
|
-
|
|
119327
|
+
this.scene.traverse(function (item) {
|
|
119313
119328
|
if (item.isMesh && item.name !== object.name) {
|
|
119314
|
-
var offsetMatrix = new
|
|
119329
|
+
var offsetMatrix = new _this37.THREE.Matrix4().copy(item.userData.copyMatrix).makeTranslation(9999999, 9999999, 9999999);
|
|
119315
119330
|
item.setMatrixAt(item.userData.instanceIndex, offsetMatrix);
|
|
119316
119331
|
item.instanceMatrix.needsUpdate = true;
|
|
119317
119332
|
}
|
|
@@ -119319,9 +119334,9 @@ var isDebug = false || false === true;
|
|
|
119319
119334
|
},
|
|
119320
119335
|
// 还原操作 将修改过的实体进行恢复
|
|
119321
119336
|
restore: function restore() {
|
|
119322
|
-
var
|
|
119323
|
-
if (!
|
|
119324
|
-
|
|
119337
|
+
var _this38 = this;
|
|
119338
|
+
if (!this.scene) return;
|
|
119339
|
+
this.scene.traverse(function (item) {
|
|
119325
119340
|
if (item.isMesh) {
|
|
119326
119341
|
var instanceId = item.userData ? item.userData.instanceId : null;
|
|
119327
119342
|
item.setColorAt(item.userData.instanceIndex, item.material.userData.nColor);
|
|
@@ -119341,20 +119356,20 @@ var isDebug = false || false === true;
|
|
|
119341
119356
|
item.userData.translateMatrixInvert = null;
|
|
119342
119357
|
}
|
|
119343
119358
|
if (item.userData.combineMatrixInvert) {
|
|
119344
|
-
|
|
119359
|
+
_this38.rotateMesh(item, {
|
|
119345
119360
|
x: 0,
|
|
119346
119361
|
y: 0,
|
|
119347
119362
|
z: 0
|
|
119348
119363
|
});
|
|
119349
119364
|
item.userData.combineMatrixInvert = null;
|
|
119350
119365
|
}
|
|
119351
|
-
var copyMatrix =
|
|
119366
|
+
var copyMatrix = _this38.getInstanceCopyMatrix(item, instanceId);
|
|
119352
119367
|
if (!copyMatrix) return;
|
|
119353
|
-
var sourceHidden =
|
|
119354
|
-
var offsetMatrix = new
|
|
119368
|
+
var sourceHidden = _this38.isSourceHiddenInstance(item, instanceId);
|
|
119369
|
+
var offsetMatrix = new _this38.THREE.Matrix4().copy(copyMatrix);
|
|
119355
119370
|
if (sourceHidden) {
|
|
119356
119371
|
offsetMatrix.makeTranslation(9999999, 9999999, 9999999);
|
|
119357
|
-
|
|
119372
|
+
_this38.removeOutlineInstanceProxy(item, item.userData.instanceIndex);
|
|
119358
119373
|
}
|
|
119359
119374
|
item.setMatrixAt(item.userData.instanceIndex, offsetMatrix);
|
|
119360
119375
|
item.instanceMatrix.needsUpdate = true;
|
|
@@ -119363,86 +119378,86 @@ var isDebug = false || false === true;
|
|
|
119363
119378
|
},
|
|
119364
119379
|
// 添加自定义模型, 暂时只支持glb、gltf格式
|
|
119365
119380
|
addCustomModel: function addCustomModel(name, position, url) {
|
|
119366
|
-
var
|
|
119381
|
+
var _this39 = this;
|
|
119367
119382
|
var scale = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;
|
|
119368
119383
|
var immediately = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false;
|
|
119369
119384
|
var callback = arguments.length > 5 ? arguments[5] : undefined;
|
|
119370
119385
|
var loader = new GLTFLoader_GLTFLoader();
|
|
119371
119386
|
var locationModel = null;
|
|
119372
119387
|
loader.load(url, function (gltf) {
|
|
119373
|
-
locationModel = gltf.scene;
|
|
119388
|
+
locationModel = gltf.this.scene;
|
|
119374
119389
|
locationModel.scale.set(scale, scale, scale);
|
|
119375
119390
|
locationModel.updateMatrixWorld();
|
|
119376
119391
|
if (immediately) {
|
|
119377
|
-
cameraControls.fitToSphere(gltf.scene, true);
|
|
119392
|
+
_this39.cameraControls.fitToSphere(gltf.this.scene, true);
|
|
119378
119393
|
}
|
|
119379
119394
|
// 动画混合器
|
|
119380
119395
|
// 不参与裁剪
|
|
119381
119396
|
locationModel.userData.cull = false;
|
|
119382
119397
|
locationModel.name = name;
|
|
119383
|
-
if (
|
|
119384
|
-
locationModel.position.copy(new
|
|
119398
|
+
if (_this39.scene) _this39.scene.add(locationModel);
|
|
119399
|
+
locationModel.position.copy(new _this39.THREE.Vector3(position.x, position.y, position.z));
|
|
119385
119400
|
if (gltf.animations.length > 0) {
|
|
119386
|
-
var actionMixer = new
|
|
119401
|
+
var actionMixer = new _this39.THREE.AnimationMixer(gltf.this.scene);
|
|
119387
119402
|
var walkActive = actionMixer.clipAction(gltf.animations[0]);
|
|
119388
119403
|
walkActive.play();
|
|
119389
|
-
modelActive.push(walkActive);
|
|
119390
|
-
modelActions.push(actionMixer);
|
|
119404
|
+
_this39.modelActive.push(walkActive);
|
|
119405
|
+
_this39.modelActions.push(actionMixer);
|
|
119391
119406
|
}
|
|
119392
119407
|
callback && callback();
|
|
119393
119408
|
});
|
|
119394
119409
|
},
|
|
119395
119410
|
// 删除添加的自定义模型
|
|
119396
119411
|
removeCustomModel: function removeCustomModel(name) {
|
|
119397
|
-
var
|
|
119412
|
+
var _this40 = this;
|
|
119398
119413
|
var obj = this.getObjectByName(name);
|
|
119399
119414
|
obj.forEach(function (item, index) {
|
|
119400
119415
|
if (item.animations > 0) {
|
|
119401
119416
|
item.removeFromParent();
|
|
119402
|
-
modelActions[index].uncacheRoot(item);
|
|
119403
|
-
modelActions[index].uncacheRoot(modelActive[index]);
|
|
119417
|
+
_this40.modelActions[index].uncacheRoot(item);
|
|
119418
|
+
_this40.modelActions[index].uncacheRoot(_this40.modelActive[index]);
|
|
119404
119419
|
}
|
|
119405
119420
|
item.traverse(function (child) {
|
|
119406
|
-
if (child instanceof
|
|
119421
|
+
if (child instanceof _this40.THREE.Mesh) {
|
|
119407
119422
|
child.geometry.dispose();
|
|
119408
119423
|
child.material.dispose();
|
|
119409
119424
|
}
|
|
119410
119425
|
});
|
|
119411
|
-
if (
|
|
119426
|
+
if (_this40.scene) _this40.scene.remove(item);
|
|
119412
119427
|
});
|
|
119413
|
-
modelActions.splice(0);
|
|
119414
|
-
modelActive.splice(0);
|
|
119428
|
+
this.modelActions.splice(0);
|
|
119429
|
+
this.modelActive.splice(0);
|
|
119415
119430
|
},
|
|
119416
119431
|
// 修改天空背景
|
|
119417
119432
|
skyBoxScene: function skyBoxScene(url) {
|
|
119418
119433
|
var textureCube = new this.THREE.CubeTextureLoader().load(url);
|
|
119419
|
-
|
|
119434
|
+
this.scene.background = textureCube;
|
|
119420
119435
|
},
|
|
119421
119436
|
// 清除天空背景
|
|
119422
119437
|
clearSkyBoxScene: function clearSkyBoxScene() {
|
|
119423
|
-
|
|
119438
|
+
this.scene.background = null;
|
|
119424
119439
|
},
|
|
119425
119440
|
// 下雨模拟
|
|
119426
119441
|
sceneSimu: function sceneSimu(type) {
|
|
119427
|
-
if (!outlineComposer) {
|
|
119428
|
-
outlineComposer = new EffectComposer_EffectComposer(
|
|
119429
|
-
outlineComposer.addPass(new RenderPass_RenderPass(
|
|
119442
|
+
if (!this.outlineComposer) {
|
|
119443
|
+
this.outlineComposer = new EffectComposer_EffectComposer(this.renderer, this.renderTarget);
|
|
119444
|
+
this.outlineComposer.addPass(new RenderPass_RenderPass(this.scene, this.camera));
|
|
119430
119445
|
}
|
|
119431
119446
|
if (type === 'rain') {
|
|
119432
|
-
scenePass = new ShaderPass_ShaderPass(RainShader);
|
|
119433
|
-
scenePass.uniforms['iResolution'].value = new this.THREE.Vector2(window.innerWidth, window.innerHeight);
|
|
119434
|
-
outlineComposer.addPass(scenePass);
|
|
119447
|
+
this.scenePass = new ShaderPass_ShaderPass(RainShader);
|
|
119448
|
+
this.scenePass.uniforms['iResolution'].value = new this.THREE.Vector2(window.innerWidth, window.innerHeight);
|
|
119449
|
+
this.outlineComposer.addPass(this.scenePass);
|
|
119435
119450
|
} else if (type === 'snow') {
|
|
119436
|
-
scenePass = new ShaderPass_ShaderPass(SnowShader);
|
|
119437
|
-
scenePass.uniforms['iResolution'].value = new this.THREE.Vector2(window.innerWidth, window.innerHeight);
|
|
119438
|
-
outlineComposer.addPass(scenePass);
|
|
119451
|
+
this.scenePass = new ShaderPass_ShaderPass(SnowShader);
|
|
119452
|
+
this.scenePass.uniforms['iResolution'].value = new this.THREE.Vector2(window.innerWidth, window.innerHeight);
|
|
119453
|
+
this.outlineComposer.addPass(this.scenePass);
|
|
119439
119454
|
}
|
|
119440
119455
|
},
|
|
119441
119456
|
clearSceneSim: function clearSceneSim() {
|
|
119442
|
-
if (scenePass && outlineComposer) {
|
|
119443
|
-
outlineComposer.removePass(scenePass);
|
|
119457
|
+
if (this.scenePass && this.outlineComposer) {
|
|
119458
|
+
this.outlineComposer.removePass(this.scenePass);
|
|
119444
119459
|
}
|
|
119445
|
-
scenePass = null;
|
|
119460
|
+
this.scenePass = null;
|
|
119446
119461
|
},
|
|
119447
119462
|
// 获取中心点
|
|
119448
119463
|
getCenter: function getCenter(obj, isBox3Info) {
|
|
@@ -119453,7 +119468,7 @@ var isDebug = false || false === true;
|
|
|
119453
119468
|
var center = new this.THREE.Vector3();
|
|
119454
119469
|
box3 && box3.getCenter(center) || obj.boundingBox.getCenter(center);
|
|
119455
119470
|
if (isBox3Info || obj.userData.is3D) {
|
|
119456
|
-
center.applyMatrix4(bizToThreeMatrix);
|
|
119471
|
+
center.applyMatrix4(this.bizToThreeMatrix);
|
|
119457
119472
|
}
|
|
119458
119473
|
return center;
|
|
119459
119474
|
},
|
|
@@ -119465,64 +119480,65 @@ var isDebug = false || false === true;
|
|
|
119465
119480
|
var size = new this.THREE.Vector3();
|
|
119466
119481
|
box3 && box3.getSize(size) || obj.boundingBox.getSize(size);
|
|
119467
119482
|
if (isBox3Info || obj.userData.is3D) {
|
|
119468
|
-
size.applyMatrix4(bizToThreeMatrix);
|
|
119483
|
+
size.applyMatrix4(this.bizToThreeMatrix);
|
|
119469
119484
|
}
|
|
119470
119485
|
return size;
|
|
119471
119486
|
},
|
|
119472
119487
|
animate: function animate() {
|
|
119488
|
+
var _this41 = this;
|
|
119473
119489
|
if (isDebug) {
|
|
119474
|
-
stats && stats.begin(); // 开始帧率统计
|
|
119490
|
+
this.stats && this.stats.begin(); // 开始帧率统计
|
|
119475
119491
|
}
|
|
119476
|
-
var delta = fpsClock.getDelta();
|
|
119477
|
-
timeStamp += delta;
|
|
119478
|
-
animateId = requestAnimationFrame(this.animate);
|
|
119492
|
+
var delta = this.fpsClock.getDelta();
|
|
119493
|
+
this.timeStamp += delta;
|
|
119494
|
+
this.animateId = requestAnimationFrame(this.animate);
|
|
119479
119495
|
|
|
119480
119496
|
// 1. 先重置计数器(关键!)
|
|
119481
|
-
|
|
119497
|
+
this.renderer.info.reset(); // 重置上一帧的统计数据
|
|
119482
119498
|
|
|
119483
|
-
if (timeStamp > singleFrameTime) {
|
|
119484
|
-
if (modelActions.length > 0) {
|
|
119485
|
-
modelActions.forEach(function (item) {
|
|
119486
|
-
item.update(timeStamp);
|
|
119499
|
+
if (this.timeStamp > singleFrameTime) {
|
|
119500
|
+
if (this.modelActions.length > 0) {
|
|
119501
|
+
this.modelActions.forEach(function (item) {
|
|
119502
|
+
item.update(_this41.timeStamp);
|
|
119487
119503
|
});
|
|
119488
119504
|
}
|
|
119489
|
-
cameraControls.enabled && cameraControls.update(timeStamp);
|
|
119505
|
+
this.cameraControls.enabled && this.cameraControls.update(this.timeStamp);
|
|
119490
119506
|
// 计算相机近裁面到包围盒当前面的距离
|
|
119491
119507
|
this.cameraTrack();
|
|
119492
119508
|
this.firstPerspective();
|
|
119493
|
-
if (scenePass) {
|
|
119494
|
-
var d = sceneClock.getDelta();
|
|
119495
|
-
scenePass.uniforms['iTime'].value += d;
|
|
119509
|
+
if (this.scenePass) {
|
|
119510
|
+
var d = this.sceneClock.getDelta();
|
|
119511
|
+
this.scenePass.uniforms['iTime'].value += d;
|
|
119496
119512
|
}
|
|
119497
|
-
labelRenderer.render(
|
|
119513
|
+
this.labelRenderer.render(this.scene, this.camera);
|
|
119498
119514
|
renderedThisFrame.clear();
|
|
119499
119515
|
|
|
119500
119516
|
// 增强的渲染中断逻辑:在用户交互期间强制跳过渲染
|
|
119501
119517
|
var loadingState = this.noObserver ? this.noObserver.batchLoadingState : this.batchLoadingState;
|
|
119502
|
-
var shouldSkipRendering = skipNextRenderFrame || forceSkipRendering || loadingState.interactionState.isInteracting;
|
|
119518
|
+
var shouldSkipRendering = this.skipNextRenderFrame || this.forceSkipRendering || loadingState.interactionState.isInteracting;
|
|
119503
119519
|
if (shouldSkipRendering) {
|
|
119504
119520
|
// 重置单次跳过标记
|
|
119505
|
-
if (skipNextRenderFrame) {
|
|
119506
|
-
skipNextRenderFrame = false;
|
|
119521
|
+
if (this.skipNextRenderFrame) {
|
|
119522
|
+
this.skipNextRenderFrame = false;
|
|
119507
119523
|
}
|
|
119508
119524
|
|
|
119509
119525
|
// 统计跳过的帧数
|
|
119510
119526
|
// interactionFrameCount++;
|
|
119511
119527
|
// 在交互期间,每隔几帧强制渲染一次以保持基本的视觉反馈
|
|
119512
119528
|
// if (interactionFrameCount % 2 === 0 && this.batchLoadingState.interactionState.isInteracting) {
|
|
119513
|
-
|
|
119514
|
-
|
|
119529
|
+
this.renderer.clear(true, true, true);
|
|
119530
|
+
this.renderer.render(this.scene, this.camera);
|
|
119515
119531
|
// }
|
|
119516
119532
|
// 可选:添加调试信息(生产环境可注释掉)
|
|
119517
119533
|
// console.log(`跳过渲染帧 #${interactionFrameCount}, 交互类型: ${this.batchLoadingState.interactionState.interactionType}`);
|
|
119518
119534
|
} else {
|
|
119519
119535
|
// 正常渲染
|
|
119520
|
-
if (outlineComposer) {
|
|
119536
|
+
if (this.outlineComposer) {
|
|
119521
119537
|
// 使用后处理管线渲染,避免重复渲染
|
|
119522
|
-
outlineComposer.render();
|
|
119538
|
+
this.outlineComposer.render();
|
|
119523
119539
|
} else {
|
|
119524
|
-
|
|
119525
|
-
|
|
119540
|
+
this.renderer.clear(true, true, true);
|
|
119541
|
+
this.renderer.render(this.scene, this.camera);
|
|
119526
119542
|
}
|
|
119527
119543
|
// 重置交互帧计数
|
|
119528
119544
|
// if (interactionFrameCount > 0) {
|
|
@@ -119539,15 +119555,15 @@ var isDebug = false || false === true;
|
|
|
119539
119555
|
// try {
|
|
119540
119556
|
// const frustum = new this.THREE.Frustum();
|
|
119541
119557
|
// const vpMatrix = new this.THREE.Matrix4().multiplyMatrices(
|
|
119542
|
-
// camera.projectionMatrix,
|
|
119543
|
-
// camera.matrixWorldInverse
|
|
119558
|
+
// this.camera.projectionMatrix,
|
|
119559
|
+
// this.camera.matrixWorldInverse
|
|
119544
119560
|
// );
|
|
119545
119561
|
// frustum.setFromProjectionMatrix(vpMatrix);
|
|
119546
119562
|
|
|
119547
|
-
// // 优先使用 modelGroup 的子节点作为“模型”统计单位;否则回退到 scene.children
|
|
119548
|
-
// const children = (typeof modelGroup !== 'undefined' && modelGroup && modelGroup.children && modelGroup.children.length)
|
|
119549
|
-
// ? modelGroup.children
|
|
119550
|
-
// : scene.children;
|
|
119563
|
+
// // 优先使用 this.modelGroup 的子节点作为“模型”统计单位;否则回退到 this.scene.children
|
|
119564
|
+
// const children = (typeof this.modelGroup !== 'undefined' && this.modelGroup && this.modelGroup.children && this.modelGroup.children.length)
|
|
119565
|
+
// ? this.modelGroup.children
|
|
119566
|
+
// : this.scene.children;
|
|
119551
119567
|
|
|
119552
119568
|
// for (let i = 0; i < children.length; i++) {
|
|
119553
119569
|
// const obj = children[i];
|
|
@@ -119574,28 +119590,28 @@ var isDebug = false || false === true;
|
|
|
119574
119590
|
// if ((perfLogFrameCount++ % 120 === 0) || (Date.now() - lastPerfLogTime >= 3000)) {
|
|
119575
119591
|
// lastPerfLogTime = Date.now();
|
|
119576
119592
|
// console.log(`frame info`, {
|
|
119577
|
-
// drawCalls: renderer.info.render.calls,
|
|
119578
|
-
// triangles: renderer.info.render.triangles,
|
|
119579
|
-
// textures: renderer.info.memory.textures,
|
|
119593
|
+
// drawCalls: this.renderer.info.render.calls,
|
|
119594
|
+
// triangles: this.renderer.info.render.triangles,
|
|
119595
|
+
// textures: this.renderer.info.memory.textures,
|
|
119580
119596
|
// });
|
|
119581
119597
|
// }
|
|
119582
119598
|
// }
|
|
119583
119599
|
|
|
119584
|
-
// renderer.setRenderTarget(null)
|
|
119585
|
-
timeStamp = timeStamp % singleFrameTime;
|
|
119600
|
+
// this.renderer.setRenderTarget(null)
|
|
119601
|
+
this.timeStamp = this.timeStamp % singleFrameTime;
|
|
119586
119602
|
}
|
|
119587
119603
|
if (isDebug) {
|
|
119588
|
-
stats && stats.end(); // 结束帧率统计
|
|
119604
|
+
this.stats && this.stats.end(); // 结束帧率统计
|
|
119589
119605
|
}
|
|
119590
119606
|
},
|
|
119591
119607
|
// 暴露个别参数让业务自己做特殊业务。
|
|
119592
119608
|
// 后续若多个业务有相同使用场景,再抽象至公共组件中。
|
|
119593
119609
|
exportParmas: function exportParmas() {
|
|
119594
119610
|
return {
|
|
119595
|
-
renderer:
|
|
119596
|
-
camera:
|
|
119597
|
-
cameraControls: cameraControls,
|
|
119598
|
-
scene:
|
|
119611
|
+
renderer: this.renderer,
|
|
119612
|
+
camera: this.camera,
|
|
119613
|
+
cameraControls: this.cameraControls,
|
|
119614
|
+
scene: this.scene
|
|
119599
119615
|
};
|
|
119600
119616
|
},
|
|
119601
119617
|
isSourceVisible: function isSourceVisible(instanceId, object) {
|
|
@@ -119615,13 +119631,13 @@ var isDebug = false || false === true;
|
|
|
119615
119631
|
return true;
|
|
119616
119632
|
},
|
|
119617
119633
|
removeOutlineObject: function removeOutlineObject(object, instanceIndex) {
|
|
119618
|
-
if (!outlinePass || !object) return;
|
|
119634
|
+
if (!this.outlinePass || !object) return;
|
|
119619
119635
|
if (object.isInstancedMesh) {
|
|
119620
119636
|
this.removeOutlineInstanceProxy(object, instanceIndex);
|
|
119621
119637
|
return;
|
|
119622
119638
|
}
|
|
119623
|
-
var idx = outlinePass.selectedObjects.indexOf(object);
|
|
119624
|
-
if (idx !== -1) outlinePass.selectedObjects.splice(idx, 1);
|
|
119639
|
+
var idx = this.outlinePass.selectedObjects.indexOf(object);
|
|
119640
|
+
if (idx !== -1) this.outlinePass.selectedObjects.splice(idx, 1);
|
|
119625
119641
|
},
|
|
119626
119642
|
/**
|
|
119627
119643
|
* 重置性能统计
|
|
@@ -119639,9 +119655,9 @@ var isDebug = false || false === true;
|
|
|
119639
119655
|
var left = btn.left,
|
|
119640
119656
|
right = btn.right,
|
|
119641
119657
|
middle = btn.middle;
|
|
119642
|
-
left && (cameraControls.mouseButtons.left = ACTION_ENUM[left]);
|
|
119643
|
-
right && (cameraControls.mouseButtons.right = ACTION_ENUM[right]);
|
|
119644
|
-
middle && (cameraControls.mouseButtons.middle = ACTION_ENUM[middle]);
|
|
119658
|
+
left && (this.cameraControls.mouseButtons.left = ACTION_ENUM[left]);
|
|
119659
|
+
right && (this.cameraControls.mouseButtons.right = ACTION_ENUM[right]);
|
|
119660
|
+
middle && (this.cameraControls.mouseButtons.middle = ACTION_ENUM[middle]);
|
|
119645
119661
|
},
|
|
119646
119662
|
// 分帧加载相关方法
|
|
119647
119663
|
/**
|
|
@@ -119679,8 +119695,8 @@ var isDebug = false || false === true;
|
|
|
119679
119695
|
|
|
119680
119696
|
// 去重处理
|
|
119681
119697
|
// const existingDrawObjectIds = new Set();
|
|
119682
|
-
// if (modelGroup && modelGroup.children && modelGroup.children.length) {
|
|
119683
|
-
// modelGroup.children.forEach(child => {
|
|
119698
|
+
// if (this.modelGroup && this.modelGroup.children && this.modelGroup.children.length) {
|
|
119699
|
+
// this.modelGroup.children.forEach(child => {
|
|
119684
119700
|
// if (child && child.userData && child.userData.isInstancedMeshGroup && child.name) {
|
|
119685
119701
|
// existingDrawObjectIds.add(child.name);
|
|
119686
119702
|
// }
|
|
@@ -119838,53 +119854,53 @@ var isDebug = false || false === true;
|
|
|
119838
119854
|
* 加载下一批数据
|
|
119839
119855
|
*/
|
|
119840
119856
|
loadNextBatch: function loadNextBatch() {
|
|
119841
|
-
var
|
|
119842
|
-
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function
|
|
119857
|
+
var _this42 = this;
|
|
119858
|
+
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee9() {
|
|
119843
119859
|
var loadingState, batch, _t2;
|
|
119844
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (
|
|
119845
|
-
while (1) switch (
|
|
119860
|
+
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context9) {
|
|
119861
|
+
while (1) switch (_context9.p = _context9.n) {
|
|
119846
119862
|
case 0:
|
|
119847
|
-
loadingState =
|
|
119863
|
+
loadingState = _this42.noObserver ? _this42.noObserver.batchLoadingState : _this42.batchLoadingState;
|
|
119848
119864
|
if (!(!loadingState.isLoading || loadingState.currentBatch >= loadingState.pendingData.length)) {
|
|
119849
|
-
|
|
119865
|
+
_context9.n = 1;
|
|
119850
119866
|
break;
|
|
119851
119867
|
}
|
|
119852
|
-
|
|
119853
|
-
return
|
|
119868
|
+
_this42.completeBatchLoading();
|
|
119869
|
+
return _context9.a(2);
|
|
119854
119870
|
case 1:
|
|
119855
119871
|
if (!loadingState.isPaused) {
|
|
119856
|
-
|
|
119872
|
+
_context9.n = 2;
|
|
119857
119873
|
break;
|
|
119858
119874
|
}
|
|
119859
119875
|
// 如果暂停,延迟一段时间后再次检查
|
|
119860
119876
|
loadingState.animationFrameId = requestAnimationFrame(function () {
|
|
119861
|
-
|
|
119877
|
+
_this42.loadNextBatch();
|
|
119862
119878
|
});
|
|
119863
|
-
return
|
|
119879
|
+
return _context9.a(2);
|
|
119864
119880
|
case 2:
|
|
119865
119881
|
if (!loadingState.interactionState.isInteracting) {
|
|
119866
|
-
|
|
119882
|
+
_context9.n = 3;
|
|
119867
119883
|
break;
|
|
119868
119884
|
}
|
|
119869
119885
|
// 如果正在交互,延迟一段时间后再次检查
|
|
119870
119886
|
loadingState.animationFrameId = requestAnimationFrame(function () {
|
|
119871
|
-
|
|
119887
|
+
_this42.loadNextBatch();
|
|
119872
119888
|
});
|
|
119873
|
-
return
|
|
119889
|
+
return _context9.a(2);
|
|
119874
119890
|
case 3:
|
|
119875
119891
|
batch = loadingState.pendingData[loadingState.currentBatch];
|
|
119876
|
-
|
|
119892
|
+
_context9.p = 4;
|
|
119877
119893
|
console.log('加载批次:', loadingState.currentBatch);
|
|
119878
|
-
|
|
119879
|
-
return
|
|
119894
|
+
_context9.n = 5;
|
|
119895
|
+
return _this42.processWithMainThread(batch);
|
|
119880
119896
|
case 5:
|
|
119881
119897
|
// 更新进度
|
|
119882
119898
|
loadingState.loadedCount += batch.instances.length;
|
|
119883
119899
|
loadingState.currentBatch++;
|
|
119884
119900
|
|
|
119885
119901
|
// 同步到响应式状态
|
|
119886
|
-
|
|
119887
|
-
|
|
119902
|
+
_this42.batchLoadingState.loadedCount = loadingState.loadedCount;
|
|
119903
|
+
_this42.batchLoadingState.currentBatch = loadingState.currentBatch;
|
|
119888
119904
|
|
|
119889
119905
|
// 调用进度回调
|
|
119890
119906
|
if (loadingState.onProgress) {
|
|
@@ -119898,96 +119914,96 @@ var isDebug = false || false === true;
|
|
|
119898
119914
|
|
|
119899
119915
|
// 使用 requestAnimationFrame 在下一帧继续加载
|
|
119900
119916
|
loadingState.animationFrameId = requestAnimationFrame(function () {
|
|
119901
|
-
|
|
119917
|
+
_this42.loadNextBatch();
|
|
119902
119918
|
});
|
|
119903
|
-
|
|
119919
|
+
_context9.n = 7;
|
|
119904
119920
|
break;
|
|
119905
119921
|
case 6:
|
|
119906
|
-
|
|
119907
|
-
_t2 =
|
|
119922
|
+
_context9.p = 6;
|
|
119923
|
+
_t2 = _context9.v;
|
|
119908
119924
|
console.error('批次处理失败:', _t2);
|
|
119909
119925
|
|
|
119910
119926
|
// 继续下一批次
|
|
119911
119927
|
loadingState.animationFrameId = requestAnimationFrame(function () {
|
|
119912
|
-
|
|
119928
|
+
_this42.loadNextBatch();
|
|
119913
119929
|
});
|
|
119914
119930
|
case 7:
|
|
119915
|
-
return
|
|
119931
|
+
return _context9.a(2);
|
|
119916
119932
|
}
|
|
119917
|
-
},
|
|
119933
|
+
}, _callee9, null, [[4, 6]]);
|
|
119918
119934
|
}))();
|
|
119919
119935
|
},
|
|
119920
119936
|
/**
|
|
119921
119937
|
* 使用主线程处理批次数据
|
|
119922
119938
|
*/
|
|
119923
119939
|
processWithMainThread: function processWithMainThread(batch) {
|
|
119924
|
-
var
|
|
119925
|
-
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function
|
|
119940
|
+
var _this43 = this;
|
|
119941
|
+
return com_graphicsvue_type_script_lang_js_asyncToGenerator(/*#__PURE__*/com_graphicsvue_type_script_lang_js_regenerator().m(function _callee0() {
|
|
119926
119942
|
var loadingState;
|
|
119927
|
-
return com_graphicsvue_type_script_lang_js_regenerator().w(function (
|
|
119928
|
-
while (1) switch (
|
|
119943
|
+
return com_graphicsvue_type_script_lang_js_regenerator().w(function (_context0) {
|
|
119944
|
+
while (1) switch (_context0.n) {
|
|
119929
119945
|
case 0:
|
|
119930
|
-
loadingState =
|
|
119946
|
+
loadingState = _this43.noObserver ? _this43.noObserver.batchLoadingState : _this43.batchLoadingState;
|
|
119931
119947
|
loadingState.options.batchSize = loadingState.batchSize;
|
|
119932
119948
|
loadingState.options.resetState = loadingState.currentBatch === 0;
|
|
119933
119949
|
// 使用原始的handleInstancedMeshModel方法
|
|
119934
119950
|
|
|
119935
119951
|
isDebug && performance.mark('handleInstancedMeshModel-start');
|
|
119936
|
-
|
|
119937
|
-
return handleInstancedMeshModel(modelGroup, batch.instances, batch.drawObjs, '',
|
|
119952
|
+
_context0.n = 1;
|
|
119953
|
+
return handleInstancedMeshModel(_this43.modelGroup, batch.instances, batch.drawObjs, '', _this43.scene, loadingState.color, loadingState.meshNameConfig, '', loadingState.options);
|
|
119938
119954
|
case 1:
|
|
119939
119955
|
isDebug && performance.mark('handleInstancedMeshModel-end');
|
|
119940
119956
|
isDebug && performance.measure('handleInstancedMeshModel', 'handleInstancedMeshModel-start', 'handleInstancedMeshModel-end');
|
|
119941
119957
|
case 2:
|
|
119942
|
-
return
|
|
119958
|
+
return _context0.a(2);
|
|
119943
119959
|
}
|
|
119944
|
-
},
|
|
119960
|
+
}, _callee0);
|
|
119945
119961
|
}))();
|
|
119946
119962
|
},
|
|
119947
119963
|
/**
|
|
119948
119964
|
* 完成批量加载
|
|
119949
119965
|
*/
|
|
119950
119966
|
completeBatchLoading: function completeBatchLoading() {
|
|
119951
|
-
var
|
|
119967
|
+
var _this44 = this;
|
|
119952
119968
|
var loadingState = this.noObserver ? this.noObserver.batchLoadingState : this.batchLoadingState;
|
|
119953
119969
|
if (!loadingState.isLoading) return;
|
|
119954
119970
|
|
|
119955
|
-
// if (modelGroup) {
|
|
119971
|
+
// if (this.modelGroup) {
|
|
119956
119972
|
// if (firstDraw) {
|
|
119957
|
-
// if (scene) scene.add(modelGroup);
|
|
119973
|
+
// if (this.scene) this.scene.add(this.modelGroup);
|
|
119958
119974
|
// firstDraw = false;
|
|
119959
119975
|
// }
|
|
119960
119976
|
// if (!rotatedSceneFlag) {
|
|
119961
119977
|
// rotatedSceneFlag = true;
|
|
119962
119978
|
// }
|
|
119963
|
-
if (modelGroup) {
|
|
119964
|
-
if (!modelGroup.userData.initDone) {
|
|
119965
|
-
|
|
119966
|
-
modelGroup.applyMatrix4(bizToThreeMatrix);
|
|
119967
|
-
modelGroup.updateMatrixWorld();
|
|
119968
|
-
this.smartModelCenter(sceneBoundingBox);
|
|
119979
|
+
if (this.modelGroup) {
|
|
119980
|
+
if (!this.modelGroup.userData.initDone) {
|
|
119981
|
+
this.scene.add(this.modelGroup);
|
|
119982
|
+
this.modelGroup.applyMatrix4(this.bizToThreeMatrix);
|
|
119983
|
+
this.modelGroup.updateMatrixWorld();
|
|
119984
|
+
this.smartModelCenter(this.sceneBoundingBox);
|
|
119969
119985
|
this.setCameraConfig();
|
|
119970
|
-
modelGroup.userData.initDone = true;
|
|
119986
|
+
this.modelGroup.userData.initDone = true;
|
|
119971
119987
|
}
|
|
119972
|
-
modelGroup.updateMatrixWorld();
|
|
119988
|
+
this.modelGroup.updateMatrixWorld();
|
|
119973
119989
|
var modelBox3 = new this.THREE.Box3();
|
|
119974
|
-
modelBox3.expandByObject(modelGroup);
|
|
119990
|
+
modelBox3.expandByObject(this.modelGroup);
|
|
119975
119991
|
var modelWorldPs = new this.THREE.Vector3().addVectors(modelBox3.max, modelBox3.min).multiplyScalar(0.5);
|
|
119976
|
-
modelGroup.userData.modelWorldPs = modelWorldPs;
|
|
119977
|
-
modelGroup.traverse(function (child) {
|
|
119992
|
+
this.modelGroup.userData.modelWorldPs = modelWorldPs;
|
|
119993
|
+
this.modelGroup.traverse(function (child) {
|
|
119978
119994
|
if (child.isMesh && !child.userData.batchInitDone) {
|
|
119979
119995
|
markRendered(child);
|
|
119980
|
-
var json =
|
|
119981
|
-
var meshBox3 = new
|
|
119996
|
+
var json = _this44.getMeshCenterAndVolume(child);
|
|
119997
|
+
var meshBox3 = new _this44.THREE.Box3();
|
|
119982
119998
|
meshBox3.setFromObject(child);
|
|
119983
|
-
var worldPs = new
|
|
119999
|
+
var worldPs = new _this44.THREE.Vector3().addVectors(meshBox3.max, meshBox3.min).multiplyScalar(0.5);
|
|
119984
120000
|
if (isNaN(worldPs.x)) return;
|
|
119985
|
-
child.worldDir = new
|
|
120001
|
+
child.worldDir = new _this44.THREE.Vector3().subVectors(worldPs, modelWorldPs).normalize();
|
|
119986
120002
|
child.userData.center = json.center;
|
|
119987
120003
|
child.userData.worldPs = worldPs;
|
|
119988
|
-
child.userData.oldPs = child.getWorldPosition(new
|
|
120004
|
+
child.userData.oldPs = child.getWorldPosition(new _this44.THREE.Vector3());
|
|
119989
120005
|
child.userData.box = json.box;
|
|
119990
|
-
child.userData.position = new
|
|
120006
|
+
child.userData.position = new _this44.THREE.Vector3().copy(child.position);
|
|
119991
120007
|
child.userData.translate = {
|
|
119992
120008
|
x: 0,
|
|
119993
120009
|
y: 0,
|
|
@@ -120023,7 +120039,7 @@ var isDebug = false || false === true;
|
|
|
120023
120039
|
});
|
|
120024
120040
|
if (isDebug) {
|
|
120025
120041
|
var axesHelper = new this.THREE.AxesHelper(10000);
|
|
120026
|
-
|
|
120042
|
+
this.scene.add(axesHelper);
|
|
120027
120043
|
}
|
|
120028
120044
|
// this.showSceneBoundingBox();
|
|
120029
120045
|
}
|
|
@@ -120058,8 +120074,8 @@ var isDebug = false || false === true;
|
|
|
120058
120074
|
}
|
|
120059
120075
|
|
|
120060
120076
|
// 如果是第一次调用drawModel且用户正在交互,标记需要在交互结束后居中
|
|
120061
|
-
if (modelGroups.length === 0 && userInteracting) {
|
|
120062
|
-
needsCenteringAfterInteraction = true;
|
|
120077
|
+
if (this.modelGroups.length === 0 && this.userInteracting) {
|
|
120078
|
+
this.needsCenteringAfterInteraction = true;
|
|
120063
120079
|
}
|
|
120064
120080
|
|
|
120065
120081
|
// 启动分帧加载
|
|
@@ -120068,11 +120084,11 @@ var isDebug = false || false === true;
|
|
|
120068
120084
|
/**
|
|
120069
120085
|
* 统一的中断控制中心 - 设置中断状态
|
|
120070
120086
|
* @param {boolean} active - 是否激活中断
|
|
120071
|
-
* @param {string} reason - 中断原因 ('wheel', 'camera', 'user_interaction' 等)
|
|
120087
|
+
* @param {string} reason - 中断原因 ('wheel', 'this.camera', 'user_interaction' 等)
|
|
120072
120088
|
* @param {Object} options - 配置项 { immediate: boolean }
|
|
120073
120089
|
*/
|
|
120074
120090
|
setSystemInterruption: function setSystemInterruption(active) {
|
|
120075
|
-
var
|
|
120091
|
+
var _this45 = this;
|
|
120076
120092
|
var reason = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'user_interaction';
|
|
120077
120093
|
var options = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
|
120078
120094
|
var loadingState = this.noObserver ? this.noObserver.batchLoadingState : this.batchLoadingState;
|
|
@@ -120081,8 +120097,8 @@ var isDebug = false || false === true;
|
|
|
120081
120097
|
|
|
120082
120098
|
// 1. 更新交互状态标记
|
|
120083
120099
|
// 如果是相机操作,更新全局标记
|
|
120084
|
-
if (reason === 'camera') {
|
|
120085
|
-
userInteracting = true;
|
|
120100
|
+
if (reason === 'this.camera') {
|
|
120101
|
+
this.userInteracting = true;
|
|
120086
120102
|
}
|
|
120087
120103
|
|
|
120088
120104
|
// 更新 batchLoadingState 中的交互状态
|
|
@@ -120099,8 +120115,8 @@ var isDebug = false || false === true;
|
|
|
120099
120115
|
loadingState.pauseReason = reason;
|
|
120100
120116
|
|
|
120101
120117
|
// 交互期间强制跳过渲染帧,提升响应速度
|
|
120102
|
-
forceSkipRendering = true;
|
|
120103
|
-
skipNextRenderFrame = true;
|
|
120118
|
+
this.forceSkipRendering = true;
|
|
120119
|
+
this.skipNextRenderFrame = true;
|
|
120104
120120
|
|
|
120105
120121
|
// 3. 清理之前的恢复定时器(防止在交互中途意外恢复)
|
|
120106
120122
|
if (loadingState.resumeTimer) {
|
|
@@ -120127,8 +120143,8 @@ var isDebug = false || false === true;
|
|
|
120127
120143
|
|
|
120128
120144
|
// 关键修复:立即更新交互状态,不依赖 doResume 的执行时机
|
|
120129
120145
|
// 这样可以避免当一种交互(如 camera)结束但另一种(如 wheel)仍活跃时,状态无法正确复位的问题
|
|
120130
|
-
if (reason === 'camera') {
|
|
120131
|
-
userInteracting = false;
|
|
120146
|
+
if (reason === 'this.camera') {
|
|
120147
|
+
this.userInteracting = false;
|
|
120132
120148
|
}
|
|
120133
120149
|
|
|
120134
120150
|
// 定义恢复执行逻辑
|
|
@@ -120137,11 +120153,11 @@ var isDebug = false || false === true;
|
|
|
120137
120153
|
// 1. 如果有滚轮定时器未结束,说明还在连续滚动中,不恢复
|
|
120138
120154
|
if (loadingState.interactionState.wheelTimeout) return;
|
|
120139
120155
|
|
|
120140
|
-
// 2. 如果是 wheel 结束,但 userInteracting (camera) 还在进行,则不恢复
|
|
120141
|
-
if (reason === 'wheel' && userInteracting) return;
|
|
120156
|
+
// 2. 如果是 wheel 结束,但 this.userInteracting (this.camera) 还在进行,则不恢复
|
|
120157
|
+
if (reason === 'wheel' && _this45.userInteracting) return;
|
|
120142
120158
|
|
|
120143
120159
|
// 3. 检查是否有强制跳过标记 (可能由其他逻辑触发)
|
|
120144
|
-
// if (forceSkipRendering && reason !== 'user_interaction') return; // 视情况而定
|
|
120160
|
+
// if (this.forceSkipRendering && reason !== 'user_interaction') return; // 视情况而定
|
|
120145
120161
|
|
|
120146
120162
|
// --- 执行恢复 ---
|
|
120147
120163
|
|
|
@@ -120149,15 +120165,15 @@ var isDebug = false || false === true;
|
|
|
120149
120165
|
loadingState.pauseReason = '';
|
|
120150
120166
|
loadingState.interactionState.isInteracting = false;
|
|
120151
120167
|
loadingState.interactionState.interactionType = '';
|
|
120152
|
-
forceSkipRendering = false;
|
|
120168
|
+
_this45.forceSkipRendering = false;
|
|
120153
120169
|
|
|
120154
120170
|
// 恢复本地批量加载 (如果未完成)
|
|
120155
120171
|
if (loadingState.isLoading && loadingState.currentBatch < loadingState.totalBatches) {
|
|
120156
|
-
|
|
120172
|
+
_this45.loadNextBatch();
|
|
120157
120173
|
}
|
|
120158
120174
|
|
|
120159
120175
|
// 恢复 StreamLoader
|
|
120160
|
-
var streamLoader =
|
|
120176
|
+
var streamLoader = _this45.noObserver.streamLoader;
|
|
120161
120177
|
if (streamLoader && typeof streamLoader.handleControlEnd === 'function') {
|
|
120162
120178
|
// StreamLoader 内部通常有防抖或延迟,这里直接通知结束即可
|
|
120163
120179
|
streamLoader.handleControlEnd();
|
|
@@ -120193,7 +120209,7 @@ var isDebug = false || false === true;
|
|
|
120193
120209
|
*/
|
|
120194
120210
|
beginInteraction: function beginInteraction() {
|
|
120195
120211
|
var type = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 'user';
|
|
120196
|
-
var reason = type === 'wheel' ? 'wheel' : type === 'camera' ? 'camera' : 'user_interaction';
|
|
120212
|
+
var reason = type === 'wheel' ? 'wheel' : type === 'this.camera' ? 'this.camera' : 'user_interaction';
|
|
120197
120213
|
this.setSystemInterruption(true, reason);
|
|
120198
120214
|
},
|
|
120199
120215
|
/**
|
|
@@ -120210,7 +120226,7 @@ var isDebug = false || false === true;
|
|
|
120210
120226
|
* 滚轮交互结束的定时检测
|
|
120211
120227
|
*/
|
|
120212
120228
|
scheduleWheelInteractionEnd: function scheduleWheelInteractionEnd(event) {
|
|
120213
|
-
var
|
|
120229
|
+
var _this46 = this;
|
|
120214
120230
|
var delay = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 100;
|
|
120215
120231
|
var loadingState = this.noObserver ? this.noObserver.batchLoadingState : this.batchLoadingState;
|
|
120216
120232
|
if (loadingState.interactionState.wheelTimeout) {
|
|
@@ -120218,8 +120234,8 @@ var isDebug = false || false === true;
|
|
|
120218
120234
|
loadingState.interactionState.wheelTimeout = null;
|
|
120219
120235
|
}
|
|
120220
120236
|
loadingState.interactionState.wheelTimeout = setTimeout(function () {
|
|
120221
|
-
|
|
120222
|
-
|
|
120237
|
+
_this46.$emit('wheelEnd', event);
|
|
120238
|
+
_this46.endInteraction('wheel', event, {
|
|
120223
120239
|
immediateResume: false
|
|
120224
120240
|
});
|
|
120225
120241
|
loadingState.interactionState.wheelTimeout = null;
|
|
@@ -120251,10 +120267,10 @@ var isDebug = false || false === true;
|
|
|
120251
120267
|
* 隐藏场景包围盒
|
|
120252
120268
|
*/
|
|
120253
120269
|
hideSceneBoundingBox: function hideSceneBoundingBox() {
|
|
120254
|
-
if (sceneBoundingBoxHelper &&
|
|
120255
|
-
|
|
120256
|
-
sceneBoundingBoxHelper = null;
|
|
120257
|
-
boundingBoxVisible = false;
|
|
120270
|
+
if (this.sceneBoundingBoxHelper && this.scene) {
|
|
120271
|
+
this.scene.remove(this.sceneBoundingBoxHelper);
|
|
120272
|
+
this.sceneBoundingBoxHelper = null;
|
|
120273
|
+
this.boundingBoxVisible = false;
|
|
120258
120274
|
console.log('场景包围盒已隐藏');
|
|
120259
120275
|
}
|
|
120260
120276
|
},
|
|
@@ -120262,7 +120278,7 @@ var isDebug = false || false === true;
|
|
|
120262
120278
|
* 切换场景包围盒显示状态
|
|
120263
120279
|
*/
|
|
120264
120280
|
toggleSceneBoundingBox: function toggleSceneBoundingBox() {
|
|
120265
|
-
if (boundingBoxVisible) {
|
|
120281
|
+
if (this.boundingBoxVisible) {
|
|
120266
120282
|
this.hideSceneBoundingBox();
|
|
120267
120283
|
} else {
|
|
120268
120284
|
this.showSceneBoundingBox();
|
|
@@ -120272,11 +120288,11 @@ var isDebug = false || false === true;
|
|
|
120272
120288
|
});
|
|
120273
120289
|
// CONCATENATED MODULE: ./packages/components/com-graphics/index.vue?vue&type=script&lang=js
|
|
120274
120290
|
/* harmony default export */ var components_com_graphicsvue_type_script_lang_js = (com_graphicsvue_type_script_lang_js);
|
|
120275
|
-
// EXTERNAL MODULE: ./packages/components/com-graphics/index.vue?vue&type=style&index=0&id=
|
|
120276
|
-
var
|
|
120291
|
+
// EXTERNAL MODULE: ./packages/components/com-graphics/index.vue?vue&type=style&index=0&id=701092d4&prod&lang=scss&scoped=true
|
|
120292
|
+
var com_graphicsvue_type_style_index_0_id_701092d4_prod_lang_scss_scoped_true = __webpack_require__("7555");
|
|
120277
120293
|
|
|
120278
|
-
// EXTERNAL MODULE: ./packages/components/com-graphics/index.vue?vue&type=style&index=1&id=
|
|
120279
|
-
var
|
|
120294
|
+
// EXTERNAL MODULE: ./packages/components/com-graphics/index.vue?vue&type=style&index=1&id=701092d4&prod&lang=css
|
|
120295
|
+
var com_graphicsvue_type_style_index_1_id_701092d4_prod_lang_css = __webpack_require__("1ebb");
|
|
120280
120296
|
|
|
120281
120297
|
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
|
|
120282
120298
|
/* globals __VUE_SSR_CONTEXT__ */
|
|
@@ -120388,17 +120404,17 @@ function normalizeComponent(
|
|
|
120388
120404
|
|
|
120389
120405
|
var component = normalizeComponent(
|
|
120390
120406
|
components_com_graphicsvue_type_script_lang_js,
|
|
120391
|
-
|
|
120407
|
+
com_graphicsvue_type_template_id_701092d4_scoped_true_render,
|
|
120392
120408
|
staticRenderFns,
|
|
120393
120409
|
false,
|
|
120394
120410
|
null,
|
|
120395
|
-
"
|
|
120411
|
+
"701092d4",
|
|
120396
120412
|
null
|
|
120397
120413
|
|
|
120398
120414
|
)
|
|
120399
120415
|
|
|
120400
120416
|
/* harmony default export */ var com_graphics = (component.exports);
|
|
120401
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
120417
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"4b508e4e-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-flcanvas/index.vue?vue&type=template&id=7c2dd8bb&scoped=true
|
|
120402
120418
|
var com_flcanvasvue_type_template_id_7c2dd8bb_scoped_true_render = function render() {
|
|
120403
120419
|
var _vm = this,
|
|
120404
120420
|
_c = _vm._self._c;
|
|
@@ -124320,7 +124336,7 @@ var com_flcanvas_component = normalizeComponent(
|
|
|
124320
124336
|
)
|
|
124321
124337
|
|
|
124322
124338
|
/* harmony default export */ var com_flcanvas = (com_flcanvas_component.exports);
|
|
124323
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
124339
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"4b508e4e-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/per-control.vue?vue&type=template&id=f547d5c6&scoped=true
|
|
124324
124340
|
var per_controlvue_type_template_id_f547d5c6_scoped_true_render = function render() {
|
|
124325
124341
|
var _vm = this,
|
|
124326
124342
|
_c = _vm._self._c;
|
|
@@ -124428,7 +124444,7 @@ var per_control_component = normalizeComponent(
|
|
|
124428
124444
|
)
|
|
124429
124445
|
|
|
124430
124446
|
/* harmony default export */ var per_control = (per_control_component.exports);
|
|
124431
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
124447
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"4b508e4e-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/pid.vue?vue&type=template&id=2572c0e2&scoped=true
|
|
124432
124448
|
var pidvue_type_template_id_2572c0e2_scoped_true_render = function render() {
|
|
124433
124449
|
var _vm = this,
|
|
124434
124450
|
_c = _vm._self._c;
|
|
@@ -124475,7 +124491,7 @@ var browserify_default = /*#__PURE__*/__webpack_require__.n(browserify);
|
|
|
124475
124491
|
var html2canvas = __webpack_require__("c0e9");
|
|
124476
124492
|
var html2canvas_default = /*#__PURE__*/__webpack_require__.n(html2canvas);
|
|
124477
124493
|
|
|
124478
|
-
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"
|
|
124494
|
+
// CONCATENATED MODULE: ./node_modules/cache-loader/dist/cjs.js?{"cacheDirectory":"node_modules/.cache/vue-loader","cacheIdentifier":"4b508e4e-vue-loader-template"}!./node_modules/cache-loader/dist/cjs.js??ref--12-0!./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/loaders/templateLoader.js??ref--6!./node_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue-loader-options!./packages/components/com-graphics/component/ann-tool.vue?vue&type=template&id=4b17bce0&scoped=true
|
|
124479
124495
|
var ann_toolvue_type_template_id_4b17bce0_scoped_true_render = function render() {
|
|
124480
124496
|
var _vm = this,
|
|
124481
124497
|
_c = _vm._self._c;
|
|
@@ -125099,7 +125115,7 @@ var svgCon = {},
|
|
|
125099
125115
|
svgEmbed = {};
|
|
125100
125116
|
var preTargetCon = [],
|
|
125101
125117
|
preTargetStyle = [];
|
|
125102
|
-
var
|
|
125118
|
+
var firstTime = 0,
|
|
125103
125119
|
pidvue_type_script_lang_js_lastTime = 0;
|
|
125104
125120
|
var inspectionRect = null,
|
|
125105
125121
|
pointerRect = null;
|
|
@@ -125185,7 +125201,7 @@ var inspectionRect = null,
|
|
|
125185
125201
|
},
|
|
125186
125202
|
// 鼠标按下
|
|
125187
125203
|
mousedown: function mousedown() {
|
|
125188
|
-
|
|
125204
|
+
firstTime = new Date().getTime();
|
|
125189
125205
|
},
|
|
125190
125206
|
// 鼠标抬起
|
|
125191
125207
|
mouseup: function mouseup(evt) {
|
|
@@ -125193,7 +125209,7 @@ var inspectionRect = null,
|
|
|
125193
125209
|
pidvue_type_script_lang_js_lastTime = new Date().getTime();
|
|
125194
125210
|
var targetElement = null;
|
|
125195
125211
|
// 判断鼠标按下到抬起的时间间隔是否超过300ms 没有超过 则判断为点击
|
|
125196
|
-
if (pidvue_type_script_lang_js_lastTime -
|
|
125212
|
+
if (pidvue_type_script_lang_js_lastTime - firstTime <= 300) {
|
|
125197
125213
|
if (evt.target.nodeName !== 'svg') {
|
|
125198
125214
|
targetElement = evt.target;
|
|
125199
125215
|
} else {
|