@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,199 @@
|
|
|
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.ModelViewPlugin = void 0;
|
|
9
|
+
|
|
10
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Five 模型插件
|
|
18
|
+
* @template ExportType 导出方法
|
|
19
|
+
*/
|
|
20
|
+
var ModelViewPlugin = function ModelViewPlugin(five) {
|
|
21
|
+
var needsRender = true;
|
|
22
|
+
var scene = new THREE.Scene();
|
|
23
|
+
var camera = new THREE.PerspectiveCamera(60, 1, 0.1, 1000);
|
|
24
|
+
var model = new THREE.Object3D();
|
|
25
|
+
{
|
|
26
|
+
var light = new THREE.DirectionalLight(0xffffff, 0.5);
|
|
27
|
+
light.position.copy(new THREE.Vector3(1, 1, 1));
|
|
28
|
+
scene.add(light);
|
|
29
|
+
}
|
|
30
|
+
{
|
|
31
|
+
var _light = new THREE.DirectionalLight(0xffffff, 0.3);
|
|
32
|
+
|
|
33
|
+
scene.add(_light);
|
|
34
|
+
}
|
|
35
|
+
{
|
|
36
|
+
var _light2 = new THREE.AmbientLight(0xffffff, 0.3);
|
|
37
|
+
|
|
38
|
+
scene.add(_light2);
|
|
39
|
+
}
|
|
40
|
+
scene.add(model);
|
|
41
|
+
var renderer = null;
|
|
42
|
+
|
|
43
|
+
var initRendererIfNeeds = function initRendererIfNeeds() {
|
|
44
|
+
if (!five.renderer) return;
|
|
45
|
+
|
|
46
|
+
if (!renderer) {
|
|
47
|
+
renderer = new THREE.WebGLRenderer({
|
|
48
|
+
antialias: false,
|
|
49
|
+
alpha: true
|
|
50
|
+
});
|
|
51
|
+
renderer.setPixelRatio(five.renderer.getPixelRatio());
|
|
52
|
+
renderer.outputEncoding = THREE.sRGBEncoding;
|
|
53
|
+
renderer.setClearColor(0x181a1c, 0);
|
|
54
|
+
renderer.autoClear = true;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
return renderer;
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
var modelWillLoad = function modelWillLoad() {
|
|
61
|
+
model.traverse(function (object) {
|
|
62
|
+
if (object instanceof THREE.Mesh) {
|
|
63
|
+
var materials = [].concat(object.material);
|
|
64
|
+
materials.forEach(function (material) {
|
|
65
|
+
return material.dispose();
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
scene.remove(model);
|
|
70
|
+
model = new THREE.Object3D();
|
|
71
|
+
scene.add(model);
|
|
72
|
+
update();
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
var modelLoaded = function modelLoaded() {
|
|
76
|
+
function cloneMaterial(material) {
|
|
77
|
+
material = material.clone();
|
|
78
|
+
material.uniforms.modelAlpha.value = 1;
|
|
79
|
+
|
|
80
|
+
if (material.uniforms.map.value) {
|
|
81
|
+
material.uniforms.map.value.needsUpdate = true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return material;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function cloneModel(model) {
|
|
88
|
+
if (model instanceof THREE.Mesh) {
|
|
89
|
+
var geometry = model.geometry;
|
|
90
|
+
var material = Array.isArray(model.material) ? model.material.map(cloneMaterial) : cloneMaterial(model.material);
|
|
91
|
+
return new THREE.Mesh(geometry, material);
|
|
92
|
+
} else if (model instanceof THREE.Group) {
|
|
93
|
+
var group = new THREE.Group();
|
|
94
|
+
model.children.forEach(function (object) {
|
|
95
|
+
return group.add(cloneModel(object));
|
|
96
|
+
});
|
|
97
|
+
return group;
|
|
98
|
+
} else {
|
|
99
|
+
var object3D = new THREE.Object3D();
|
|
100
|
+
model.children.forEach(function (object) {
|
|
101
|
+
return object3D.add(cloneModel(object));
|
|
102
|
+
});
|
|
103
|
+
return object3D;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
scene.remove(model);
|
|
108
|
+
model = cloneModel(five.model);
|
|
109
|
+
scene.add(model);
|
|
110
|
+
update();
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
var appendTo = function appendTo(element) {
|
|
114
|
+
var size = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
115
|
+
var renderer = initRendererIfNeeds();
|
|
116
|
+
if (!renderer) return;
|
|
117
|
+
element.appendChild(renderer.domElement);
|
|
118
|
+
refresh(size);
|
|
119
|
+
var positionType = window.getComputedStyle(element).position;
|
|
120
|
+
if (positionType !== 'relative' && positionType !== 'absolute' && positionType !== 'fixed' && positionType !== 'sticky') element.style.position = 'relative';
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
var refresh = function refresh() {
|
|
124
|
+
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
125
|
+
if (!renderer) return;
|
|
126
|
+
var element = renderer.domElement;
|
|
127
|
+
var container = element.parentNode;
|
|
128
|
+
|
|
129
|
+
if (container && container.nodeName) {
|
|
130
|
+
var _size$width = size.width,
|
|
131
|
+
width = _size$width === void 0 ? container.offsetWidth : _size$width,
|
|
132
|
+
_size$height = size.height,
|
|
133
|
+
height = _size$height === void 0 ? container.offsetHeight : _size$height;
|
|
134
|
+
renderer.setSize(width, height); // 修改摄像机 aspect 比值
|
|
135
|
+
|
|
136
|
+
camera.aspect = width / height;
|
|
137
|
+
camera.updateProjectionMatrix();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
needsRender = true;
|
|
141
|
+
};
|
|
142
|
+
|
|
143
|
+
var cameraDistance = function cameraDistance() {
|
|
144
|
+
var bounding = five.model.bounding;
|
|
145
|
+
var fov = camera.fov,
|
|
146
|
+
aspect = camera.aspect;
|
|
147
|
+
var radius = Math.sqrt(Math.pow(bounding.max.x - bounding.min.x + 2, 2) + Math.pow(bounding.max.y - bounding.min.y + 2, 2) + Math.pow(bounding.max.z - bounding.min.z + 2, 2)); // fit screen
|
|
148
|
+
|
|
149
|
+
var distance = radius / 2 / Math.tan(Math.PI * fov / 360);
|
|
150
|
+
if (aspect < 1) distance = distance / aspect;
|
|
151
|
+
return isNaN(distance) ? radius : distance;
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
var update = function update() {
|
|
155
|
+
var _five$getPose = five.getPose(),
|
|
156
|
+
longitude = _five$getPose.longitude,
|
|
157
|
+
latitude = _five$getPose.latitude;
|
|
158
|
+
|
|
159
|
+
var distance = cameraDistance();
|
|
160
|
+
var lookAt = five.model.bounding.getCenter(new THREE.Vector3());
|
|
161
|
+
var longitudeDistance = distance * Math.cos(latitude);
|
|
162
|
+
var cameraPosition = new THREE.Vector3();
|
|
163
|
+
cameraPosition.x = Math.sin(longitude) * longitudeDistance + lookAt.x;
|
|
164
|
+
cameraPosition.z = Math.cos(longitude) * longitudeDistance + lookAt.z;
|
|
165
|
+
cameraPosition.y = Math.sin(latitude) * distance + lookAt.y;
|
|
166
|
+
camera.position.copy(cameraPosition);
|
|
167
|
+
camera.lookAt(lookAt);
|
|
168
|
+
needsRender = true;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
var render = function render() {
|
|
172
|
+
if (needsRender !== true) return;
|
|
173
|
+
if (!renderer) return;
|
|
174
|
+
if (!renderer.domElement.parentNode) return;
|
|
175
|
+
var parentNode = renderer.domElement.parentNode;
|
|
176
|
+
if (parentNode.offsetWidth === 0) return;
|
|
177
|
+
renderer.render(scene, camera);
|
|
178
|
+
needsRender = false;
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
var dispose = function dispose() {
|
|
182
|
+
if (renderer) renderer.dispose();
|
|
183
|
+
renderer = null;
|
|
184
|
+
};
|
|
185
|
+
|
|
186
|
+
five.on('modelLoaded', modelLoaded);
|
|
187
|
+
five.on('modelWillLoad', modelWillLoad);
|
|
188
|
+
five.on('cameraDirectionUpdate', update);
|
|
189
|
+
five.on('dispose', dispose);
|
|
190
|
+
five.on('renderFrame', render);
|
|
191
|
+
return {
|
|
192
|
+
appendTo: appendTo,
|
|
193
|
+
refresh: refresh
|
|
194
|
+
};
|
|
195
|
+
};
|
|
196
|
+
|
|
197
|
+
exports.ModelViewPlugin = ModelViewPlugin;
|
|
198
|
+
var _default = ModelViewPlugin;
|
|
199
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Intersection } from '@realsee/five';
|
|
3
|
+
export declare type StateType = {
|
|
4
|
+
fixDistance: number;
|
|
5
|
+
originPoint: Intersection['point'];
|
|
6
|
+
} & Intersection;
|
|
7
|
+
export interface PanoCursorRaycasterPluginUsageProps {
|
|
8
|
+
enable?: boolean;
|
|
9
|
+
pointAxesHelperEnable?: boolean;
|
|
10
|
+
movePointTowradsCameraEnable?: boolean;
|
|
11
|
+
dashLineFollowCursor?: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* **PanoCursorRaycaster** 全景鼠标碰撞监测应用举例:选择四个点生成矩形区域,然后在此区域中放置视频广告。
|
|
15
|
+
*
|
|
16
|
+
* ### Usage
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* import PanoCursorRaycasterPlugin from '@realsee/dnalogel/plugins/PanoCursorRaycasterPlugin'
|
|
20
|
+
* const five = new Five({ plugins: [[PanoCursorRaycasterPlugin, 'panoCursorRaycasterPlugin', {}]] })
|
|
21
|
+
*
|
|
22
|
+
* // 计算当前鼠标在当前点位全景中的碰撞监测结果。
|
|
23
|
+
* const res: Five.Intersection = panoCursorRaycasterPlugin.intersection()
|
|
24
|
+
* // 在点位上添加辅助坐标轴
|
|
25
|
+
* panoCursorRaycasterPlugin.pointAxesHelper(res.point)
|
|
26
|
+
*
|
|
27
|
+
*
|
|
28
|
+
* ```
|
|
29
|
+
*
|
|
30
|
+
* `Five.Intersection` 数据结构声明:
|
|
31
|
+
*
|
|
32
|
+
* ```ts
|
|
33
|
+
* export declare interface Intersection {
|
|
34
|
+
* // 焦点坐标
|
|
35
|
+
* point: THREE.Vector3;
|
|
36
|
+
* // 焦点面片
|
|
37
|
+
* face?: {
|
|
38
|
+
* normal: THREE.Vector3;
|
|
39
|
+
* };
|
|
40
|
+
* // 焦点距离
|
|
41
|
+
* distance: number;
|
|
42
|
+
* }
|
|
43
|
+
* ```
|
|
44
|
+
*
|
|
45
|
+
* > **注意事项**: 仅限有鼠标场景的碰撞监测,触摸屏不可用。
|
|
46
|
+
* @returns
|
|
47
|
+
*/
|
|
48
|
+
export declare function PanoCursorRaycasterPluginUsage(props: PanoCursorRaycasterPluginUsageProps): JSX.Element;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { StateType } from '../PanoCursorRaycasterPluginUsage';
|
|
4
|
+
export default function MovePointTowardsCamera(props: {
|
|
5
|
+
state: StateType[];
|
|
6
|
+
pointColors: string[];
|
|
7
|
+
setState: React.Dispatch<React.SetStateAction<StateType[]>>;
|
|
8
|
+
movePointTowardsCamera: (point: THREE.Vector3, distance: number) => THREE.Vector3;
|
|
9
|
+
}): JSX.Element | null;
|
|
@@ -0,0 +1,113 @@
|
|
|
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"] = MovePointTowardsCamera;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _antd = require("antd");
|
|
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 _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
19
|
+
|
|
20
|
+
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
21
|
+
|
|
22
|
+
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."); }
|
|
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 _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
29
|
+
|
|
30
|
+
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."); }
|
|
31
|
+
|
|
32
|
+
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); }
|
|
33
|
+
|
|
34
|
+
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; }
|
|
35
|
+
|
|
36
|
+
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; }
|
|
37
|
+
|
|
38
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
39
|
+
|
|
40
|
+
function MovePointTowardsCamera(props) {
|
|
41
|
+
if (!props.movePointTowardsCamera) return null; // 用于临时保存点的偏移数据
|
|
42
|
+
|
|
43
|
+
var _React$useState = React.useState([]),
|
|
44
|
+
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
45
|
+
fixDistance = _React$useState2[0],
|
|
46
|
+
setFixDistance = _React$useState2[1];
|
|
47
|
+
|
|
48
|
+
(0, React.useEffect)(function () {
|
|
49
|
+
// 监听撤销
|
|
50
|
+
if (props.state.length < fixDistance.length) {
|
|
51
|
+
setFixDistance(fixDistance.slice(0, props.state.length));
|
|
52
|
+
}
|
|
53
|
+
}, [props.state.length, fixDistance.length]);
|
|
54
|
+
var handlePointFix = React.useCallback(function (value, index) {
|
|
55
|
+
var render = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
|
56
|
+
fixDistance[index] = value;
|
|
57
|
+
setFixDistance(_toConsumableArray(fixDistance));
|
|
58
|
+
if (!render) return;
|
|
59
|
+
var _state = props.state;
|
|
60
|
+
var point = _state[index].originPoint;
|
|
61
|
+
_state[index].fixDistance = value;
|
|
62
|
+
_state[index].point = props.movePointTowardsCamera(point, value / 100);
|
|
63
|
+
props.setState(_toConsumableArray(_state));
|
|
64
|
+
}, [props.state]);
|
|
65
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
66
|
+
className: "PanoCursorRaycasterPluginUsage-Slider"
|
|
67
|
+
}, props.state.map(function (item, idx) {
|
|
68
|
+
var params = {
|
|
69
|
+
min: -10,
|
|
70
|
+
max: 20,
|
|
71
|
+
step: 0.1,
|
|
72
|
+
defaultValue: 0
|
|
73
|
+
};
|
|
74
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
75
|
+
key: idx
|
|
76
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
77
|
+
className: "inline-block flag-circle",
|
|
78
|
+
style: {
|
|
79
|
+
backgroundColor: props.pointColors[idx]
|
|
80
|
+
}
|
|
81
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
82
|
+
className: "inline-block slider",
|
|
83
|
+
style: {
|
|
84
|
+
width: 100
|
|
85
|
+
}
|
|
86
|
+
}, /*#__PURE__*/React.createElement(_antd.Slider, _extends({}, params, {
|
|
87
|
+
value: fixDistance[idx],
|
|
88
|
+
tipFormatter: function tipFormatter(value) {
|
|
89
|
+
return value + 'cm';
|
|
90
|
+
},
|
|
91
|
+
onChange: function onChange(value) {
|
|
92
|
+
return handlePointFix(value, idx);
|
|
93
|
+
},
|
|
94
|
+
onAfterChange: function onAfterChange(value) {
|
|
95
|
+
return handlePointFix(value, idx, true);
|
|
96
|
+
}
|
|
97
|
+
}))), /*#__PURE__*/React.createElement("div", {
|
|
98
|
+
className: "inline-block",
|
|
99
|
+
style: {
|
|
100
|
+
width: 50
|
|
101
|
+
}
|
|
102
|
+
}, /*#__PURE__*/React.createElement(_antd.InputNumber, _extends({}, params, {
|
|
103
|
+
value: fixDistance[idx],
|
|
104
|
+
size: "small",
|
|
105
|
+
formatter: function formatter(value) {
|
|
106
|
+
return "".concat(value, " cm");
|
|
107
|
+
},
|
|
108
|
+
onChange: function onChange(value) {
|
|
109
|
+
return handlePointFix(value, idx, true);
|
|
110
|
+
}
|
|
111
|
+
}))));
|
|
112
|
+
}));
|
|
113
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import * as THREE from 'three';
|
|
3
|
+
import { Vector3 } from 'three';
|
|
4
|
+
import { StateType } from '../PanoCursorRaycasterPluginUsage';
|
|
5
|
+
export default function PointAxesHelper(props: {
|
|
6
|
+
state: StateType;
|
|
7
|
+
pointAxesHelper?: (point: Vector3, length?: number, fixDistance?: number) => {
|
|
8
|
+
clear: () => void;
|
|
9
|
+
pointAxesHelperMesh: THREE.Group;
|
|
10
|
+
};
|
|
11
|
+
}): JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
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"] = PointAxesHelper;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
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); }
|
|
13
|
+
|
|
14
|
+
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; }
|
|
15
|
+
|
|
16
|
+
function PointAxesHelper(props) {
|
|
17
|
+
// 添加辅助坐标轴
|
|
18
|
+
(0, React.useEffect)(function () {
|
|
19
|
+
if (!props.pointAxesHelper) return;
|
|
20
|
+
var point = props.state.point;
|
|
21
|
+
var disposer = props.pointAxesHelper(point).clear;
|
|
22
|
+
return disposer;
|
|
23
|
+
}, [props.state]);
|
|
24
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
25
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
import type { FivePlugin, Intersection } from '@realsee/five';
|
|
3
|
+
import { Vector3 } from 'three';
|
|
4
|
+
export interface PanoCursorRaycasterPluginParameterType {
|
|
5
|
+
}
|
|
6
|
+
export interface PanoCursorRaycasterPluginExportType {
|
|
7
|
+
/**
|
|
8
|
+
* @description: 获取鼠标与模型的焦点位置
|
|
9
|
+
* @return {Intersection | null} 鼠标与模型的焦点位置
|
|
10
|
+
*/
|
|
11
|
+
intersection: () => Intersection | null;
|
|
12
|
+
/**
|
|
13
|
+
* @description: 辅助坐标轴
|
|
14
|
+
* @param {Vector3} point: 坐标轴原点的位置
|
|
15
|
+
* @param {number} length: 坐标轴线长度,单位:米,默认值:2
|
|
16
|
+
* @param {number} fixDistance: 为避免被模型遮挡,默认向camera方向移动0.1m,默认值:0.1
|
|
17
|
+
* @return {{clear: () => void; pointAxesHelperMesh: THREE.Group}} clear: 清理函数;pointAxesHelperMesh: 辅助坐标轴mesh
|
|
18
|
+
*/
|
|
19
|
+
pointAxesHelper: (point: Vector3, length?: number, fixDistance?: number) => {
|
|
20
|
+
clear: () => void;
|
|
21
|
+
pointAxesHelperMesh: THREE.Group;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* @description: 将一个点在camera和点的向量上移动。传入点的位置和相对移动的距离,返回一个新的位置
|
|
25
|
+
* @param {Vector3} point: 点
|
|
26
|
+
* @param {number} distance: 向camera相对移动的距离(正方向为:点 -> 摄像头)
|
|
27
|
+
* @return {Vector3} 计算移动后的位置
|
|
28
|
+
*/
|
|
29
|
+
movePointTowardsCamera: (point: Vector3, distance: number) => Vector3;
|
|
30
|
+
/**
|
|
31
|
+
* @description: 某个点是否可见
|
|
32
|
+
* @param {Vector3} point: 要检测的点
|
|
33
|
+
* @param {number} distanceError: 允许的误差,如果点有可能打在模型后,则传入一个误差值,通常为0.01
|
|
34
|
+
* @return {boolean}: 是否可见
|
|
35
|
+
*/
|
|
36
|
+
canSeePoint: (point: Vector3, distanceError?: number) => boolean;
|
|
37
|
+
/**
|
|
38
|
+
* @description: 清理函数
|
|
39
|
+
* @return {() => void} 清理函数
|
|
40
|
+
*/
|
|
41
|
+
destroy: () => void;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* 全景中对当前鼠标的位置进行碰撞监测
|
|
45
|
+
* @param five
|
|
46
|
+
* @return
|
|
47
|
+
*/
|
|
48
|
+
export declare const PanoCursorRaycasterPlugin: FivePlugin<PanoCursorRaycasterPluginParameterType, PanoCursorRaycasterPluginExportType>;
|
|
49
|
+
export default PanoCursorRaycasterPlugin;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = exports.PanoCursorRaycasterPlugin = void 0;
|
|
7
|
+
|
|
8
|
+
var _three = require("three");
|
|
9
|
+
|
|
10
|
+
var _createLine = _interopRequireDefault(require("../../shared-utils/createLine"));
|
|
11
|
+
|
|
12
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
13
|
+
|
|
14
|
+
function _objectDestructuringEmpty(obj) { if (obj == null) throw new TypeError("Cannot destructure undefined"); }
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 全景中对当前鼠标的位置进行碰撞监测
|
|
18
|
+
* @param five
|
|
19
|
+
* @return
|
|
20
|
+
*/
|
|
21
|
+
var PanoCursorRaycasterPlugin = function PanoCursorRaycasterPlugin(five, _ref) {
|
|
22
|
+
_objectDestructuringEmpty(_ref);
|
|
23
|
+
|
|
24
|
+
var state = {
|
|
25
|
+
intersection: null,
|
|
26
|
+
disposers: []
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
var updateIntersection = function updateIntersection(intersection) {
|
|
30
|
+
state.intersection = intersection;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
var clearIntersection = function clearIntersection() {
|
|
34
|
+
state.intersection = null;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
five.on('modelLoaded', function () {
|
|
38
|
+
five.on('intersectionOnModelUpdate', updateIntersection);
|
|
39
|
+
five.on('intersectionHidden', clearIntersection);
|
|
40
|
+
});
|
|
41
|
+
five.on('dispose', function () {
|
|
42
|
+
five.off('intersectionOnModelUpdate', updateIntersection);
|
|
43
|
+
five.off('intersectionHidden', clearIntersection);
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
var pointAxesHelper = function pointAxesHelper(point) {
|
|
47
|
+
var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 2;
|
|
48
|
+
var fixDistance = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 0.1;
|
|
49
|
+
var halfLength = length / 2;
|
|
50
|
+
var helperCenterPoint = movePointTowardsCamera(point, fixDistance);
|
|
51
|
+
var p = helperCenterPoint;
|
|
52
|
+
var pointAxesHelperMesh = new _three.Group();
|
|
53
|
+
pointAxesHelperMesh.add((0, _createLine["default"])(new _three.Vector3(p.x + halfLength, p.y, p.z), new _three.Vector3(p.x - halfLength, p.y, p.z), new _three.Vector3(1, 0, 0)), (0, _createLine["default"])(new _three.Vector3(p.x, p.y + halfLength, p.z), new _three.Vector3(p.x, p.y - halfLength, p.z), new _three.Vector3(0, 1, 0)), (0, _createLine["default"])(new _three.Vector3(p.x, p.y, p.z + halfLength), new _three.Vector3(p.x, p.y, p.z - halfLength), new _three.Vector3(0, 0, 1)));
|
|
54
|
+
five.scene.add(pointAxesHelperMesh);
|
|
55
|
+
five.needsRender = true; // 清理函数
|
|
56
|
+
|
|
57
|
+
var clear = function clear() {
|
|
58
|
+
five.scene.remove(pointAxesHelperMesh);
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
state.disposers.push(clear);
|
|
62
|
+
return {
|
|
63
|
+
clear: clear,
|
|
64
|
+
pointAxesHelperMesh: pointAxesHelperMesh
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
var canSeePoint = function canSeePoint(point) {
|
|
69
|
+
var _five$camera, _five$model$intersect;
|
|
70
|
+
|
|
71
|
+
var distanceError = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
|
|
72
|
+
var cameraPosition = five === null || five === void 0 ? void 0 : (_five$camera = five.camera) === null || _five$camera === void 0 ? void 0 : _five$camera.position;
|
|
73
|
+
if (!cameraPosition) return false;
|
|
74
|
+
var distance = point.distanceTo(cameraPosition);
|
|
75
|
+
var direction = point.sub(cameraPosition).normalize();
|
|
76
|
+
var raycaster = new _three.Raycaster(cameraPosition, direction);
|
|
77
|
+
var intersection = (_five$model$intersect = five.model.intersectRaycaster(raycaster)) === null || _five$model$intersect === void 0 ? void 0 : _five$model$intersect[0];
|
|
78
|
+
if (intersection && intersection.distance + distanceError < distance) return false;
|
|
79
|
+
return true;
|
|
80
|
+
};
|
|
81
|
+
|
|
82
|
+
var intersection = function intersection() {
|
|
83
|
+
return state.intersection;
|
|
84
|
+
};
|
|
85
|
+
|
|
86
|
+
var destroy = function destroy() {
|
|
87
|
+
var _state$disposers, _state$disposers$forE;
|
|
88
|
+
|
|
89
|
+
(_state$disposers = state.disposers) === null || _state$disposers === void 0 ? void 0 : (_state$disposers$forE = _state$disposers.forEach) === null || _state$disposers$forE === void 0 ? void 0 : _state$disposers$forE.call(_state$disposers, function (d) {
|
|
90
|
+
return d === null || d === void 0 ? void 0 : d();
|
|
91
|
+
});
|
|
92
|
+
five.off('intersectionOnModelUpdate', updateIntersection);
|
|
93
|
+
five.off('intersectionHidden', clearIntersection);
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
var movePointTowardsCamera = function movePointTowardsCamera(point, distance) {
|
|
97
|
+
// 原点 position
|
|
98
|
+
var originPoint = point.clone(); // camera position
|
|
99
|
+
|
|
100
|
+
var cameraPosition = five.camera.position.clone(); // 移动的向量
|
|
101
|
+
|
|
102
|
+
var fixVector3 = cameraPosition.sub(originPoint).setLength(distance); // 向量相加
|
|
103
|
+
|
|
104
|
+
var newPoint = fixVector3.add(originPoint);
|
|
105
|
+
return newPoint;
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
return {
|
|
109
|
+
intersection: intersection,
|
|
110
|
+
pointAxesHelper: pointAxesHelper,
|
|
111
|
+
movePointTowardsCamera: movePointTowardsCamera,
|
|
112
|
+
destroy: destroy,
|
|
113
|
+
canSeePoint: canSeePoint
|
|
114
|
+
};
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
exports.PanoCursorRaycasterPlugin = PanoCursorRaycasterPlugin;
|
|
118
|
+
var _default = PanoCursorRaycasterPlugin;
|
|
119
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = addLineToFive;
|
|
7
|
+
|
|
8
|
+
var _createLine = _interopRequireDefault(require("../../../shared-utils/createLine"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
function addLineToFive(five, point1, point2, color) {
|
|
13
|
+
var line = (0, _createLine["default"])(point1, point2, color, false);
|
|
14
|
+
five.scene.add(line);
|
|
15
|
+
five.needsRender = true;
|
|
16
|
+
|
|
17
|
+
var clear = function clear() {
|
|
18
|
+
five === null || five === void 0 ? void 0 : five.scene.remove(line);
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
clear: clear,
|
|
23
|
+
line: line
|
|
24
|
+
};
|
|
25
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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"] = creatLine;
|
|
9
|
+
|
|
10
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
+
|
|
12
|
+
var _line = require("@realsee/five/line");
|
|
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 creatLine(point1, point2) {
|
|
19
|
+
var color = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : new THREE.Vector3(1, 1, 1);
|
|
20
|
+
var dashed = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
|
21
|
+
var line = new _line.Line(point1, point2);
|
|
22
|
+
line.setMaterial({
|
|
23
|
+
dashed: dashed,
|
|
24
|
+
color: color,
|
|
25
|
+
linewidth: 1
|
|
26
|
+
});
|
|
27
|
+
line.remove(line.points);
|
|
28
|
+
return line; // const material = dash
|
|
29
|
+
// ? new LineDashedMaterial({ color, dashSize: 0.1, gapSize: 0.05, scale: 0.2 })
|
|
30
|
+
// : new THREE.LineBasicMaterial({ color })
|
|
31
|
+
// const geometry = new THREE.BufferGeometry().setFromPoints([point1, point2])
|
|
32
|
+
// const line = new THREE.Line(geometry, material)
|
|
33
|
+
// return line
|
|
34
|
+
}
|