@realsee/dnalogel 0.1.0
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 +94 -0
- package/TERMS.txt +56 -0
- package/components/ARVideoFigure/ARVideoFigureMesh.d.ts +44 -0
- package/components/ARVideoFigure/ARVideoFigureMesh.js +347 -0
- package/components/ARVideoFigure/ARVideoFigureScene.d.ts +11 -0
- package/components/ARVideoFigure/ARVideoFigureScene.js +74 -0
- package/components/ARVideoFigure/ImgBgTransparent.d.ts +16 -0
- package/components/ARVideoFigure/ImgBgTransparent.js +49 -0
- package/components/ARVideoFigure/ImgBgTransparentMesh.d.ts +30 -0
- package/components/ARVideoFigure/ImgBgTransparentMesh.js +173 -0
- package/components/ARVideoFigure/fragmentShader.d.ts +5 -0
- package/components/ARVideoFigure/fragmentShader.js +16 -0
- package/components/ARVideoFigure/index.d.ts +15 -0
- package/components/ARVideoFigure/index.js +64 -0
- package/components/ARVideoFigure/vertexShader.d.ts +1 -0
- package/components/ARVideoFigure/vertexShader.js +8 -0
- package/components/GlassFilters/index.d.ts +32 -0
- package/components/GlassFilters/index.js +54 -0
- package/components/ModelView/ModelViewController.d.ts +18 -0
- package/components/ModelView/ModelViewController.js +147 -0
- package/components/ModelView/index.d.ts +10 -0
- package/components/ModelView/index.js +22 -0
- package/components/PBRView/index.d.ts +14 -0
- package/components/PBRView/index.js +31 -0
- package/components/PaintBrush/index.d.ts +16 -0
- package/components/PaintBrush/index.js +33 -0
- package/components/PanoTag/index.d.ts +4 -0
- package/components/PanoTag/index.js +11 -0
- package/custom.d.js +3 -0
- package/data/1aGKl9JmrlXMXx8d.d.ts +104 -0
- package/data/1aGKl9JmrlXMXx8d.js +535 -0
- package/data/6gyq3v1verxD7JO1.d.ts +104 -0
- package/data/6gyq3v1verxD7JO1.js +460 -0
- package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.d.ts +84 -0
- package/data/KpokNd82rwjhackhQTBEoYKHg8zGbPXe.js +598 -0
- package/data/PrXel3aqGbp34JQn.d.ts +389 -0
- package/data/PrXel3aqGbp34JQn.js +4639 -0
- package/data/YdoNP9K4rwQDwjJr.d.ts +83 -0
- package/data/YdoNP9K4rwQDwjJr.js +1451 -0
- package/data/auto3d-njL5J99VwCmnjtQElOmXQr.d.ts +86 -0
- package/data/auto3d-njL5J99VwCmnjtQElOmXQr.js +709 -0
- package/data/oPzy3ApbjjpD8YdR.d.ts +83 -0
- package/data/oPzy3ApbjjpD8YdR.js +281 -0
- package/data/qjAxMG4XbPn96wKG.d.ts +104 -0
- package/data/qjAxMG4XbPn96wKG.js +635 -0
- package/data/rXel3aPQRRBD4JQn.d.ts +86 -0
- package/data/rXel3aPQRRBD4JQn.js +620 -0
- package/data/vLykj3NWrllMrG06.d.ts +89 -0
- package/data/vLykj3NWrllMrG06.js +2532 -0
- package/data/wYnRjQ4KZoV1yPoG.d.ts +114 -0
- package/data/wYnRjQ4KZoV1yPoG.js +512 -0
- package/data/wz0QV9KA4ugyo9ME.d.ts +39 -0
- package/data/wz0QV9KA4ugyo9ME.js +134 -0
- package/examples/FiveStateController/index.js +140 -0
- package/examples/VRHouse/Mobile.js +22 -0
- package/examples/VRHouse/PC.js +22 -0
- package/examples/VRHouse/index.js +22 -0
- package/index.d.ts +15 -0
- package/index.js +43 -0
- package/package.json +19 -0
- package/plugins/CSS3DRenderPlugin/components/Marker/index.d.ts +12 -0
- package/plugins/CSS3DRenderPlugin/components/Marker/index.js +113 -0
- package/plugins/CSS3DRenderPlugin/index.d.ts +49 -0
- package/plugins/CSS3DRenderPlugin/index.js +220 -0
- package/plugins/CameraMovementPlugin/index.d.ts +7 -0
- package/plugins/CameraMovementPlugin/index.js +338 -0
- package/plugins/CameraMovementPlugin/typing.d.ts +68 -0
- package/plugins/CameraMovementPlugin/typing.js +35 -0
- package/plugins/ModelChassisCompassPlugin/index.d.ts +15 -0
- package/plugins/ModelChassisCompassPlugin/index.js +156 -0
- package/plugins/ModelEntryDoorGuidePlugin/index.d.ts +10 -0
- package/plugins/ModelEntryDoorGuidePlugin/index.js +16 -0
- package/plugins/ModelTVVideoPlugin/index.d.ts +21 -0
- package/plugins/ModelTVVideoPlugin/index.js +313 -0
- package/plugins/ModelViewPlugin/index.d.ts +17 -0
- package/plugins/ModelViewPlugin/index.js +199 -0
- package/plugins/PanoCursorRaycasterPlugin/PanoCursorRaycasterPluginUsage.d.ts +48 -0
- package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.d.ts +9 -0
- package/plugins/PanoCursorRaycasterPlugin/components/MovePointTowardsCamera.js +113 -0
- package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.d.ts +11 -0
- package/plugins/PanoCursorRaycasterPlugin/components/PointAxesHelper.js +25 -0
- package/plugins/PanoCursorRaycasterPlugin/index.d.ts +49 -0
- package/plugins/PanoCursorRaycasterPlugin/index.js +119 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.d.ts +5 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/addLineToFive.js +25 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/createLine.d.ts +3 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/createLine.js +34 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.d.ts +7 -0
- package/plugins/PanoCursorRaycasterPlugin/utils/vecror3.js +18 -0
- package/plugins/PanoDoorLabelPlugin/index.d.ts +4 -0
- package/plugins/PanoDoorLabelPlugin/index.js +12 -0
- package/plugins/PanoIRobotPlugin/index.d.ts +10 -0
- package/plugins/PanoIRobotPlugin/index.js +16 -0
- package/plugins/PanoRulerPlugin/data/roomInfo.d.ts +3 -0
- package/plugins/PanoRulerPlugin/data/roomInfo.js +49 -0
- package/plugins/PanoRulerPlugin/data/roomRules.d.ts +3 -0
- package/plugins/PanoRulerPlugin/data/roomRules.js +233 -0
- package/plugins/PanoRulerPlugin/index.d.ts +27 -0
- package/plugins/PanoRulerPlugin/index.js +589 -0
- package/plugins/PanoRulerPlugin/typings.d.ts +21 -0
- package/plugins/PanoRulerPlugin/typings.js +5 -0
- package/plugins/PanoTVVideoPlugin/index.d.ts +24 -0
- package/plugins/PanoTVVideoPlugin/index.js +351 -0
- package/plugins/TreasurePlugin/Controller.d.ts +32 -0
- package/plugins/TreasurePlugin/Controller.js +175 -0
- package/plugins/TreasurePlugin/TreasureFaceAnime.d.ts +23 -0
- package/plugins/TreasurePlugin/TreasureFaceAnime.js +128 -0
- package/plugins/TreasurePlugin/TreasureObject.d.ts +35 -0
- package/plugins/TreasurePlugin/TreasureObject.js +186 -0
- package/plugins/TreasurePlugin/TreasureOpenAnime.d.ts +23 -0
- package/plugins/TreasurePlugin/TreasureOpenAnime.js +103 -0
- package/plugins/TreasurePlugin/constants.d.ts +12 -0
- package/plugins/TreasurePlugin/constants.js +30 -0
- package/plugins/TreasurePlugin/index.d.ts +11 -0
- package/plugins/TreasurePlugin/index.js +16 -0
- package/plugins/TreasurePlugin/treasureDataMap.d.ts +7 -0
- package/plugins/TreasurePlugin/treasureDataMap.js +20 -0
- package/plugins/TreasurePlugin/typings.d.ts +2 -0
- package/plugins/TreasurePlugin/typings.js +5 -0
- package/plugins/TreasurePlugin/utils/loadTreasureTextures.d.ts +7 -0
- package/plugins/TreasurePlugin/utils/loadTreasureTextures.js +115 -0
- package/plugins/floorplan/Assets/floorplanExtraObject.d.ts +1 -0
- package/plugins/floorplan/Assets/floorplanExtraObject.js +8 -0
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.d.ts +100 -0
- package/plugins/floorplan/ModelFloorplanPlugin/Controller.js +643 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.d.ts +13 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Camera.js +58 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.d.ts +5 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/Compass.js +69 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.d.ts +10 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomHighlight.js +105 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.d.ts +13 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/RoomLabels.js +95 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.d.ts +13 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/NowFloor/index.js +48 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.d.ts +20 -0
- package/plugins/floorplan/ModelFloorplanPlugin/components/index.js +66 -0
- package/plugins/floorplan/ModelFloorplanPlugin/controller.style.d.ts +1 -0
- package/plugins/floorplan/ModelFloorplanPlugin/controller.style.js +14 -0
- package/plugins/floorplan/ModelFloorplanPlugin/index.d.ts +9 -0
- package/plugins/floorplan/ModelFloorplanPlugin/index.js +18 -0
- package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.d.ts +23 -0
- package/plugins/floorplan/ModelFloorplanPlugin/typings/events.type.js +5 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.d.ts +15 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/constant.js +31 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.d.ts +14 -0
- package/plugins/floorplan/ModelFloorplanPlugin/utils/correctFiveState.js +162 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.d.ts +13 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.js +91 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.d.ts +3 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/Camera.style.js +35 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.d.ts +5 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/ExtraObjects.js +50 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.d.ts +9 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/RoomHighlight.js +102 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.d.ts +11 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/NowFloor/index.js +42 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.d.ts +17 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.js +75 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.d.ts +2 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Content/index.style.js +13 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.d.ts +33 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/Controller.js +214 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/index.d.ts +8 -0
- package/plugins/floorplan/PanoFloorplanRadarPlugin/index.js +18 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.d.ts +55 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/Controller.js +267 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/index.d.ts +5 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/index.js +16 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/style.d.ts +1 -0
- package/plugins/floorplan/TopviewFloorplanPlugin/style.js +14 -0
- package/plugins/floorplan/components/FloorplanImage.d.ts +7 -0
- package/plugins/floorplan/components/FloorplanImage.js +76 -0
- package/plugins/floorplan/typings/floorplanData.d.ts +127 -0
- package/plugins/floorplan/typings/floorplanData.js +5 -0
- package/plugins/floorplan/typings/floorplanServerData.d.ts +125 -0
- package/plugins/floorplan/typings/floorplanServerData.js +380 -0
- package/plugins/floorplan/utils/formatData.d.ts +5 -0
- package/plugins/floorplan/utils/formatData.js +220 -0
- package/plugins/floorplan/utils/formatPosition.d.ts +37 -0
- package/plugins/floorplan/utils/formatPosition.js +87 -0
- package/shared-utils/Preloader.d.ts +6 -0
- package/shared-utils/Preloader.js +51 -0
- package/shared-utils/Subscribe.d.ts +45 -0
- package/shared-utils/Subscribe.js +210 -0
- package/shared-utils/animationFrame/BetterTween.d.ts +11 -0
- package/shared-utils/animationFrame/BetterTween.js +102 -0
- package/shared-utils/animationFrame/calculateProgress.d.ts +8 -0
- package/shared-utils/animationFrame/calculateProgress.js +38 -0
- package/shared-utils/animationFrame/formatRad.d.ts +15 -0
- package/shared-utils/animationFrame/formatRad.js +34 -0
- package/shared-utils/animationFrame/index.d.ts +15 -0
- package/shared-utils/animationFrame/index.js +69 -0
- package/shared-utils/animationFrame/tween.d.ts +75 -0
- package/shared-utils/animationFrame/tween.js +76 -0
- package/shared-utils/changeModelCanvansOpacity.d.ts +2 -0
- package/shared-utils/changeModelCanvansOpacity.js +24 -0
- package/shared-utils/createFiveContainer.d.ts +10 -0
- package/shared-utils/createFiveContainer.js +165 -0
- package/shared-utils/createLine/index.d.ts +3 -0
- package/shared-utils/createLine/index.js +29 -0
- package/shared-utils/debounce.d.ts +6 -0
- package/shared-utils/debounce.js +26 -0
- package/shared-utils/equal.d.ts +11 -0
- package/shared-utils/equal.js +96 -0
- package/shared-utils/filter.d.ts +27 -0
- package/shared-utils/filter.js +93 -0
- package/shared-utils/five/changeMode.d.ts +2 -0
- package/shared-utils/five/changeMode.js +86 -0
- package/shared-utils/five/useFivePlugin.d.ts +1 -0
- package/shared-utils/five/useFivePlugin.js +15 -0
- package/shared-utils/formatRad.d.ts +7 -0
- package/shared-utils/formatRad.js +16 -0
- package/shared-utils/getPxmm.d.ts +6 -0
- package/shared-utils/getPxmm.js +37 -0
- package/shared-utils/getRandomColor.d.ts +1 -0
- package/shared-utils/getRandomColor.js +13 -0
- package/shared-utils/isTruelyObject.d.ts +18 -0
- package/shared-utils/isTruelyObject.js +27 -0
- package/shared-utils/math/evenNumber.d.ts +1 -0
- package/shared-utils/math/evenNumber.js +11 -0
- package/shared-utils/math/planimetry.d.ts +116 -0
- package/shared-utils/math/planimetry.js +342 -0
- package/shared-utils/math/rad2Deg.d.ts +1 -0
- package/shared-utils/math/rad2Deg.js +10 -0
- package/shared-utils/nearlyEqual.d.ts +7 -0
- package/shared-utils/nearlyEqual.js +17 -0
- package/shared-utils/nextFrame.d.ts +1 -0
- package/shared-utils/nextFrame.js +13 -0
- package/shared-utils/noop.d.ts +5 -0
- package/shared-utils/noop.js +17 -0
- package/shared-utils/object3d2LocalMatrix.d.ts +12 -0
- package/shared-utils/object3d2LocalMatrix.js +73 -0
- package/shared-utils/px2rem.d.ts +1 -0
- package/shared-utils/px2rem.js +12 -0
- package/shared-utils/tap.d.ts +8 -0
- package/shared-utils/tap.js +19 -0
- package/shared-utils/three/centerPoint.d.ts +2 -0
- package/shared-utils/three/centerPoint.js +12 -0
- package/shared-utils/three/getNormal.d.ts +2 -0
- package/shared-utils/three/getNormal.js +13 -0
- package/shared-utils/three/loadFbxObj.d.ts +3 -0
- package/shared-utils/three/loadFbxObj.js +42 -0
- package/shared-utils/three/loadTexture.d.ts +2 -0
- package/shared-utils/three/loadTexture.js +38 -0
- package/shared-utils/three/vecror3.d.ts +7 -0
- package/shared-utils/three/vecror3.js +18 -0
- package/shared-utils/throttle.d.ts +7 -0
- package/shared-utils/throttle.js +25 -0
- package/shared-utils/to.d.ts +9 -0
- package/shared-utils/to.js +25 -0
- package/shared-utils/useDebounce.d.ts +8 -0
- package/shared-utils/useDebounce.js +43 -0
- package/shared-utils/useThrottle.d.ts +8 -0
- package/shared-utils/useThrottle.js +41 -0
- package/shared-utils/uuid.d.ts +4 -0
- package/shared-utils/uuid.js +20 -0
- package/shared-utils/vectorTocoordinates.d.ts +7 -0
- package/shared-utils/vectorTocoordinates.js +16 -0
- package/typedoc/components.d.ts +6 -0
- package/typedoc/components.js +5 -0
- package/typedoc/plugins.d.ts +17 -0
- package/typedoc/plugins.js +113 -0
- package/typedoc/shared-utils.d.ts +3 -0
- package/typedoc/shared-utils.js +5 -0
- package/typedoc/typings.d.ts +3 -0
- package/typedoc/typings.js +5 -0
- package/typings/math.type.d.ts +44 -0
- package/typings/math.type.js +5 -0
- package/typings/utils.type.d.ts +2 -0
- package/typings/utils.type.js +5 -0
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = exports.PanoTVVideoPlugin = void 0;
|
|
9
|
+
|
|
10
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
+
|
|
12
|
+
var _five = require("@realsee/five");
|
|
13
|
+
|
|
14
|
+
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); }
|
|
15
|
+
|
|
16
|
+
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; }
|
|
17
|
+
|
|
18
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
19
|
+
|
|
20
|
+
function _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."); }
|
|
21
|
+
|
|
22
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
23
|
+
|
|
24
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
25
|
+
|
|
26
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
27
|
+
|
|
28
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
29
|
+
|
|
30
|
+
var PanoTVVideoPlugin = function PanoTVVideoPlugin(five, parameters) {
|
|
31
|
+
var state = {
|
|
32
|
+
enabled: true,
|
|
33
|
+
rectPoints: undefined,
|
|
34
|
+
videoTextureEnabled: false,
|
|
35
|
+
videoSource: '',
|
|
36
|
+
videoTexture: undefined,
|
|
37
|
+
imageTexture: undefined,
|
|
38
|
+
videoElement: parameters.videoElement
|
|
39
|
+
};
|
|
40
|
+
var videoMeshes = [];
|
|
41
|
+
|
|
42
|
+
var getImageTexture = function getImageTexture(source) {
|
|
43
|
+
var texture = new THREE.TextureLoader().load(source);
|
|
44
|
+
texture.minFilter = THREE.LinearFilter;
|
|
45
|
+
texture.magFilter = THREE.LinearFilter;
|
|
46
|
+
texture.format = THREE.RGBFormat;
|
|
47
|
+
return texture;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
var getVideoTexture = function getVideoTexture(source, video) {
|
|
51
|
+
return new Promise(function (resolve, reject) {
|
|
52
|
+
var xhr = new XMLHttpRequest();
|
|
53
|
+
|
|
54
|
+
xhr.onreadystatechange = function () {
|
|
55
|
+
if (xhr.readyState == 4) {
|
|
56
|
+
if (xhr.status == 200) {
|
|
57
|
+
var url = window.URL || window.webkitURL;
|
|
58
|
+
video = video || document.createElement('video');
|
|
59
|
+
video.crossOrigin = 'anonymous';
|
|
60
|
+
video.autoplay = true;
|
|
61
|
+
video.muted = true;
|
|
62
|
+
video.loop = true;
|
|
63
|
+
video.playsInline = true;
|
|
64
|
+
video.src = url.createObjectURL(xhr.response);
|
|
65
|
+
var texture = new THREE.VideoTexture(video);
|
|
66
|
+
texture.minFilter = THREE.LinearFilter;
|
|
67
|
+
texture.magFilter = THREE.LinearFilter;
|
|
68
|
+
texture.format = THREE.RGBFormat;
|
|
69
|
+
resolve(Object.assign(texture, {
|
|
70
|
+
videoSource: source
|
|
71
|
+
}));
|
|
72
|
+
} else {
|
|
73
|
+
reject(new Error('Video download Error: ' + xhr.status));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
xhr.onerror = function (error) {
|
|
79
|
+
return reject(error);
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
xhr.open('GET', source);
|
|
83
|
+
xhr.responseType = 'blob';
|
|
84
|
+
xhr.send();
|
|
85
|
+
});
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
var getPoints = function getPoints(panoIndex) {
|
|
89
|
+
if (!state.rectPoints) return [];
|
|
90
|
+
var rectPoints_ = state.rectPoints[panoIndex];
|
|
91
|
+
if (!rectPoints_) return [];
|
|
92
|
+
return rectPoints_.map(function (rectPoints) {
|
|
93
|
+
var quaternion = five.work.observers[panoIndex].quaternion;
|
|
94
|
+
var position = five.work.observers[panoIndex].position;
|
|
95
|
+
var points = [new THREE.Vector3(rectPoints[1].position.x, rectPoints[1].position.y, rectPoints[1].position.z), new THREE.Vector3(rectPoints[2].position.x, rectPoints[2].position.y, rectPoints[2].position.z), new THREE.Vector3(rectPoints[3].position.x, rectPoints[3].position.y, rectPoints[3].position.z), new THREE.Vector3(rectPoints[0].position.x, rectPoints[0].position.y, rectPoints[0].position.z)];
|
|
96
|
+
points.forEach(function (point) {
|
|
97
|
+
return point.applyQuaternion(quaternion).add(position);
|
|
98
|
+
});
|
|
99
|
+
return points;
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
var createPanoVideoMeshes = function createPanoVideoMeshes(panoIndex) {
|
|
104
|
+
return getPoints(panoIndex).map(function (points, index) {
|
|
105
|
+
var geometry = new THREE.BufferGeometry();
|
|
106
|
+
var segments = 128;
|
|
107
|
+
var verticesArray = [];
|
|
108
|
+
verticesArray.push(points[0].x, points[0].y, points[0].z);
|
|
109
|
+
|
|
110
|
+
for (var i = 1; i < segments; i++) {
|
|
111
|
+
verticesArray.push(points[0].x + (points[1].x - points[0].x) * i / segments, points[0].y + (points[1].y - points[0].y) * i / segments, points[0].z + (points[1].z - points[0].z) * i / segments);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
verticesArray.push(points[1].x, points[1].y, points[1].z);
|
|
115
|
+
verticesArray.push(points[2].x, points[2].y, points[2].z);
|
|
116
|
+
|
|
117
|
+
for (var _i = 1; _i < segments; _i++) {
|
|
118
|
+
verticesArray.push(points[2].x + (points[3].x - points[2].x) * _i / segments, points[2].y + (points[3].y - points[2].y) * _i / segments, points[2].z + (points[3].z - points[2].z) * _i / segments);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
verticesArray.push(points[3].x, points[3].y, points[3].z);
|
|
122
|
+
var uvArray = [];
|
|
123
|
+
uvArray.push(0, 0);
|
|
124
|
+
|
|
125
|
+
for (var _i2 = 1; _i2 < segments; _i2++) {
|
|
126
|
+
uvArray.push(_i2 / segments, 0);
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
uvArray.push(1, 0);
|
|
130
|
+
uvArray.push(1, 1);
|
|
131
|
+
|
|
132
|
+
for (var _i3 = 1; _i3 < segments; _i3++) {
|
|
133
|
+
uvArray.push(1 - _i3 / segments, 1);
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
uvArray.push(0, 1);
|
|
137
|
+
var indicesArray = [];
|
|
138
|
+
|
|
139
|
+
for (var _i4 = 0; _i4 < segments; _i4++) {
|
|
140
|
+
indicesArray.push(_i4, _i4 + 1, segments * 2 - _i4, _i4, segments * 2 - _i4, segments * 2 + 1 - _i4);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
geometry.setAttribute('position', new THREE.BufferAttribute(new Float32Array(verticesArray), 3));
|
|
144
|
+
geometry.setAttribute('uv', new THREE.BufferAttribute(new Float32Array(uvArray), 2));
|
|
145
|
+
geometry.setIndex(new THREE.BufferAttribute(new Uint32Array(indicesArray), 1));
|
|
146
|
+
var material = new THREE.MeshBasicMaterial({
|
|
147
|
+
map: state.videoTextureEnabled ? state.videoTexture : state.imageTexture,
|
|
148
|
+
depthTest: false,
|
|
149
|
+
transparent: true,
|
|
150
|
+
side: THREE.DoubleSide
|
|
151
|
+
});
|
|
152
|
+
var mesh = new THREE.Mesh(geometry, material);
|
|
153
|
+
mesh.renderOrder = 1;
|
|
154
|
+
mesh.name = "video-".concat(panoIndex, "-").concat(index);
|
|
155
|
+
return mesh;
|
|
156
|
+
});
|
|
157
|
+
};
|
|
158
|
+
|
|
159
|
+
var enable = function enable() {
|
|
160
|
+
if (state.enabled) return;
|
|
161
|
+
state.enabled = true;
|
|
162
|
+
var panoIndex = five.panoIndex;
|
|
163
|
+
|
|
164
|
+
if (typeof panoIndex === 'number') {
|
|
165
|
+
var meshes = videoMeshes[panoIndex] = createPanoVideoMeshes(panoIndex);
|
|
166
|
+
meshes.forEach(function (mesh) {
|
|
167
|
+
return five.scene.add(mesh);
|
|
168
|
+
});
|
|
169
|
+
|
|
170
|
+
if (state.videoTexture && videoMeshes.length) {
|
|
171
|
+
state.videoTexture.image.play();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
five.needsRender = true;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
|
|
178
|
+
var disable = function disable() {
|
|
179
|
+
if (!state.enabled) return;
|
|
180
|
+
state.enabled = false;
|
|
181
|
+
videoMeshes.forEach(function (meshes, index) {
|
|
182
|
+
if (meshes) {
|
|
183
|
+
meshes.forEach(function (mesh) {
|
|
184
|
+
mesh.geometry.dispose();
|
|
185
|
+
mesh.material.dispose();
|
|
186
|
+
five.scene.remove(mesh);
|
|
187
|
+
});
|
|
188
|
+
videoMeshes[index] = undefined;
|
|
189
|
+
if (state.videoTexture) state.videoTexture.image.pause();
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
five.needsRender = true;
|
|
193
|
+
};
|
|
194
|
+
|
|
195
|
+
var load = function load(data, videoElement) {
|
|
196
|
+
var video_src = data.video_src,
|
|
197
|
+
video_poster_src = data.video_poster_src,
|
|
198
|
+
points = data.points;
|
|
199
|
+
state.videoSource = video_src;
|
|
200
|
+
state.rectPoints = points;
|
|
201
|
+
state.imageTexture = getImageTexture(video_poster_src);
|
|
202
|
+
if (videoElement) state.videoElement = videoElement;
|
|
203
|
+
var panoIndex = five.state.panoIndex;
|
|
204
|
+
var meshes = videoMeshes[panoIndex] = createPanoVideoMeshes(panoIndex);
|
|
205
|
+
meshes.forEach(function (mesh) {
|
|
206
|
+
return five.scene.add(mesh);
|
|
207
|
+
});
|
|
208
|
+
getVideoTexture(state.videoSource, state.videoElement).then(function (videoTexture_) {
|
|
209
|
+
if (videoTexture_.videoSource !== state.videoSource) return;
|
|
210
|
+
state.videoTexture = videoTexture_;
|
|
211
|
+
|
|
212
|
+
var timeupdate = function timeupdate() {
|
|
213
|
+
videoTexture_.image.removeEventListener('timeupdate', timeupdate);
|
|
214
|
+
state.videoTextureEnabled = true;
|
|
215
|
+
videoMeshes.forEach(function (meshes) {
|
|
216
|
+
if (!meshes) return;
|
|
217
|
+
meshes.forEach(function (mesh) {
|
|
218
|
+
if (mesh.material.map !== state.videoTexture) {
|
|
219
|
+
mesh.material.map = videoTexture_;
|
|
220
|
+
}
|
|
221
|
+
});
|
|
222
|
+
});
|
|
223
|
+
};
|
|
224
|
+
|
|
225
|
+
state.videoTexture.image.addEventListener('timeupdate', timeupdate);
|
|
226
|
+
if (state.enabled) state.videoTexture.image.play();
|
|
227
|
+
});
|
|
228
|
+
};
|
|
229
|
+
|
|
230
|
+
five.on('renderFrame', function () {
|
|
231
|
+
videoMeshes.forEach(function (meshes) {
|
|
232
|
+
if (meshes) meshes.forEach(function (mesh) {
|
|
233
|
+
//@ts-ignore
|
|
234
|
+
mesh.needsRender = true;
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
});
|
|
238
|
+
five.on('panoWillArrive', function (panoIndex) {
|
|
239
|
+
if (!state.enabled) return;
|
|
240
|
+
if (five.panoIndex === panoIndex) return;
|
|
241
|
+
|
|
242
|
+
if (!videoMeshes[panoIndex]) {
|
|
243
|
+
var meshes = videoMeshes[panoIndex] = createPanoVideoMeshes(panoIndex);
|
|
244
|
+
meshes.forEach(function (mesh) {
|
|
245
|
+
mesh.material.opacity = 0;
|
|
246
|
+
five.scene.add(mesh);
|
|
247
|
+
});
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
if (videoMeshes[panoIndex].length) {
|
|
251
|
+
if (state.videoTexture) state.videoTexture.image.play();
|
|
252
|
+
} else {
|
|
253
|
+
if (state.videoTexture) state.videoTexture.image.pause();
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
five.on('movingToPano', function (panoIndex, prevPanoIndex, progress) {
|
|
257
|
+
if (!state.enabled) return;
|
|
258
|
+
if (prevPanoIndex === panoIndex) return;
|
|
259
|
+
videoMeshes.forEach(function (meshes, index) {
|
|
260
|
+
var _progress = index === panoIndex ? progress : 1 - progress;
|
|
261
|
+
|
|
262
|
+
var opacity = Math.max(0, _progress * 21 - 20);
|
|
263
|
+
|
|
264
|
+
if (videoMeshes[index]) {
|
|
265
|
+
videoMeshes[index].forEach(function (mesh) {
|
|
266
|
+
return mesh.material.opacity = opacity;
|
|
267
|
+
});
|
|
268
|
+
}
|
|
269
|
+
});
|
|
270
|
+
});
|
|
271
|
+
five.on('panoArrived', function (panoIndex) {
|
|
272
|
+
if (!state.enabled) return;
|
|
273
|
+
videoMeshes.forEach(function (meshes, index) {
|
|
274
|
+
if (index === panoIndex) {
|
|
275
|
+
if (!videoMeshes[index]) {
|
|
276
|
+
var _meshes = videoMeshes[index] = createPanoVideoMeshes(index);
|
|
277
|
+
|
|
278
|
+
_meshes.forEach(function (mesh) {
|
|
279
|
+
return five.scene.add(mesh);
|
|
280
|
+
});
|
|
281
|
+
}
|
|
282
|
+
} else {
|
|
283
|
+
if (videoMeshes[index]) {
|
|
284
|
+
videoMeshes[index].forEach(function (mesh) {
|
|
285
|
+
mesh.geometry.dispose();
|
|
286
|
+
mesh.material.dispose();
|
|
287
|
+
five.scene.remove(mesh);
|
|
288
|
+
});
|
|
289
|
+
videoMeshes[index] = undefined;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
});
|
|
294
|
+
five.on('modeChange', function (mode) {
|
|
295
|
+
if (!state.enabled) return;
|
|
296
|
+
if (mode === _five.Five.Mode.Panorama) return;
|
|
297
|
+
videoMeshes.forEach(function () {// if (meshes) {
|
|
298
|
+
// meshes.forEach((mesh) => {
|
|
299
|
+
// mesh.geometry.dispose()
|
|
300
|
+
// mesh.material.dispose()
|
|
301
|
+
// five.scene.remove(mesh)
|
|
302
|
+
// })
|
|
303
|
+
// videoMeshes[index] = undefined
|
|
304
|
+
// if (state.videoTexture) state.videoTexture.image.pause()
|
|
305
|
+
// }
|
|
306
|
+
});
|
|
307
|
+
});
|
|
308
|
+
five.on('wantsTapGesture', function (raycaster) {
|
|
309
|
+
if (!state.enabled) return;
|
|
310
|
+
var meshArray = [];
|
|
311
|
+
videoMeshes.forEach(function (meshes) {
|
|
312
|
+
if (meshes) meshArray.push.apply(meshArray, _toConsumableArray(meshes));
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
if (raycaster.intersectObjects(meshArray).length) {
|
|
316
|
+
if (state.videoTexture) {
|
|
317
|
+
state.videoTexture.image.muted = !state.videoTexture.image.muted;
|
|
318
|
+
state.videoTexture.image.play();
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
return false;
|
|
322
|
+
}
|
|
323
|
+
});
|
|
324
|
+
five.on('dispose', function () {
|
|
325
|
+
videoMeshes.forEach(function (meshes, index) {
|
|
326
|
+
if (meshes) {
|
|
327
|
+
meshes.forEach(function (mesh) {
|
|
328
|
+
mesh.geometry.dispose();
|
|
329
|
+
mesh.material.dispose();
|
|
330
|
+
five.scene.remove(mesh);
|
|
331
|
+
});
|
|
332
|
+
videoMeshes[index] = undefined;
|
|
333
|
+
if (state.videoTexture) state.videoTexture.image.pause();
|
|
334
|
+
}
|
|
335
|
+
});
|
|
336
|
+
});
|
|
337
|
+
five.on('load', function (input) {
|
|
338
|
+
if (input.panoTVVideoData) {
|
|
339
|
+
load(input.panoTVVideoData);
|
|
340
|
+
}
|
|
341
|
+
});
|
|
342
|
+
return {
|
|
343
|
+
enable: enable,
|
|
344
|
+
disable: disable,
|
|
345
|
+
load: load
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
|
|
349
|
+
exports.PanoTVVideoPlugin = PanoTVVideoPlugin;
|
|
350
|
+
var _default = PanoTVVideoPlugin;
|
|
351
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { Five } from '@realsee/five';
|
|
2
|
+
import { TreasureType } from './constants';
|
|
3
|
+
/** 宝箱数据 */
|
|
4
|
+
export interface TreasurePluginItemData {
|
|
5
|
+
/** 宝箱 ID */
|
|
6
|
+
id: string;
|
|
7
|
+
/** 宝箱位置:[x, y, z] */
|
|
8
|
+
position: number[];
|
|
9
|
+
/** 宝箱类型 */
|
|
10
|
+
type: TreasureType;
|
|
11
|
+
}
|
|
12
|
+
export interface TreasurePluginData {
|
|
13
|
+
treasures: TreasurePluginItemData[];
|
|
14
|
+
}
|
|
15
|
+
export declare type TreasurePluginParameterType = undefined;
|
|
16
|
+
export declare type TreasurePluginEvents = {
|
|
17
|
+
/** 点击宝箱事件
|
|
18
|
+
* @param id: 宝箱 ID
|
|
19
|
+
*/
|
|
20
|
+
tap: (id: string) => void;
|
|
21
|
+
};
|
|
22
|
+
export declare class TreasurePluginController {
|
|
23
|
+
private five;
|
|
24
|
+
private selfGroup;
|
|
25
|
+
private hooks;
|
|
26
|
+
private fbxLoader;
|
|
27
|
+
private treasures;
|
|
28
|
+
constructor(five: Five);
|
|
29
|
+
load(data: TreasurePluginData): Promise<boolean>;
|
|
30
|
+
removeTreasureByID(id: string): boolean;
|
|
31
|
+
private onTreasureClick;
|
|
32
|
+
}
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.TreasurePluginController = void 0;
|
|
9
|
+
|
|
10
|
+
var _five = require("@realsee/five");
|
|
11
|
+
|
|
12
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
13
|
+
|
|
14
|
+
var _FBXLoader = require("three/examples/jsm/loaders/FBXLoader");
|
|
15
|
+
|
|
16
|
+
var _constants = require("./constants");
|
|
17
|
+
|
|
18
|
+
var _TreasureObject = require("./TreasureObject");
|
|
19
|
+
|
|
20
|
+
var _loadFbxObj = require("../../shared-utils/three/loadFbxObj");
|
|
21
|
+
|
|
22
|
+
var _loadTreasureTextures = require("./utils/loadTreasureTextures");
|
|
23
|
+
|
|
24
|
+
var _loadTexture = require("../../shared-utils/three/loadTexture");
|
|
25
|
+
|
|
26
|
+
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); }
|
|
27
|
+
|
|
28
|
+
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; }
|
|
29
|
+
|
|
30
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
31
|
+
|
|
32
|
+
function _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."); }
|
|
33
|
+
|
|
34
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
35
|
+
|
|
36
|
+
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
37
|
+
|
|
38
|
+
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
39
|
+
|
|
40
|
+
function _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."); }
|
|
41
|
+
|
|
42
|
+
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
43
|
+
|
|
44
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
45
|
+
|
|
46
|
+
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
47
|
+
|
|
48
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
49
|
+
|
|
50
|
+
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); } }
|
|
51
|
+
|
|
52
|
+
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); }); }; }
|
|
53
|
+
|
|
54
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
55
|
+
|
|
56
|
+
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
|
|
57
|
+
|
|
58
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
59
|
+
|
|
60
|
+
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
61
|
+
|
|
62
|
+
// load 时才开始加载资源
|
|
63
|
+
// 根据传入的数据判断需要加载哪些资源
|
|
64
|
+
// 先写死宝箱类型,后续改成配置表,然后根据表里面的类型加载数据
|
|
65
|
+
// FBX 文件里面的贴图默认用的是黄色贴图,所以对于默认的贴图逻辑有特殊处理
|
|
66
|
+
var TreasurePluginController = /*#__PURE__*/function () {
|
|
67
|
+
function TreasurePluginController(five) {
|
|
68
|
+
var _this = this;
|
|
69
|
+
|
|
70
|
+
_classCallCheck(this, TreasurePluginController);
|
|
71
|
+
|
|
72
|
+
_defineProperty(this, "hooks", new _five.Subscribe());
|
|
73
|
+
|
|
74
|
+
_defineProperty(this, "fbxLoader", new _FBXLoader.FBXLoader());
|
|
75
|
+
|
|
76
|
+
_defineProperty(this, "treasures", []);
|
|
77
|
+
|
|
78
|
+
_defineProperty(this, "onTreasureClick", function (id) {
|
|
79
|
+
_this.hooks.emit('tap', id);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
this.five = five; // ========== self group ==========
|
|
83
|
+
|
|
84
|
+
this.selfGroup = new THREE.Group();
|
|
85
|
+
this.selfGroup.name = 'treasure-plugin-group';
|
|
86
|
+
this.five.scene.add(this.selfGroup);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
_createClass(TreasurePluginController, [{
|
|
90
|
+
key: "load",
|
|
91
|
+
value: function () {
|
|
92
|
+
var _load = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee(data) {
|
|
93
|
+
var _this2 = this,
|
|
94
|
+
_this$selfGroup;
|
|
95
|
+
|
|
96
|
+
var baseFbxObjPromise, treasureTexturesPromise, faceTexturesPromise, _yield$Promise$all, _yield$Promise$all2, fbxGroup, treasureTextures, treasures;
|
|
97
|
+
|
|
98
|
+
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
99
|
+
while (1) {
|
|
100
|
+
switch (_context.prev = _context.next) {
|
|
101
|
+
case 0:
|
|
102
|
+
baseFbxObjPromise = (0, _loadFbxObj.loadFbxObj)(this.fbxLoader, _constants.TREASURE_FBX_URL);
|
|
103
|
+
treasureTexturesPromise = (0, _loadTreasureTextures.loadTreasureTextures)(data, baseFbxObjPromise);
|
|
104
|
+
faceTexturesPromise = Promise.all(_constants.TREASURE_FACE_ANIMATION_URLS.map(_loadTexture.loadTexture));
|
|
105
|
+
_context.next = 5;
|
|
106
|
+
return Promise.all([baseFbxObjPromise, treasureTexturesPromise]);
|
|
107
|
+
|
|
108
|
+
case 5:
|
|
109
|
+
_yield$Promise$all = _context.sent;
|
|
110
|
+
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 2);
|
|
111
|
+
fbxGroup = _yield$Promise$all2[0];
|
|
112
|
+
treasureTextures = _yield$Promise$all2[1];
|
|
113
|
+
treasures = data.treasures.map(function (_ref) {
|
|
114
|
+
var _treasureTextures$fin;
|
|
115
|
+
|
|
116
|
+
var id = _ref.id,
|
|
117
|
+
type = _ref.type,
|
|
118
|
+
positionArray = _ref.position;
|
|
119
|
+
var texture = (_treasureTextures$fin = treasureTextures.find(function (_ref2) {
|
|
120
|
+
var treasureMapItem = _ref2.treasureMapItem;
|
|
121
|
+
return treasureMapItem.type === type;
|
|
122
|
+
})) === null || _treasureTextures$fin === void 0 ? void 0 : _treasureTextures$fin.texture;
|
|
123
|
+
if (!texture) throw new Error('数据初始化失败,未能找到预期的 Texture');
|
|
124
|
+
var position = new THREE.Vector3().fromArray(positionArray).applyAxisAngle(new THREE.Vector3(1, 0, 0), Math.PI);
|
|
125
|
+
var treasure = new _TreasureObject.TreasureObject({
|
|
126
|
+
id: id,
|
|
127
|
+
fbxGroup: fbxGroup,
|
|
128
|
+
position: position,
|
|
129
|
+
five: _this2.five,
|
|
130
|
+
faceTexturesPromise: faceTexturesPromise,
|
|
131
|
+
baseTexture: texture,
|
|
132
|
+
clickCallback: _this2.onTreasureClick
|
|
133
|
+
});
|
|
134
|
+
treasure.scale.fromArray([0.008, 0.008, 0.008]);
|
|
135
|
+
return treasure;
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
(_this$selfGroup = this.selfGroup).add.apply(_this$selfGroup, _toConsumableArray(treasures));
|
|
139
|
+
|
|
140
|
+
this.treasures = treasures;
|
|
141
|
+
return _context.abrupt("return", true);
|
|
142
|
+
|
|
143
|
+
case 13:
|
|
144
|
+
case "end":
|
|
145
|
+
return _context.stop();
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}, _callee, this);
|
|
149
|
+
}));
|
|
150
|
+
|
|
151
|
+
function load(_x) {
|
|
152
|
+
return _load.apply(this, arguments);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
return load;
|
|
156
|
+
}()
|
|
157
|
+
}, {
|
|
158
|
+
key: "removeTreasureByID",
|
|
159
|
+
value: function removeTreasureByID(id) {
|
|
160
|
+
var treasureIndex = this.treasures.findIndex(function (treasure) {
|
|
161
|
+
return treasure.treasureID === id;
|
|
162
|
+
});
|
|
163
|
+
if (typeof treasureIndex !== 'number') return false;
|
|
164
|
+
var treasure = this.treasures[treasureIndex];
|
|
165
|
+
treasure.dispose();
|
|
166
|
+
this.selfGroup.remove(treasure);
|
|
167
|
+
this.treasures.slice(treasureIndex, 1);
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
}]);
|
|
171
|
+
|
|
172
|
+
return TreasurePluginController;
|
|
173
|
+
}();
|
|
174
|
+
|
|
175
|
+
exports.TreasurePluginController = TreasurePluginController;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Five } from '@realsee/five';
|
|
2
|
+
import { Group, Texture } from 'three';
|
|
3
|
+
export interface TreasureFaceAnimeParam {
|
|
4
|
+
five: Five;
|
|
5
|
+
treasureGroup: Group;
|
|
6
|
+
faceTexturesPromise: Promise<Texture[]>;
|
|
7
|
+
}
|
|
8
|
+
export declare class TreasureFaceAnime {
|
|
9
|
+
paused: boolean;
|
|
10
|
+
private five;
|
|
11
|
+
private treasureGroup;
|
|
12
|
+
private faceAnimeStep;
|
|
13
|
+
private faceAnimeTimer?;
|
|
14
|
+
private faceTexturesPromise;
|
|
15
|
+
private initialFaceTexture;
|
|
16
|
+
private faceMesh;
|
|
17
|
+
constructor(param: TreasureFaceAnimeParam);
|
|
18
|
+
play: () => Promise<boolean>;
|
|
19
|
+
pause(): boolean;
|
|
20
|
+
dispose(): void;
|
|
21
|
+
setToInitialState(): void;
|
|
22
|
+
private clearTimer;
|
|
23
|
+
}
|