@realsee/dnalogel 0.1.2 → 0.1.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/components/ARVideoFigure/ARVideoFigureMesh.js +56 -32
- package/components/ARVideoFigure/ARVideoFigureScene.js +30 -19
- package/components/ARVideoFigure/ImgBgTransparent.js +22 -6
- package/components/ARVideoFigure/ImgBgTransparentMesh.js +40 -30
- package/components/ARVideoFigure/fragmentShader.js +2 -0
- package/components/ARVideoFigure/index.js +22 -6
- package/components/ARVideoFigure/vertexShader.js +2 -0
- package/components/GLTFView/index.d.ts +72 -0
- package/components/GLTFView/index.js +149 -0
- package/components/GlassFilters/index.js +25 -1
- package/components/ModelView/ModelViewController.js +39 -29
- package/components/ModelView/index.js +4 -2
- package/components/PaintBrush/index.js +15 -1
- package/components/PanoTag/index.js +2 -0
- package/data/1aGKl9JmrlXMXx8d.js +2 -0
- package/data/54djM0oR6ky3Ey8e.d.ts +55 -0
- package/data/54djM0oR6ky3Ey8e.js +350 -0
- package/data/6gyq3v1verxD7JO1.js +2 -0
- package/data/8054djM0oR6ky3Ey8e.d.ts +55 -0
- package/data/8054djM0oR6ky3Ey8e.js +350 -0
- package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.js +2 -0
- package/data/PrXel3aqGbp34JQn.js +2 -0
- package/data/XJ6NMLWnkAY3Rdx8.d.ts +843 -0
- package/data/XJ6NMLWnkAY3Rdx8.js +7989 -0
- package/data/YdoNP9K4rwQDwjJr.js +2 -0
- package/data/ZLvK29zj4L29Jowd.d.ts +55 -0
- package/data/ZLvK29zj4L29Jowd.js +372 -0
- package/data/auto3d-njL5J99VwCmnjtQElOmXQr.js +2 -0
- package/data/extrude-walls/ZLvK29zj4L29Jowd.d.ts +5 -0
- package/data/extrude-walls/ZLvK29zj4L29Jowd.js +14 -0
- package/data/extrude-walls/lo024DEgzanMj5BE.d.ts +5 -0
- package/data/extrude-walls/lo024DEgzanMj5BE.js +14 -0
- package/data/jd6oMOzPxnQ3BvxY_B7yw51J9rXlhYhjhGTOgRVqu6WeEqjNX.d.ts +85 -0
- package/data/jd6oMOzPxnQ3BvxY_B7yw51J9rXlhYhjhGTOgRVqu6WeEqjNX.js +511 -0
- package/data/lo024DEgzanMj5BE.d.ts +55 -0
- package/data/lo024DEgzanMj5BE.js +966 -0
- package/data/oPzy3ApbjjpD8YdR.js +2 -0
- package/data/qjAxMG4XbPn96wKG.js +2 -0
- package/data/rXel3aPQRRBD4JQn.js +2 -0
- package/data/vLykj3NWrllMrG06.d.ts +2 -0
- package/data/vLykj3NWrllMrG06.js +199 -2
- package/data/wz0QV9KA4ugyo9ME.js +2 -0
- package/data/zxMawr9raSg8LYjG.d.ts +53 -0
- package/data/zxMawr9raSg8LYjG.js +590 -0
- package/examples/FiveStateController/index.js +9 -15
- package/examples/VRHouse/Mobile.js +15 -1
- package/examples/VRHouse/PC.js +15 -1
- package/examples/VRHouse/index.js +15 -1
- package/index.js +4 -2
- package/libs/gltf-viewer/Subscribe.d.ts +76 -0
- package/libs/gltf-viewer/Subscribe.js +231 -0
- package/libs/gltf-viewer/coordsMoveByOffset.d.ts +13 -0
- package/libs/gltf-viewer/coordsMoveByOffset.js +22 -0
- package/libs/gltf-viewer/coordsToDirection.d.ts +5 -0
- package/{components/PBRView/index.js → libs/gltf-viewer/coordsToDirection.js} +29 -19
- package/libs/gltf-viewer/formatRad.d.ts +1 -0
- package/libs/gltf-viewer/formatRad.js +13 -0
- package/libs/gltf-viewer/getFrameTime.d.ts +1 -0
- package/libs/gltf-viewer/getFrameTime.js +28 -0
- package/libs/gltf-viewer/index.d.ts +55 -0
- package/libs/gltf-viewer/index.js +650 -0
- package/libs/gltf-viewer/mouseWheel.d.ts +2 -0
- package/libs/gltf-viewer/mouseWheel.js +59 -0
- package/libs/gltf-viewer/requestAnimationFrame.d.ts +1 -0
- package/libs/gltf-viewer/requestAnimationFrame.js +18 -0
- package/libs/gltf-viewer/requestAnimationFrameInterval.d.ts +1 -0
- package/libs/gltf-viewer/requestAnimationFrameInterval.js +31 -0
- package/libs/gltf-viewer/uuid.d.ts +4 -0
- package/libs/gltf-viewer/uuid.js +28 -0
- package/package.json +8 -4
- package/plugins/AutoPreloadPlugin/index.d.ts +23 -0
- package/plugins/AutoPreloadPlugin/index.js +111 -0
- package/plugins/CSS3DRenderPlugin/components/Marker/index.js +24 -16
- package/plugins/CSS3DRenderPlugin/index.d.ts +3 -2
- package/plugins/CSS3DRenderPlugin/index.js +79 -46
- package/plugins/CameraMovementPlugin/index.js +33 -9
- package/plugins/CameraMovementPlugin/typing.js +2 -0
- package/plugins/ModelChassisCompassPlugin/index.d.ts +7 -3
- package/plugins/ModelChassisCompassPlugin/index.js +34 -33
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +13 -1
- package/plugins/ModelEntryDoorGuidePlugin/index.js +233 -2
- package/plugins/ModelExtrudeWallsPlugin/index.d.ts +16 -0
- package/plugins/ModelExtrudeWallsPlugin/index.js +252 -0
- package/plugins/ModelRoomLabelPlugin/Controller.d.ts +35 -0
- package/plugins/ModelRoomLabelPlugin/Controller.js +153 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItem.d.ts +8 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItem.js +66 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItems.d.ts +7 -0
- package/plugins/ModelRoomLabelPlugin/RoomLabelItems.js +159 -0
- package/plugins/ModelRoomLabelPlugin/index.d.ts +8 -0
- package/plugins/ModelRoomLabelPlugin/index.js +18 -0
- package/plugins/ModelRoomLabelPlugin/typings.d.ts +35 -0
- package/plugins/ModelRoomLabelPlugin/typings.js +7 -0
- package/plugins/ModelRoomLabelPlugin/utils/parseData.d.ts +3 -0
- package/plugins/ModelRoomLabelPlugin/utils/parseData.js +35 -0
- package/plugins/ModelTVVideoPlugin/index.js +100 -16
- package/plugins/ModelViewPlugin/index.js +25 -1
- package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.js +29 -25
- package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.js +15 -1
- package/plugins/PanoCursorRaycasterPlugin/index.js +13 -6
- package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.js +4 -2
- package/plugins/PanoCursorRaycasterPlugin/utils/createLine.js +15 -1
- package/plugins/PanoDoorLabelPlugin/index.js +2 -0
- package/plugins/PanoIRobotPlugin/index.js +2 -0
- package/plugins/PanoMaskSelectorPlugin/compare.d.ts +1 -0
- package/plugins/PanoMaskSelectorPlugin/compare.js +17 -0
- package/plugins/PanoMaskSelectorPlugin/createBox.d.ts +7 -0
- package/plugins/PanoMaskSelectorPlugin/createBox.js +79 -0
- package/plugins/PanoMaskSelectorPlugin/createTextures.d.ts +3 -0
- package/plugins/PanoMaskSelectorPlugin/createTextures.js +45 -0
- package/plugins/PanoMaskSelectorPlugin/fragmentShader.d.ts +1 -0
- package/plugins/PanoMaskSelectorPlugin/fragmentShader.js +10 -0
- package/plugins/PanoMaskSelectorPlugin/index.d.ts +49 -0
- package/plugins/PanoMaskSelectorPlugin/index.js +348 -0
- package/plugins/PanoMaskSelectorPlugin/vertexShader.d.ts +1 -0
- package/plugins/PanoMaskSelectorPlugin/vertexShader.js +10 -0
- package/plugins/PanoRulerPlugin/data/roomInfo.js +2 -0
- package/plugins/PanoRulerPlugin/data/roomRules.js +2 -0
- package/plugins/PanoRulerPlugin/index.js +68 -20
- package/plugins/PanoRulerPlugin/typings.js +2 -0
- package/plugins/PanoTVVideoPlugin/index.d.ts +2 -0
- package/plugins/PanoTVVideoPlugin/index.js +108 -26
- package/plugins/TreasurePlugin/Controller.js +58 -52
- package/plugins/TreasurePlugin/TreasureFaceAnime.js +36 -21
- package/plugins/TreasurePlugin/TreasureObject.js +60 -56
- package/plugins/TreasurePlugin/TreasureOpenAnime.js +38 -19
- package/plugins/TreasurePlugin/constants.js +2 -0
- package/plugins/TreasurePlugin/index.js +2 -0
- package/plugins/TreasurePlugin/typings.js +2 -0
- package/plugins/floorplan/Assets/floorplanExtraObject.js +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +71 -88
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +25 -5
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +19 -4
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +28 -4
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +28 -5
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +20 -6
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +30 -8
- package/plugins/floorplan/ModelFloorplanPlugin/controller.style.js +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/index.js +4 -2
- package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.js +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +2 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +14 -22
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +25 -3
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +6 -2
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +19 -3
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +28 -4
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +22 -6
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +29 -19
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.js +2 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.js +44 -47
- package/plugins/floorplan/PanoFloorplanRadarPlugin/index.js +4 -2
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +50 -55
- package/plugins/floorplan/TopviewFloorplanPlugin/index.js +2 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/style.js +2 -0
- package/plugins/floorplan/components/FloorplanImage.js +15 -1
- package/plugins/floorplan/typings/floorplanData.js +2 -0
- package/plugins/floorplan/typings/floorplanServerData.js +2 -0
- package/plugins/floorplan/utils/formatData.js +28 -10
- package/plugins/floorplan/utils/formatPosition.js +10 -8
- package/shared-utils/Preloader.js +6 -0
- package/shared-utils/Subscribe.js +36 -16
- package/shared-utils/animationFrame/BetterTween.js +28 -27
- package/shared-utils/animationFrame/calculateProgress.js +2 -0
- package/shared-utils/animationFrame/formatRad.js +2 -0
- package/shared-utils/animationFrame/index.js +12 -0
- package/shared-utils/animationFrame/tween.js +17 -1
- package/shared-utils/changeModelCanvansOpacity.js +14 -0
- package/shared-utils/createCanvasTextTexture.d.ts +8 -0
- package/shared-utils/createCanvasTextTexture.js +31 -0
- package/shared-utils/createFiveContainer.js +23 -17
- package/shared-utils/createLine/index.js +15 -1
- package/shared-utils/debounce.js +4 -0
- package/shared-utils/equal.js +15 -4
- package/shared-utils/filter.js +36 -2
- package/shared-utils/five/changeMode.js +13 -17
- package/shared-utils/five/useFivePlugin.js +2 -0
- package/shared-utils/formatRad.js +2 -0
- package/shared-utils/getPxmm.js +15 -1
- package/shared-utils/getRandomColor.js +10 -0
- package/shared-utils/isNil.js +2 -0
- package/shared-utils/isTruelyObject.js +4 -0
- package/shared-utils/math/evenNumber.js +2 -0
- package/shared-utils/math/planimetry.js +10 -0
- package/shared-utils/math/rad2Deg.js +2 -0
- package/shared-utils/nearlyEqual.js +2 -0
- package/shared-utils/nextFrame.js +2 -0
- package/shared-utils/noop.js +2 -0
- package/shared-utils/object3d2LocalMatrix.js +20 -14
- package/shared-utils/px2rem.js +10 -0
- package/shared-utils/tap.js +2 -0
- package/shared-utils/three/centerPoint.js +2 -0
- package/shared-utils/three/getExtraModelLoader.js +14 -0
- package/shared-utils/three/getNormal.js +4 -0
- package/shared-utils/three/getTextureLoader.js +16 -0
- package/shared-utils/three/loadFbxObj.js +13 -5
- package/shared-utils/three/loadTexture.js +13 -5
- package/shared-utils/three/transformPositionToVector3.js +2 -0
- package/shared-utils/three/transfromToMeshBasicMaterial.d.ts +2 -0
- package/shared-utils/three/transfromToMeshBasicMaterial.js +33 -0
- package/shared-utils/throttle.js +4 -0
- package/shared-utils/to.js +8 -4
- package/shared-utils/useDebounce.js +6 -0
- package/shared-utils/useThrottle.js +6 -0
- package/shared-utils/uuid.js +8 -0
- package/shared-utils/vectorTocoordinates.js +2 -0
- package/typedoc/components.js +2 -0
- package/typedoc/plugins.d.ts +2 -0
- package/typedoc/plugins.js +41 -1
- package/typedoc/shared-utils.js +2 -0
- package/typedoc/typings.js +2 -0
- package/typings/math.type.js +2 -0
- package/typings/utils.type.js +2 -0
- package/components/PBRView/index.d.ts +0 -14
- package/data/wYnRjQ4KZoV1yPoG.d.ts +0 -114
- package/data/wYnRjQ4KZoV1yPoG.js +0 -512
|
@@ -1,47 +1,63 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
require("core-js/modules/es.array.iterator.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.object.to-string.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.string.iterator.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.weak-map.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.object.define-property.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
16
|
+
|
|
17
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
18
|
+
|
|
19
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
4
20
|
|
|
5
21
|
Object.defineProperty(exports, "__esModule", {
|
|
6
22
|
value: true
|
|
7
23
|
});
|
|
8
24
|
exports["default"] = void 0;
|
|
9
25
|
|
|
26
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
27
|
+
|
|
28
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
29
|
+
|
|
10
30
|
var THREE = _interopRequireWildcard(require("three"));
|
|
11
31
|
|
|
12
32
|
var _FBXLoader = require("three/examples/jsm/loaders/FBXLoader");
|
|
13
33
|
|
|
14
34
|
var _object3d2LocalMatrix = _interopRequireDefault(require("../../shared-utils/object3d2LocalMatrix"));
|
|
15
35
|
|
|
16
|
-
|
|
36
|
+
var _transfromToMeshBasicMaterial = _interopRequireDefault(require("../../shared-utils/three/transfromToMeshBasicMaterial"));
|
|
17
37
|
|
|
18
38
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
39
|
|
|
20
40
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
41
|
|
|
22
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
23
|
-
|
|
24
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
25
|
-
|
|
26
42
|
/**
|
|
27
43
|
* 模型底盘指南针插件
|
|
28
44
|
*/
|
|
29
45
|
var ModelChassisCompassPlugin = function ModelChassisCompassPlugin(five, params) {
|
|
30
|
-
var defaultFbxUrl = params.
|
|
31
|
-
var defaultNorthRad = params.
|
|
46
|
+
var defaultFbxUrl = params.fbx_url || '//vrlab-static.ljcdn.com/release/web/v3/dipan3/dipan.FBX';
|
|
47
|
+
var defaultNorthRad = params.north_rad || undefined; // 局部状态
|
|
32
48
|
|
|
33
49
|
var state = {};
|
|
34
50
|
|
|
35
51
|
var load = /*#__PURE__*/function () {
|
|
36
|
-
var _ref =
|
|
37
|
-
var bounding, xOffset, zOffset, maxOffset, fbxLoader, object, rotation, _five$model$bounding, _five$model$bounding$, xMax, zMax, _five$model$bounding$2, xMin, yMin, zMin, position, scale;
|
|
52
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
|
|
53
|
+
var fbxUrl, northRad, bounding, xOffset, zOffset, maxOffset, fbxLoader, object, rotation, _five$model$bounding, _five$model$bounding$, xMax, zMax, _five$model$bounding$2, xMin, yMin, zMin, position, scale;
|
|
38
54
|
|
|
39
|
-
return
|
|
55
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
40
56
|
while (1) {
|
|
41
57
|
switch (_context.prev = _context.next) {
|
|
42
58
|
case 0:
|
|
43
|
-
fbxUrl =
|
|
44
|
-
northRad =
|
|
59
|
+
fbxUrl = (data === null || data === void 0 ? void 0 : data.fbx_url) || defaultFbxUrl;
|
|
60
|
+
northRad = (data === null || data === void 0 ? void 0 : data.north_rad) || defaultNorthRad;
|
|
45
61
|
|
|
46
62
|
if (northRad) {
|
|
47
63
|
_context.next = 4;
|
|
@@ -61,25 +77,10 @@ var ModelChassisCompassPlugin = function ModelChassisCompassPlugin(five, params)
|
|
|
61
77
|
|
|
62
78
|
case 11:
|
|
63
79
|
object = _context.sent;
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
var mesh = ele;
|
|
69
|
-
var materialConf = Object.assign({
|
|
70
|
-
map: mesh.material.map || {}
|
|
71
|
-
}, {
|
|
72
|
-
transparent: true,
|
|
73
|
-
side: THREE.DoubleSide,
|
|
74
|
-
blending: THREE.AdditiveBlending
|
|
75
|
-
});
|
|
76
|
-
mesh.material = new THREE.MeshBasicMaterial(materialConf);
|
|
77
|
-
mesh.renderOrder = 1;
|
|
78
|
-
|
|
79
|
-
if (((_ele$parent = ele.parent) === null || _ele$parent === void 0 ? void 0 : _ele$parent.type) === 'Mesh') {
|
|
80
|
-
ele.renderOrder = ele.parent.renderOrder + 1;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
80
|
+
(0, _transfromToMeshBasicMaterial["default"])(object, {
|
|
81
|
+
transparent: true,
|
|
82
|
+
side: THREE.DoubleSide,
|
|
83
|
+
blending: THREE.AdditiveBlending
|
|
83
84
|
});
|
|
84
85
|
rotation = [0, northRad - Math.PI / 2, 0];
|
|
85
86
|
_five$model$bounding = five.model.bounding, _five$model$bounding$ = _five$model$bounding.max, xMax = _five$model$bounding$.x, zMax = _five$model$bounding$.z, _five$model$bounding$2 = _five$model$bounding.min, xMin = _five$model$bounding$2.x, yMin = _five$model$bounding$2.y, zMin = _five$model$bounding$2.z;
|
|
@@ -106,7 +107,7 @@ var ModelChassisCompassPlugin = function ModelChassisCompassPlugin(five, params)
|
|
|
106
107
|
}, _callee);
|
|
107
108
|
}));
|
|
108
109
|
|
|
109
|
-
return function load(_x
|
|
110
|
+
return function load(_x) {
|
|
110
111
|
return _ref.apply(this, arguments);
|
|
111
112
|
};
|
|
112
113
|
}();
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import type { FivePlugin } from '@realsee/five';
|
|
2
|
-
|
|
2
|
+
import { Vector3Position } from '../../typings/math.type';
|
|
3
|
+
export interface ModelEntryDoorGuidePluginData {
|
|
4
|
+
position?: Vector3Position;
|
|
5
|
+
rad?: number;
|
|
6
|
+
fbx_url?: string;
|
|
3
7
|
}
|
|
8
|
+
export declare type ModelEntryDoorGuidePluginParameterType = {
|
|
9
|
+
animationEnabled?: boolean;
|
|
10
|
+
} & ModelEntryDoorGuidePluginData;
|
|
4
11
|
export interface ModelEntryDoorGuidePluginExportType {
|
|
12
|
+
enable: (config?: {
|
|
13
|
+
animationEnable?: boolean;
|
|
14
|
+
}) => boolean;
|
|
15
|
+
disable: () => boolean;
|
|
16
|
+
load: (data?: Partial<ModelEntryDoorGuidePluginData>) => Promise<boolean>;
|
|
5
17
|
}
|
|
6
18
|
/**
|
|
7
19
|
* 模型入户门引导插件
|
|
@@ -1,15 +1,246 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
require("core-js/modules/es.array.iterator.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.string.iterator.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.weak-map.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/es.object.define-property.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
14
|
+
|
|
15
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
16
|
+
|
|
17
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
18
|
+
|
|
3
19
|
Object.defineProperty(exports, "__esModule", {
|
|
4
20
|
value: true
|
|
5
21
|
});
|
|
6
22
|
exports["default"] = void 0;
|
|
7
23
|
|
|
24
|
+
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
25
|
+
|
|
26
|
+
require("core-js/modules/es.object.to-string.js");
|
|
27
|
+
|
|
28
|
+
require("core-js/modules/es.promise.js");
|
|
29
|
+
|
|
30
|
+
require("core-js/modules/es.array.for-each.js");
|
|
31
|
+
|
|
32
|
+
var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
|
|
33
|
+
|
|
34
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
35
|
+
|
|
36
|
+
var _FBXLoader = require("three/examples/jsm/loaders/FBXLoader");
|
|
37
|
+
|
|
38
|
+
var _createCanvasTextTexture = _interopRequireDefault(require("../../shared-utils/createCanvasTextTexture"));
|
|
39
|
+
|
|
40
|
+
var _transformPositionToVector = _interopRequireDefault(require("../../shared-utils/three/transformPositionToVector3"));
|
|
41
|
+
|
|
42
|
+
var _transfromToMeshBasicMaterial = _interopRequireDefault(require("../../shared-utils/three/transfromToMeshBasicMaterial"));
|
|
43
|
+
|
|
44
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
45
|
+
|
|
46
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
|
+
|
|
8
48
|
/**
|
|
9
49
|
* 模型入户门引导插件
|
|
10
50
|
*/
|
|
11
|
-
var ModelEntryDoorGuidePlugin = function ModelEntryDoorGuidePlugin() {
|
|
12
|
-
|
|
51
|
+
var ModelEntryDoorGuidePlugin = function ModelEntryDoorGuidePlugin(five, params) {
|
|
52
|
+
var _params$animationEnab, _params$position, _params$rad;
|
|
53
|
+
|
|
54
|
+
// 局部状态
|
|
55
|
+
var state = {};
|
|
56
|
+
var defaultAnimationEnable = (_params$animationEnab = params.animationEnabled) !== null && _params$animationEnab !== void 0 ? _params$animationEnab : true;
|
|
57
|
+
var defaultModelPosition = (_params$position = params.position) !== null && _params$position !== void 0 ? _params$position : undefined;
|
|
58
|
+
var defaultRad = (_params$rad = params.rad) !== null && _params$rad !== void 0 ? _params$rad : undefined;
|
|
59
|
+
var defaultFbxUrl = params.fbx_url || '//vrlab-image4.ljcdn.com/release/web/entryDoorMini/Anim_Door1.fbx';
|
|
60
|
+
var mixers = [];
|
|
61
|
+
|
|
62
|
+
var load = /*#__PURE__*/function () {
|
|
63
|
+
var _ref = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(data) {
|
|
64
|
+
var _data$position, _data$rad, _data$fbx_url, _object$children, _object$children$, _object$children$$chi, _object$children$$chi2;
|
|
65
|
+
|
|
66
|
+
var position, modelPosition, rad, fbxUrl, object, textMesh;
|
|
67
|
+
return _regenerator["default"].wrap(function _callee$(_context) {
|
|
68
|
+
while (1) {
|
|
69
|
+
switch (_context.prev = _context.next) {
|
|
70
|
+
case 0:
|
|
71
|
+
position = (_data$position = data === null || data === void 0 ? void 0 : data.position) !== null && _data$position !== void 0 ? _data$position : defaultModelPosition;
|
|
72
|
+
|
|
73
|
+
if (position) {
|
|
74
|
+
_context.next = 3;
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return _context.abrupt("return", Promise.reject("ModelEntryDoorGuidePlugin.load(): position is undefined"));
|
|
79
|
+
|
|
80
|
+
case 3:
|
|
81
|
+
modelPosition = (0, _transformPositionToVector["default"])(position);
|
|
82
|
+
rad = (_data$rad = data === null || data === void 0 ? void 0 : data.rad) !== null && _data$rad !== void 0 ? _data$rad : defaultRad;
|
|
83
|
+
fbxUrl = (_data$fbx_url = data === null || data === void 0 ? void 0 : data.fbx_url) !== null && _data$fbx_url !== void 0 ? _data$fbx_url : defaultFbxUrl;
|
|
84
|
+
state.rad = rad;
|
|
85
|
+
|
|
86
|
+
if (!(rad === undefined)) {
|
|
87
|
+
_context.next = 9;
|
|
88
|
+
break;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
return _context.abrupt("return", Promise.reject("ModelEntryDoorGuidePlugin.load(): rad is ".concat(rad)));
|
|
92
|
+
|
|
93
|
+
case 9:
|
|
94
|
+
_context.next = 11;
|
|
95
|
+
return new _FBXLoader.FBXLoader().loadAsync(fbxUrl);
|
|
96
|
+
|
|
97
|
+
case 11:
|
|
98
|
+
object = _context.sent;
|
|
99
|
+
// 设置位置
|
|
100
|
+
object.position.copy(modelPosition);
|
|
101
|
+
object.rotation.z = rad;
|
|
102
|
+
object.scale.set(0.8, 0.8, 0.8);
|
|
103
|
+
(0, _transfromToMeshBasicMaterial["default"])(object, {
|
|
104
|
+
transparent: true,
|
|
105
|
+
side: THREE.DoubleSide
|
|
106
|
+
});
|
|
107
|
+
textMesh = (_object$children = object.children) === null || _object$children === void 0 ? void 0 : (_object$children$ = _object$children[0]) === null || _object$children$ === void 0 ? void 0 : (_object$children$$chi = _object$children$.children) === null || _object$children$$chi === void 0 ? void 0 : (_object$children$$chi2 = _object$children$$chi[3]) === null || _object$children$$chi2 === void 0 ? void 0 : _object$children$$chi2.clone();
|
|
108
|
+
|
|
109
|
+
if (textMesh) {
|
|
110
|
+
_context.next = 19;
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
return _context.abrupt("return", Promise.reject("ModelEntryDoorGuidePlugin.load(): textMesh is ".concat(textMesh)));
|
|
115
|
+
|
|
116
|
+
case 19:
|
|
117
|
+
textMesh.material = new THREE.MeshBasicMaterial({
|
|
118
|
+
transparent: true,
|
|
119
|
+
map: (0, _createCanvasTextTexture["default"])('入户门')
|
|
120
|
+
});
|
|
121
|
+
textMesh.renderOrder = 3;
|
|
122
|
+
object.children[0].add(textMesh);
|
|
123
|
+
state.object = object;
|
|
124
|
+
return _context.abrupt("return", true);
|
|
125
|
+
|
|
126
|
+
case 24:
|
|
127
|
+
case "end":
|
|
128
|
+
return _context.stop();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}, _callee);
|
|
132
|
+
}));
|
|
133
|
+
|
|
134
|
+
return function load(_x) {
|
|
135
|
+
return _ref.apply(this, arguments);
|
|
136
|
+
};
|
|
137
|
+
}();
|
|
138
|
+
|
|
139
|
+
var initAnimation = function initAnimation() {
|
|
140
|
+
if (state.animation) return;
|
|
141
|
+
if (!state.object) return console.error('ModelEntryDoorGuidePlugin.initAnimation(): state.object is ', state.object); // action
|
|
142
|
+
|
|
143
|
+
var animationSpeed = 1;
|
|
144
|
+
var mixer = new THREE.AnimationMixer(state.object);
|
|
145
|
+
mixers.push(mixer);
|
|
146
|
+
var action = mixer.clipAction(state.object.animations[0]);
|
|
147
|
+
action.timeScale = animationSpeed;
|
|
148
|
+
var stopAnimation;
|
|
149
|
+
|
|
150
|
+
var requestAnimationFrameLoop = function requestAnimationFrameLoop() {
|
|
151
|
+
var index = 0;
|
|
152
|
+
var oldTime = 0;
|
|
153
|
+
var minDeltaTime = 1000 / 30;
|
|
154
|
+
|
|
155
|
+
var animation = function animation(time) {
|
|
156
|
+
index = requestAnimationFrame(animation);
|
|
157
|
+
var deltaTime = time - oldTime;
|
|
158
|
+
if (deltaTime < minDeltaTime) return;
|
|
159
|
+
oldTime = time;
|
|
160
|
+
mixers.forEach(function (mixer) {
|
|
161
|
+
return mixer.update(deltaTime / 1000);
|
|
162
|
+
});
|
|
163
|
+
five.needsRender = true;
|
|
164
|
+
};
|
|
165
|
+
|
|
166
|
+
index = requestAnimationFrame(animation);
|
|
167
|
+
return function () {
|
|
168
|
+
cancelAnimationFrame(index);
|
|
169
|
+
};
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
var play = function play() {
|
|
173
|
+
if (stopAnimation) return;
|
|
174
|
+
action.play();
|
|
175
|
+
stopAnimation = requestAnimationFrameLoop(); // 开始播动画时,rotation可能会还原
|
|
176
|
+
|
|
177
|
+
requestAnimationFrame(function () {
|
|
178
|
+
if (state.object && state.object.rotation.z !== state.rad) state.object.rotation.z = state.rad;
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
var stop = function stop() {
|
|
183
|
+
var _stopAnimation;
|
|
184
|
+
|
|
185
|
+
action.stop();
|
|
186
|
+
(_stopAnimation = stopAnimation) === null || _stopAnimation === void 0 ? void 0 : _stopAnimation();
|
|
187
|
+
stopAnimation = undefined;
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
var animation = {
|
|
191
|
+
play: play,
|
|
192
|
+
stop: stop
|
|
193
|
+
};
|
|
194
|
+
state.animation = animation;
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
var show = function show(config) {
|
|
198
|
+
var _config$animationEnab;
|
|
199
|
+
|
|
200
|
+
if (!state.object) return console.error('ModelEntryDoorGuidePlugin.enable(): object is ', state.object);
|
|
201
|
+
var animationEnable = (_config$animationEnab = config === null || config === void 0 ? void 0 : config.animationEnable) !== null && _config$animationEnab !== void 0 ? _config$animationEnab : defaultAnimationEnable;
|
|
202
|
+
|
|
203
|
+
if (animationEnable) {
|
|
204
|
+
if (!state.animation) initAnimation();
|
|
205
|
+
state.animation.play();
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
five.scene.add(state.object);
|
|
209
|
+
five.needsRender = true;
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
var hide = function hide() {
|
|
213
|
+
if (!state.object) return;
|
|
214
|
+
if (state.animation) state.animation.stop();
|
|
215
|
+
five.scene.remove(state.object);
|
|
216
|
+
five.needsRender = true;
|
|
217
|
+
};
|
|
218
|
+
|
|
219
|
+
var modeChangeHandler = function modeChangeHandler(mode) {
|
|
220
|
+
return mode === 'Floorplan' ? show() : hide();
|
|
221
|
+
};
|
|
222
|
+
|
|
223
|
+
var enable = function enable(config) {
|
|
224
|
+
if (state.enabled) return true;
|
|
225
|
+
state.enabled = true;
|
|
226
|
+
modeChangeHandler(five.currentMode);
|
|
227
|
+
five.on('modeChange', modeChangeHandler);
|
|
228
|
+
show(config);
|
|
229
|
+
return true;
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
var disable = function disable() {
|
|
233
|
+
if (!state.enabled) return true;
|
|
234
|
+
state.enabled = false;
|
|
235
|
+
five.off('modeChange', modeChangeHandler);
|
|
236
|
+
return true;
|
|
237
|
+
};
|
|
238
|
+
|
|
239
|
+
return {
|
|
240
|
+
load: load,
|
|
241
|
+
enable: enable,
|
|
242
|
+
disable: disable
|
|
243
|
+
};
|
|
13
244
|
};
|
|
14
245
|
|
|
15
246
|
var _default = ModelEntryDoorGuidePlugin;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { FivePlugin } from '@realsee/five';
|
|
2
|
+
export interface ExtrudeWallsDataModel {
|
|
3
|
+
height: number;
|
|
4
|
+
exterior: Array<[number, number]>;
|
|
5
|
+
interior: Array<[number, number]>;
|
|
6
|
+
}
|
|
7
|
+
export interface ModelExtrudeWallsPluginParameterType {
|
|
8
|
+
data?: ExtrudeWallsDataModel;
|
|
9
|
+
}
|
|
10
|
+
export interface ModelExtrudeWallsPluginPluginReturnType {
|
|
11
|
+
enable: () => void;
|
|
12
|
+
disable: () => void;
|
|
13
|
+
dispose: () => void;
|
|
14
|
+
load: (data: ExtrudeWallsDataModel) => void;
|
|
15
|
+
}
|
|
16
|
+
export declare const ModelExtrudeWallsPlugin: FivePlugin<ModelExtrudeWallsPluginParameterType, ModelExtrudeWallsPluginPluginReturnType>;
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
require("core-js/modules/es.array.iterator.js");
|
|
4
|
+
|
|
5
|
+
require("core-js/modules/es.object.to-string.js");
|
|
6
|
+
|
|
7
|
+
require("core-js/modules/es.string.iterator.js");
|
|
8
|
+
|
|
9
|
+
require("core-js/modules/es.weak-map.js");
|
|
10
|
+
|
|
11
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
|
12
|
+
|
|
13
|
+
require("core-js/modules/es.object.define-property.js");
|
|
14
|
+
|
|
15
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
|
16
|
+
|
|
17
|
+
var _typeof = require("@babel/runtime/helpers/typeof");
|
|
18
|
+
|
|
19
|
+
Object.defineProperty(exports, "__esModule", {
|
|
20
|
+
value: true
|
|
21
|
+
});
|
|
22
|
+
exports.ModelExtrudeWallsPlugin = void 0;
|
|
23
|
+
|
|
24
|
+
require("core-js/modules/es.array.for-each.js");
|
|
25
|
+
|
|
26
|
+
require("core-js/modules/web.dom-collections.for-each.js");
|
|
27
|
+
|
|
28
|
+
require("core-js/modules/es.function.name.js");
|
|
29
|
+
|
|
30
|
+
var _five = require("@realsee/five");
|
|
31
|
+
|
|
32
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
33
|
+
|
|
34
|
+
var _nextFrame = require("../../shared-utils/nextFrame");
|
|
35
|
+
|
|
36
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
37
|
+
|
|
38
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
39
|
+
|
|
40
|
+
var lineTo = function lineTo(d, s) {
|
|
41
|
+
return d.forEach(function (p, i) {
|
|
42
|
+
return s[!i ? 'moveTo' : 'lineTo'](p[0], p[1]);
|
|
43
|
+
});
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
var generateSideWallUV = function generateSideWallUV() {
|
|
47
|
+
return [new THREE.Vector2(1, 1), new THREE.Vector2(0, 1), new THREE.Vector2(0, 0), new THREE.Vector2(1, 0)];
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var bezierArcTransition = function bezierArcTransition(t) {
|
|
51
|
+
return -0.7 * (2.4 * t * t * t - 3.6 * t * t + 0.2 * t);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
var ModelExtrudeWallsPlugin = function ModelExtrudeWallsPlugin(five) {
|
|
55
|
+
var parameters = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
56
|
+
var state = {
|
|
57
|
+
data: parameters.data,
|
|
58
|
+
walls: {},
|
|
59
|
+
visible: true
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
var wrapper = function wrapper() {
|
|
63
|
+
if (!state.data) return;
|
|
64
|
+
var wallShape = new THREE.Shape();
|
|
65
|
+
var floorplanShape = new THREE.Shape();
|
|
66
|
+
lineTo(state.data.exterior, wallShape);
|
|
67
|
+
lineTo(state.data.exterior, floorplanShape);
|
|
68
|
+
lineTo(state.data.interior, floorplanShape);
|
|
69
|
+
var bb = new THREE.Box2();
|
|
70
|
+
bb.setFromPoints(wallShape.extractPoints(1).shape);
|
|
71
|
+
|
|
72
|
+
var generateTopUV = function generateTopUV(geometry, vertices, indexA, indexB, indexC) {
|
|
73
|
+
var ax = vertices[indexA * 3];
|
|
74
|
+
var ay = vertices[indexA * 3 + 1];
|
|
75
|
+
var bx = vertices[indexB * 3];
|
|
76
|
+
var by = vertices[indexB * 3 + 1];
|
|
77
|
+
var cx = vertices[indexC * 3];
|
|
78
|
+
var cy = vertices[indexC * 3 + 1];
|
|
79
|
+
var bbx = bb.max.x - bb.min.x;
|
|
80
|
+
var bby = bb.max.y - bb.min.y;
|
|
81
|
+
return [new THREE.Vector2((ax - bb.min.x) / bbx, 1.0 - (ay - bb.min.y) / bby), new THREE.Vector2((bx - bb.min.x) / bbx, 1.0 - (by - bb.min.y) / bby), new THREE.Vector2((cx - bb.min.x) / bbx, 1.0 - (cy - bb.min.y) / bby)];
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
var extrudeSettings = {
|
|
85
|
+
steps: 1,
|
|
86
|
+
depth: Math.abs(state.data.height),
|
|
87
|
+
bevelEnabled: false,
|
|
88
|
+
UVGenerator: {
|
|
89
|
+
generateTopUV: generateTopUV,
|
|
90
|
+
generateSideWallUV: generateSideWallUV
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
var geometry1 = new THREE.ExtrudeGeometry(wallShape, extrudeSettings);
|
|
94
|
+
var geometry2 = new THREE.ExtrudeGeometry(wallShape, extrudeSettings);
|
|
95
|
+
var geometry3 = new THREE.ExtrudeGeometry(floorplanShape, extrudeSettings);
|
|
96
|
+
geometry1.faces.forEach(function (face) {
|
|
97
|
+
var temp = face.a;
|
|
98
|
+
face.a = face.c;
|
|
99
|
+
face.c = temp;
|
|
100
|
+
});
|
|
101
|
+
geometry1.faceVertexUvs.forEach(function (faceVertexUvs) {
|
|
102
|
+
faceVertexUvs.forEach(function (uv) {
|
|
103
|
+
var temp = uv[0];
|
|
104
|
+
uv[0] = uv[2];
|
|
105
|
+
uv[2] = temp;
|
|
106
|
+
});
|
|
107
|
+
});
|
|
108
|
+
geometry1.computeFaceNormals();
|
|
109
|
+
var material0 = new THREE.MeshBasicMaterial({
|
|
110
|
+
color: 0xc8c8c8,
|
|
111
|
+
// color: 0x2bb8aa,
|
|
112
|
+
wireframe: false,
|
|
113
|
+
transparent: true,
|
|
114
|
+
opacity: 0.9
|
|
115
|
+
});
|
|
116
|
+
var material1 = new THREE.MeshBasicMaterial({
|
|
117
|
+
color: 0xffeedf,
|
|
118
|
+
wireframe: false,
|
|
119
|
+
transparent: true,
|
|
120
|
+
opacity: 0.7
|
|
121
|
+
});
|
|
122
|
+
var material2 = new THREE.MeshBasicMaterial({
|
|
123
|
+
color: 0xffffff,
|
|
124
|
+
wireframe: false,
|
|
125
|
+
transparent: true,
|
|
126
|
+
opacity: 0,
|
|
127
|
+
depthTest: false
|
|
128
|
+
});
|
|
129
|
+
var material3 = new THREE.MeshBasicMaterial({
|
|
130
|
+
color: 0xc8c8c8,
|
|
131
|
+
// color: 0x2bb8aa,
|
|
132
|
+
wireframe: false,
|
|
133
|
+
transparent: true,
|
|
134
|
+
opacity: 0.2,
|
|
135
|
+
depthTest: false
|
|
136
|
+
});
|
|
137
|
+
var renderOrder = 99;
|
|
138
|
+
|
|
139
|
+
var initMesh = function initMesh(m) {
|
|
140
|
+
m.rotation.x = -Math.PI / 2;
|
|
141
|
+
m.rotation.y = 0;
|
|
142
|
+
m.rotation.z = 0; // Math.PI / 2
|
|
143
|
+
|
|
144
|
+
m.position.y = five.model.bounding.min.y;
|
|
145
|
+
m.name = 'extrude-walls' + renderOrder;
|
|
146
|
+
m.renderOrder = renderOrder++;
|
|
147
|
+
five.needsRender = true;
|
|
148
|
+
}; // 内墙
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
var insideWall = new THREE.Mesh(geometry1, [material2, material0]); // 外墙
|
|
152
|
+
|
|
153
|
+
var outsideWall = new THREE.Mesh(geometry2, [material2, material3]); // 内墙
|
|
154
|
+
|
|
155
|
+
var lookDownWall = new THREE.Mesh(geometry3, [material1, material2]);
|
|
156
|
+
|
|
157
|
+
var append = function append() {
|
|
158
|
+
initMesh(insideWall);
|
|
159
|
+
initMesh(lookDownWall);
|
|
160
|
+
initMesh(outsideWall);
|
|
161
|
+
five.scene.add(insideWall);
|
|
162
|
+
five.scene.add(outsideWall);
|
|
163
|
+
five.scene.add(lookDownWall);
|
|
164
|
+
state.walls.inside = insideWall;
|
|
165
|
+
state.walls.outside = outsideWall;
|
|
166
|
+
state.walls.lookDown = lookDownWall;
|
|
167
|
+
state.visible = true;
|
|
168
|
+
visible(five.currentMode === _five.Five.Mode.Floorplan);
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
if (five.model.loaded) {
|
|
172
|
+
append();
|
|
173
|
+
} else {
|
|
174
|
+
five.once('modelLoaded', function () {
|
|
175
|
+
return append();
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
};
|
|
179
|
+
|
|
180
|
+
var enable = function enable() {
|
|
181
|
+
state.visible = true;
|
|
182
|
+
visible(true);
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
var disable = function disable() {
|
|
186
|
+
state.visible = false;
|
|
187
|
+
visible(false);
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
var visible = function visible() {
|
|
191
|
+
var flag = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;
|
|
192
|
+
if (state.walls.inside) state.walls.inside.visible = flag;
|
|
193
|
+
if (state.walls.outside) state.walls.outside.visible = flag;
|
|
194
|
+
if (state.walls.lookDown) state.walls.lookDown.visible = flag;
|
|
195
|
+
five.needsRender = true;
|
|
196
|
+
};
|
|
197
|
+
|
|
198
|
+
var modeChangeListener = function modeChangeListener(mode, prevMode) {
|
|
199
|
+
if (!state.visible) return;
|
|
200
|
+
|
|
201
|
+
if (prevMode === _five.Five.Mode.Floorplan) {
|
|
202
|
+
five.once('initAnimationEnded', function () {
|
|
203
|
+
return (0, _nextFrame.nextFrame)(function () {
|
|
204
|
+
return visible(false);
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
return;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
return visible(mode === _five.Five.Mode.Floorplan);
|
|
211
|
+
};
|
|
212
|
+
|
|
213
|
+
var cameraDirectionUpdateListener = function cameraDirectionUpdateListener(_ref) {
|
|
214
|
+
var latitude = _ref.latitude;
|
|
215
|
+
if (state.walls.inside) state.walls.inside.material[1].opacity = bezierArcTransition(latitude / (Math.PI / 2));
|
|
216
|
+
if (state.walls.outside) state.walls.outside.material[1].opacity = bezierArcTransition(latitude / (Math.PI / 2));
|
|
217
|
+
if (state.walls.lookDown) state.walls.lookDown.material[0].opacity = bezierArcTransition(latitude / (Math.PI / 2));
|
|
218
|
+
};
|
|
219
|
+
|
|
220
|
+
five.on('modeChange', modeChangeListener);
|
|
221
|
+
five.on('cameraDirectionUpdate', cameraDirectionUpdateListener);
|
|
222
|
+
|
|
223
|
+
var dispose = function dispose() {
|
|
224
|
+
five.off('modeChange', modeChangeListener);
|
|
225
|
+
five.off('cameraDirectionUpdate', cameraDirectionUpdateListener);
|
|
226
|
+
if (state.walls.inside) five.scene.remove(state.walls.inside);
|
|
227
|
+
if (state.walls.outside) five.scene.remove(state.walls.outside);
|
|
228
|
+
if (state.walls.lookDown) five.scene.remove(state.walls.lookDown);
|
|
229
|
+
state.data = undefined;
|
|
230
|
+
state.walls = {};
|
|
231
|
+
state.visible = true;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
wrapper();
|
|
235
|
+
|
|
236
|
+
var load = function load(data) {
|
|
237
|
+
state.data = data;
|
|
238
|
+
if (state.walls.inside) five.scene.remove(state.walls.inside);
|
|
239
|
+
if (state.walls.outside) five.scene.remove(state.walls.outside);
|
|
240
|
+
if (state.walls.lookDown) five.scene.remove(state.walls.lookDown);
|
|
241
|
+
wrapper();
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
return {
|
|
245
|
+
enable: enable,
|
|
246
|
+
disable: disable,
|
|
247
|
+
dispose: dispose,
|
|
248
|
+
load: load
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
|
|
252
|
+
exports.ModelExtrudeWallsPlugin = ModelExtrudeWallsPlugin;
|