@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,49 @@
|
|
|
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.ImgBgTransparent = ImgBgTransparent;
|
|
9
|
+
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
13
|
+
|
|
14
|
+
var _ImgBgTransparentMesh = require("./ImgBgTransparentMesh");
|
|
15
|
+
|
|
16
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
17
|
+
|
|
18
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
|
+
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
21
|
+
|
|
22
|
+
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; }
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* **透明背景** 与 **AR 视频形象** `ARVideoFigure` 实现原理一致,不过此组件仅针对图片。
|
|
26
|
+
*
|
|
27
|
+
* 生产环境中还是建议直接采用 `png` 这类支持透明背景的图片。在实际业务落地过程中,如果视频文件生成比较滞后,你可以先通过对应图片来预览效果,调试相关参数。
|
|
28
|
+
*
|
|
29
|
+
* @param props
|
|
30
|
+
* @returns
|
|
31
|
+
*/
|
|
32
|
+
function ImgBgTransparent(props) {
|
|
33
|
+
var ref = React.useRef(null);
|
|
34
|
+
React.useEffect(function () {
|
|
35
|
+
if (!ref.current) return;
|
|
36
|
+
var imgBgTransparentScene = new _ImgBgTransparentMesh.ImgBgTransparentScene(ref.current, props.imgUrl);
|
|
37
|
+
Object.assign(window, {
|
|
38
|
+
$imgBgTransparentScene: imgBgTransparentScene
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
if (props.imgBgTransparentSceneRef) {
|
|
42
|
+
props.imgBgTransparentSceneRef(imgBgTransparentScene);
|
|
43
|
+
}
|
|
44
|
+
}, []);
|
|
45
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
46
|
+
className: (0, _classnames["default"])('ImgBgTransparent', _defineProperty({}, props.className + '', !!props.className)),
|
|
47
|
+
ref: ref
|
|
48
|
+
});
|
|
49
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export declare class ImgBgTransparentMesh extends THREE.Mesh {
|
|
3
|
+
imgUrl?: string;
|
|
4
|
+
freeze: boolean;
|
|
5
|
+
get imageTexture(): THREE.Texture;
|
|
6
|
+
/**
|
|
7
|
+
*
|
|
8
|
+
* @param imgUrl
|
|
9
|
+
* @param width
|
|
10
|
+
* @param height
|
|
11
|
+
* @param widthSegments
|
|
12
|
+
* @param heightSegments
|
|
13
|
+
*/
|
|
14
|
+
constructor(imgUrl: string, width: number, height: number, widthSegments: number, heightSegments: number, onLoad?: (texture: THREE.Texture) => void);
|
|
15
|
+
private get uniforms();
|
|
16
|
+
setHidden(hidden: boolean): void;
|
|
17
|
+
updateUniforms({ range, edge0, edge1 }: {
|
|
18
|
+
range: number;
|
|
19
|
+
edge0: number;
|
|
20
|
+
edge1: number;
|
|
21
|
+
}): void;
|
|
22
|
+
}
|
|
23
|
+
export declare class ImgBgTransparentScene {
|
|
24
|
+
scene: THREE.Scene;
|
|
25
|
+
renderer: THREE.WebGLRenderer;
|
|
26
|
+
camera: THREE.OrthographicCamera;
|
|
27
|
+
mesh: ImgBgTransparentMesh;
|
|
28
|
+
constructor(container: HTMLElement, imgUrl: string);
|
|
29
|
+
render(): void;
|
|
30
|
+
}
|
|
@@ -0,0 +1,173 @@
|
|
|
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.ImgBgTransparentScene = exports.ImgBgTransparentMesh = void 0;
|
|
9
|
+
|
|
10
|
+
var THREE = _interopRequireWildcard(require("three"));
|
|
11
|
+
|
|
12
|
+
var _vertexShader = require("./vertexShader");
|
|
13
|
+
|
|
14
|
+
var _fragmentShader = require("./fragmentShader");
|
|
15
|
+
|
|
16
|
+
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); }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
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; }
|
|
21
|
+
|
|
22
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
23
|
+
|
|
24
|
+
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); } }
|
|
25
|
+
|
|
26
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
|
|
27
|
+
|
|
28
|
+
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
|
29
|
+
|
|
30
|
+
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
|
|
31
|
+
|
|
32
|
+
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
33
|
+
|
|
34
|
+
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } else if (call !== void 0) { throw new TypeError("Derived constructors may only return object or undefined"); } return _assertThisInitialized(self); }
|
|
35
|
+
|
|
36
|
+
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
37
|
+
|
|
38
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
39
|
+
|
|
40
|
+
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
41
|
+
|
|
42
|
+
var ImgBgTransparentMesh = /*#__PURE__*/function (_THREE$Mesh) {
|
|
43
|
+
_inherits(ImgBgTransparentMesh, _THREE$Mesh);
|
|
44
|
+
|
|
45
|
+
var _super = _createSuper(ImgBgTransparentMesh);
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
*
|
|
49
|
+
* @param imgUrl
|
|
50
|
+
* @param width
|
|
51
|
+
* @param height
|
|
52
|
+
* @param widthSegments
|
|
53
|
+
* @param heightSegments
|
|
54
|
+
*/
|
|
55
|
+
function ImgBgTransparentMesh(imgUrl, width, height, widthSegments, heightSegments, onLoad) {
|
|
56
|
+
var _this;
|
|
57
|
+
|
|
58
|
+
_classCallCheck(this, ImgBgTransparentMesh);
|
|
59
|
+
|
|
60
|
+
var geometry = new THREE.PlaneGeometry(width, height, widthSegments, heightSegments);
|
|
61
|
+
var imageTexture = new THREE.TextureLoader().load(imgUrl || '//vrlab-static.ljcdn.com/release/web/trans.92281b56.jpg', function (texture) {
|
|
62
|
+
if (onLoad) {
|
|
63
|
+
onLoad(texture);
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
var material = new THREE.ShaderMaterial({
|
|
67
|
+
uniforms: {
|
|
68
|
+
map: {
|
|
69
|
+
value: imageTexture
|
|
70
|
+
},
|
|
71
|
+
enable: {
|
|
72
|
+
value: 0
|
|
73
|
+
},
|
|
74
|
+
range: {
|
|
75
|
+
value: 0.15
|
|
76
|
+
},
|
|
77
|
+
edge0: {
|
|
78
|
+
value: 0.1
|
|
79
|
+
},
|
|
80
|
+
edge1: {
|
|
81
|
+
value: 0.3
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
vertexShader: _vertexShader.vertexShader,
|
|
85
|
+
fragmentShader: (0, _fragmentShader.fragmentShaderTpl)(),
|
|
86
|
+
transparent: true
|
|
87
|
+
});
|
|
88
|
+
_this = _super.call(this, geometry, material);
|
|
89
|
+
_this.imgUrl = imgUrl;
|
|
90
|
+
_this.freeze = false;
|
|
91
|
+
return _this;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
_createClass(ImgBgTransparentMesh, [{
|
|
95
|
+
key: "imageTexture",
|
|
96
|
+
get: function get() {
|
|
97
|
+
return this.uniforms.map.value;
|
|
98
|
+
}
|
|
99
|
+
}, {
|
|
100
|
+
key: "uniforms",
|
|
101
|
+
get: function get() {
|
|
102
|
+
var uniforms = this.material.uniforms;
|
|
103
|
+
return uniforms;
|
|
104
|
+
}
|
|
105
|
+
}, {
|
|
106
|
+
key: "setHidden",
|
|
107
|
+
value: function setHidden(hidden) {
|
|
108
|
+
this.uniforms.enable.value = hidden ? 0 : 1;
|
|
109
|
+
}
|
|
110
|
+
}, {
|
|
111
|
+
key: "updateUniforms",
|
|
112
|
+
value: function updateUniforms(_ref) {
|
|
113
|
+
var range = _ref.range,
|
|
114
|
+
edge0 = _ref.edge0,
|
|
115
|
+
edge1 = _ref.edge1;
|
|
116
|
+
this.uniforms.range.value = isNaN(range) ? 0.15 : range;
|
|
117
|
+
this.uniforms.edge0.value = isNaN(edge0) ? 0.1 : edge0;
|
|
118
|
+
this.uniforms.edge1.value = isNaN(edge1) ? 0.1 : edge1;
|
|
119
|
+
console.log(this.uniforms);
|
|
120
|
+
}
|
|
121
|
+
}]);
|
|
122
|
+
|
|
123
|
+
return ImgBgTransparentMesh;
|
|
124
|
+
}(THREE.Mesh);
|
|
125
|
+
|
|
126
|
+
exports.ImgBgTransparentMesh = ImgBgTransparentMesh;
|
|
127
|
+
|
|
128
|
+
var ImgBgTransparentScene = /*#__PURE__*/function () {
|
|
129
|
+
function ImgBgTransparentScene(container, imgUrl) {
|
|
130
|
+
var _this2 = this;
|
|
131
|
+
|
|
132
|
+
_classCallCheck(this, ImgBgTransparentScene);
|
|
133
|
+
|
|
134
|
+
_defineProperty(this, "scene", new THREE.Scene());
|
|
135
|
+
|
|
136
|
+
_defineProperty(this, "renderer", new THREE.WebGLRenderer({
|
|
137
|
+
alpha: true
|
|
138
|
+
}));
|
|
139
|
+
|
|
140
|
+
var state = {
|
|
141
|
+
width: container.offsetWidth,
|
|
142
|
+
height: container.offsetHeight
|
|
143
|
+
};
|
|
144
|
+
this.camera = new THREE.OrthographicCamera(-state.width / 2, state.width / 2, state.height / 2, -state.height / 2);
|
|
145
|
+
this.camera.position.set(0, 0, 10);
|
|
146
|
+
this.camera.lookAt(0, 0, 0);
|
|
147
|
+
var domElement = this.renderer.domElement;
|
|
148
|
+
domElement.classList.add('ImgBgTransparent-canvas');
|
|
149
|
+
this.renderer.setSize(state.width * window.devicePixelRatio, state.height * window.devicePixelRatio);
|
|
150
|
+
domElement.setAttribute('style', "width: ".concat(state.width, "px;height: ").concat(state.height, "px;"));
|
|
151
|
+
this.mesh = new ImgBgTransparentMesh(imgUrl, state.width, state.height, 1, 1, // 图片下载延迟,下载成功后重新渲染一次
|
|
152
|
+
function () {
|
|
153
|
+
_this2.mesh.setHidden(false);
|
|
154
|
+
|
|
155
|
+
_this2.render();
|
|
156
|
+
});
|
|
157
|
+
container.append(domElement);
|
|
158
|
+
this.scene.add(this.mesh);
|
|
159
|
+
this.mesh.setHidden(false);
|
|
160
|
+
this.render();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
_createClass(ImgBgTransparentScene, [{
|
|
164
|
+
key: "render",
|
|
165
|
+
value: function render() {
|
|
166
|
+
this.renderer.render(this.scene, this.camera);
|
|
167
|
+
}
|
|
168
|
+
}]);
|
|
169
|
+
|
|
170
|
+
return ImgBgTransparentScene;
|
|
171
|
+
}();
|
|
172
|
+
|
|
173
|
+
exports.ImgBgTransparentScene = ImgBgTransparentScene;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.fragmentShaderTpl = void 0;
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
*
|
|
10
|
+
* @returns fragmentShader [GLSL](https://www.khronos.org/opengl/wiki/Core_Language_(GLSL)).
|
|
11
|
+
*/
|
|
12
|
+
var fragmentShaderTpl = function fragmentShaderTpl() {
|
|
13
|
+
return "\nuniform int enable;\nuniform float range;\nuniform float edge0;\nuniform float edge1;\n\nuniform sampler2D map;\nvarying vec2 vUv;\nvarying vec2 vColorUv;\nvarying vec2 vMaskUv;\n\nvec3 hsv2rgb(vec3 c) {\n const vec4 K = vec4(1.0, 2.0 / 3.0, 1.0 / 3.0, 3.0);\n vec3 p = abs(fract(c.xxx + K.xyz) * 6.0 - K.www);\n return c.z * mix(K.xxx, clamp(p - K.xxx, 0.0, 1.0), c.y);\n}\n\nvec3 rgb2hsv(vec3 c) {\n const vec4 K = vec4(0.0, -1.0 / 3.0, 2.0 / 3.0, -1.0);\n vec4 p = mix(vec4(c.bg, K.wz), vec4(c.gb, K.xy), step(c.b, c.g));\n vec4 q = mix(vec4(p.xyw, c.r), vec4(c.r, p.yzx), step(p.x, c.r));\n\n float d = q.x - min(q.w, q.y);\n return vec3(abs(q.z + (q.w - q.y) / (6.0 * d + 0.001)), d / (q.x + 0.001), q.x);\n}\n\nvoid main(void) {\n vec3 color = texture2D(map, vUv).xyz;\n float amask = 1.0;\n\n float ref = color.r;\n if (ref < color.b) ref = color.b;\n amask = color.g - ref + 0.1;\n amask = smoothstep(edge0, edge1, amask);\n amask = 1.0 - amask;\n\n vec3 target = rgb2hsv(vec3(0.0 / 255.0, 255.0 / 255.0, 0.0 / 255.0));\n vec3 hsv = rgb2hsv(color);\n float distance = abs(hsv.x - target.x);\n if (distance < range) {\n hsv.y = 0.0;\n }\n color = hsv2rgb(hsv);\n\n gl_FragColor = vec4(color.rgb, amask * float(enable));\n}\n";
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
exports.fragmentShaderTpl = fragmentShaderTpl;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { ARVideoFigureScene } from './ARVideoFigureScene';
|
|
3
|
+
export interface ARVideoFigurePropTypes {
|
|
4
|
+
className?: string;
|
|
5
|
+
arVideoFigureSceneRef?: (arVideoFigureScene: ARVideoFigureScene) => void;
|
|
6
|
+
__debug__?: boolean;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* **AR 视频形象**:剔除视频的绿幕背景,以实时视频的形式在 Web 页面模拟视频人物形象的效果。
|
|
11
|
+
* @param props
|
|
12
|
+
* @returns
|
|
13
|
+
*/
|
|
14
|
+
export declare function ARVideoFigure(props: ARVideoFigurePropTypes): JSX.Element;
|
|
15
|
+
export default ARVideoFigure;
|
|
@@ -0,0 +1,64 @@
|
|
|
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.ARVideoFigure = ARVideoFigure;
|
|
9
|
+
exports["default"] = void 0;
|
|
10
|
+
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
|
|
13
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
14
|
+
|
|
15
|
+
var _ARVideoFigureScene = require("./ARVideoFigureScene");
|
|
16
|
+
|
|
17
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
18
|
+
|
|
19
|
+
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); }
|
|
20
|
+
|
|
21
|
+
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; }
|
|
22
|
+
|
|
23
|
+
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; }
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* **AR 视频形象**:剔除视频的绿幕背景,以实时视频的形式在 Web 页面模拟视频人物形象的效果。
|
|
27
|
+
* @param props
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
function ARVideoFigure(props) {
|
|
31
|
+
var ref = React.useRef(null);
|
|
32
|
+
var sceneRef = React.useRef();
|
|
33
|
+
React.useEffect(function () {
|
|
34
|
+
if (!ref.current) return;
|
|
35
|
+
sceneRef.current = new _ARVideoFigureScene.ARVideoFigureScene(ref.current);
|
|
36
|
+
|
|
37
|
+
if (props.arVideoFigureSceneRef) {
|
|
38
|
+
props.arVideoFigureSceneRef(sceneRef.current);
|
|
39
|
+
}
|
|
40
|
+
}, []);
|
|
41
|
+
React.useEffect(function () {
|
|
42
|
+
if (!sceneRef.current) return;
|
|
43
|
+
Object.assign(window, {
|
|
44
|
+
$sceneRef: sceneRef.current
|
|
45
|
+
});
|
|
46
|
+
}, [props.__debug__]);
|
|
47
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
48
|
+
className: (0, _classnames["default"])('ARVideoFigure', _defineProperty({}, props.className + '', !!props.className)),
|
|
49
|
+
ref: ref // 渲染的宽度、高度由使用者控制:与父结点的宽高相同
|
|
50
|
+
,
|
|
51
|
+
style: {
|
|
52
|
+
width: '100%',
|
|
53
|
+
height: '100%'
|
|
54
|
+
},
|
|
55
|
+
onClick: function onClick() {
|
|
56
|
+
if (props.onClick) {
|
|
57
|
+
props.onClick();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
var _default = ARVideoFigure;
|
|
64
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const vertexShader = "\nvarying vec2 vUv;\nvarying vec2 vColorUv;\nvarying vec2 vMaskUv;\nvoid main(){\n vUv = uv;\n vColorUv = vec2(uv.x / 2.0, uv.y);\n vMaskUv = vec2(0.5 + uv.x / 2.0, uv.y);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.vertexShader = void 0;
|
|
7
|
+
var vertexShader = "\nvarying vec2 vUv;\nvarying vec2 vColorUv;\nvarying vec2 vMaskUv;\nvoid main(){\n vUv = uv;\n vColorUv = vec2(uv.x / 2.0, uv.y);\n vMaskUv = vec2(0.5 + uv.x / 2.0, uv.y);\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n}\n";
|
|
8
|
+
exports.vertexShader = vertexShader;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
export interface GlassFiltersPropTypes {
|
|
3
|
+
hidden?: boolean;
|
|
4
|
+
className?: string;
|
|
5
|
+
url?: string;
|
|
6
|
+
/**
|
|
7
|
+
* 高斯模糊
|
|
8
|
+
*/
|
|
9
|
+
blur?: string | number;
|
|
10
|
+
brightness?: string | number;
|
|
11
|
+
contrast?: string | number;
|
|
12
|
+
['drop-shadow']?: string | number;
|
|
13
|
+
grayscale?: string | number;
|
|
14
|
+
['hue-rotate']?: string | number;
|
|
15
|
+
invert?: string | number;
|
|
16
|
+
opacity?: string | number;
|
|
17
|
+
sepia?: string | number;
|
|
18
|
+
saturate?: string | number;
|
|
19
|
+
children?: string | JSX.Element;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 滤镜组件
|
|
23
|
+
*
|
|
24
|
+
* > 某些 VR 房源可能受限于拍摄条件,比如拍摄当天光线不佳造成观感整体偏暗,可通过此组件设置提升亮度等相关滤镜参数进行优化。
|
|
25
|
+
*
|
|
26
|
+
* 滤镜的可配置参数请参考 [backdrop-filter](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter)。
|
|
27
|
+
*
|
|
28
|
+
* @param props
|
|
29
|
+
* @returns
|
|
30
|
+
*/
|
|
31
|
+
export declare function GlassFilters(props: GlassFiltersPropTypes): JSX.Element;
|
|
32
|
+
export default GlassFilters;
|
|
@@ -0,0 +1,54 @@
|
|
|
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.GlassFilters = GlassFilters;
|
|
9
|
+
exports["default"] = void 0;
|
|
10
|
+
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
|
|
13
|
+
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); }
|
|
14
|
+
|
|
15
|
+
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; }
|
|
16
|
+
|
|
17
|
+
var filters = ['url', 'blur', 'brightness', 'contrast', 'drop-shadow', 'grayscale', 'hue-rotate', 'invert', 'opacity', 'sepia', 'saturate'];
|
|
18
|
+
/**
|
|
19
|
+
* 滤镜组件
|
|
20
|
+
*
|
|
21
|
+
* > 某些 VR 房源可能受限于拍摄条件,比如拍摄当天光线不佳造成观感整体偏暗,可通过此组件设置提升亮度等相关滤镜参数进行优化。
|
|
22
|
+
*
|
|
23
|
+
* 滤镜的可配置参数请参考 [backdrop-filter](https://developer.mozilla.org/en-US/docs/Web/CSS/backdrop-filter)。
|
|
24
|
+
*
|
|
25
|
+
* @param props
|
|
26
|
+
* @returns
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
function GlassFilters(props) {
|
|
30
|
+
var backdropFilter = Object.keys(props).filter(function (key) {
|
|
31
|
+
return filters.includes(key) && props[key] !== undefined;
|
|
32
|
+
}).reduce(function (accu, curr) {
|
|
33
|
+
return accu + "".concat(curr, "(").concat(props[curr], ") ");
|
|
34
|
+
}, '');
|
|
35
|
+
console.log('GlassFilters', props, backdropFilter);
|
|
36
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
37
|
+
style: {
|
|
38
|
+
position: 'absolute',
|
|
39
|
+
left: '0',
|
|
40
|
+
top: '0',
|
|
41
|
+
width: '100%',
|
|
42
|
+
height: '100%',
|
|
43
|
+
pointerEvents: 'none',
|
|
44
|
+
transition: 'backdrop-filter opacity .75s',
|
|
45
|
+
opacity: props.hidden ? '0' : '1',
|
|
46
|
+
backdropFilter: backdropFilter,
|
|
47
|
+
WebkitBackdropFilter: backdropFilter
|
|
48
|
+
},
|
|
49
|
+
className: 'five-GlassFilters' + (props.className ? ' ' + props.className : '')
|
|
50
|
+
}, props.children);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
var _default = GlassFilters;
|
|
54
|
+
exports["default"] = _default;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as THREE from 'three';
|
|
2
|
+
export default class ModelViewController {
|
|
3
|
+
needsRender: boolean;
|
|
4
|
+
scene: THREE.Scene;
|
|
5
|
+
camera: THREE.PerspectiveCamera;
|
|
6
|
+
model: THREE.Object3D;
|
|
7
|
+
renderer: THREE.WebGLRenderer | null;
|
|
8
|
+
constructor();
|
|
9
|
+
initRendererIfNeeds: () => THREE.WebGLRenderer;
|
|
10
|
+
modelWillLoad: () => void;
|
|
11
|
+
refresh: (size?: {
|
|
12
|
+
width?: number;
|
|
13
|
+
height?: number;
|
|
14
|
+
}) => void;
|
|
15
|
+
cameraDistance: () => void;
|
|
16
|
+
update: () => void;
|
|
17
|
+
render: () => void;
|
|
18
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
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"] = 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
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
17
|
+
|
|
18
|
+
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; }
|
|
19
|
+
|
|
20
|
+
var ModelViewController = function ModelViewController() {
|
|
21
|
+
var _this = this;
|
|
22
|
+
|
|
23
|
+
_classCallCheck(this, ModelViewController);
|
|
24
|
+
|
|
25
|
+
_defineProperty(this, "needsRender", true);
|
|
26
|
+
|
|
27
|
+
_defineProperty(this, "scene", new THREE.Scene());
|
|
28
|
+
|
|
29
|
+
_defineProperty(this, "camera", new THREE.PerspectiveCamera(60, 1, 0.1, 1000));
|
|
30
|
+
|
|
31
|
+
_defineProperty(this, "model", new THREE.Object3D());
|
|
32
|
+
|
|
33
|
+
_defineProperty(this, "renderer", null);
|
|
34
|
+
|
|
35
|
+
_defineProperty(this, "initRendererIfNeeds", function () {
|
|
36
|
+
if (!_this.renderer) {
|
|
37
|
+
_this.renderer = new THREE.WebGLRenderer({
|
|
38
|
+
antialias: false,
|
|
39
|
+
alpha: true
|
|
40
|
+
}); // this.renderer.setPixelRatio(five.renderer.getPixelRatio())
|
|
41
|
+
|
|
42
|
+
_this.renderer.setClearColor(0x181a1c, 0);
|
|
43
|
+
|
|
44
|
+
_this.renderer.autoClear = true;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return _this.renderer;
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
_defineProperty(this, "modelWillLoad", function () {
|
|
51
|
+
_this.model.traverse(function (object) {
|
|
52
|
+
if (object instanceof THREE.Mesh) {
|
|
53
|
+
var materials = [].concat(object.material);
|
|
54
|
+
materials.forEach(function (material) {
|
|
55
|
+
return material.dispose();
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
_this.scene.remove(_this.model);
|
|
61
|
+
|
|
62
|
+
_this.model = new THREE.Object3D();
|
|
63
|
+
|
|
64
|
+
_this.scene.add(_this.model);
|
|
65
|
+
|
|
66
|
+
_this.update();
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
_defineProperty(this, "refresh", function () {
|
|
70
|
+
var size = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
71
|
+
if (!_this.renderer) return;
|
|
72
|
+
var element = _this.renderer.domElement;
|
|
73
|
+
var container = element.parentNode;
|
|
74
|
+
|
|
75
|
+
if (container && container.nodeName) {
|
|
76
|
+
var _size$width = size.width,
|
|
77
|
+
width = _size$width === void 0 ? container.offsetWidth : _size$width,
|
|
78
|
+
_size$height = size.height,
|
|
79
|
+
height = _size$height === void 0 ? container.offsetHeight : _size$height;
|
|
80
|
+
|
|
81
|
+
_this.renderer.setSize(width, height); // 修改摄像机 aspect 比值
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
_this.camera.aspect = width / height;
|
|
85
|
+
|
|
86
|
+
_this.camera.updateProjectionMatrix();
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
_this.needsRender = true;
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
_defineProperty(this, "cameraDistance", function () {// const bounding = five.model.bounding
|
|
93
|
+
// const { fov, aspect } = this.camera
|
|
94
|
+
// const radius = Math.pow(
|
|
95
|
+
// Math.pow(bounding.max.x - bounding.min.x + 2, 2) +
|
|
96
|
+
// Math.pow(bounding.max.y - bounding.min.y + 2, 2) +
|
|
97
|
+
// Math.pow(bounding.max.z - bounding.min.z + 2, 2),
|
|
98
|
+
// 1 / 2,
|
|
99
|
+
// )
|
|
100
|
+
// // fit screen
|
|
101
|
+
// let distance = radius / 2 / Math.tan((Math.PI * fov) / 360)
|
|
102
|
+
// if (aspect < 1) distance = distance / aspect
|
|
103
|
+
// return isNaN(distance) ? radius : distance
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
_defineProperty(this, "update", function () {// const { longitude } = five.getLongitudeAndLatitude()
|
|
107
|
+
// const latitude = Math.PI / 4
|
|
108
|
+
// const distance = cameraDistance()
|
|
109
|
+
// const lookAt = five.model.bounding.getCenter(new THREE.Vector3())
|
|
110
|
+
// const longitudeDistance = distance * Math.cos(latitude)
|
|
111
|
+
// const cameraPosition = new THREE.Vector3()
|
|
112
|
+
// cameraPosition.x = Math.sin(longitude) * longitudeDistance + lookAt.x
|
|
113
|
+
// cameraPosition.z = Math.cos(longitude) * longitudeDistance + lookAt.z
|
|
114
|
+
// cameraPosition.y = Math.sin(latitude) * distance + lookAt.y
|
|
115
|
+
// camera.position.copy(cameraPosition)
|
|
116
|
+
// camera.lookAt(lookAt)
|
|
117
|
+
// needsRender = true
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
_defineProperty(this, "render", function () {// if (needsRender !== true) return
|
|
121
|
+
// if (!renderer) return
|
|
122
|
+
// if (!renderer.domElement.parentNode) return
|
|
123
|
+
// const parentNode = renderer.domElement.parentNode as HTMLElement
|
|
124
|
+
// if (parentNode.offsetWidth === 0) return
|
|
125
|
+
// renderer.render(scene, camera)
|
|
126
|
+
// needsRender = false
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
{
|
|
130
|
+
var light = new THREE.DirectionalLight(0xffffff, 0.1);
|
|
131
|
+
light.position.copy(new THREE.Vector3(1, 1, 1));
|
|
132
|
+
this.scene.add(light);
|
|
133
|
+
}
|
|
134
|
+
{
|
|
135
|
+
var _light = new THREE.DirectionalLight(0xffffff, 0.1);
|
|
136
|
+
|
|
137
|
+
this.scene.add(_light);
|
|
138
|
+
}
|
|
139
|
+
{
|
|
140
|
+
var _light2 = new THREE.AmbientLight(0xffffff, 1);
|
|
141
|
+
|
|
142
|
+
this.scene.add(_light2);
|
|
143
|
+
}
|
|
144
|
+
this.scene.add(this.model);
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
exports["default"] = ModelViewController;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = ModelView;
|
|
7
|
+
|
|
8
|
+
var _react = _interopRequireDefault(require("react"));
|
|
9
|
+
|
|
10
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* 户型雷达图
|
|
14
|
+
*
|
|
15
|
+
*
|
|
16
|
+
* 非 `React` 组件版本详见 [ModelViewPlugin](?path=/docs/plugins-modelviewplugin--model-view-tpl)。
|
|
17
|
+
* @returns
|
|
18
|
+
* @todo
|
|
19
|
+
*/
|
|
20
|
+
function ModelView() {
|
|
21
|
+
return /*#__PURE__*/_react["default"].createElement("div", null);
|
|
22
|
+
}
|