@realsee/five-webgpu 1.0.0-alpha.12 → 1.0.0-alpha.13
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/_virtual/_rolldown/runtime.js +2 -2
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/index.AdaptiveLuminancePass.html +1 -1
- package/docs/classes/index.EyeDomeLightingPass.html +1 -1
- package/docs/classes/index.Five.html +77 -69
- package/docs/classes/index.FivePass.html +1 -1
- package/docs/classes/index.FiveRenderer.html +7 -2
- package/docs/classes/index.FlowingFireworks3DPass.html +1 -1
- package/docs/classes/index.FlowingLight2DPass.html +1 -1
- package/docs/classes/index.FlowingLight3DPass.html +1 -1
- package/docs/classes/index.GaussianBlurPass.html +1 -1
- package/docs/classes/index.InternalWebGPURenderer.html +4 -5
- package/docs/classes/index.Model.html +1 -1
- package/docs/classes/index.ModelScene.html +1 -1
- package/docs/classes/index.PBMCustomNode.html +1 -1
- package/docs/classes/index.PBMGaussianSplattingNodeMaterial.html +9 -9
- package/docs/classes/index.PBMGaussianSplattingObject.html +49 -11
- package/docs/classes/index.PBMGaussianSplattingRenderMesh.html +71 -16
- package/docs/classes/index.PBMGroup.html +1 -1
- package/docs/classes/index.PBMMesh.html +1 -1
- package/docs/classes/index.PBMMeshBasicMaterial.html +1 -1
- package/docs/classes/index.PBMMeshBasicNodeMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPanoOnlyMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPanoOnlyNodeMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPhongMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPhongNodeMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPhysicalMaterial.html +1 -1
- package/docs/classes/index.PBMMeshPhysicalNodeMaterial.html +1 -1
- package/docs/classes/index.PBMPanoFilter.html +1 -1
- package/docs/classes/index.PBMPointCloud.html +1 -1
- package/docs/classes/index.PBMPointCloudMaterial.html +1 -1
- package/docs/classes/index.PBMSkinnedMesh.html +1 -1
- package/docs/classes/index.PBMUpdateable.html +1 -1
- package/docs/classes/index.Parameter.html +24 -22
- package/docs/classes/index.Tile3D.html +22 -22
- package/docs/classes/index.TileNode.html +2 -2
- package/docs/classes/index.TrajectoryNode.html +1 -1
- package/docs/classes/index.WorkResolvedObserver.html +1 -1
- package/docs/functions/index.loadPly.html +10 -1
- package/docs/hierarchy.html +1 -1
- package/docs/interfaces/index.DeviceProfile.html +2 -2
- package/docs/interfaces/index.EventCallback.html +1 -1
- package/docs/interfaces/index.IPBMMaterial.html +1 -1
- package/docs/interfaces/index.LooseWorkWithExtrinsics.html +1 -1
- package/docs/interfaces/index.ModelControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.PBMGaussianSplattingNodeMaterialOptions.html +3 -3
- package/docs/interfaces/index.PanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.PanoramaLikeControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ParameterMaterialValue.html +8 -6
- package/docs/interfaces/index.ParameterTilesetValue.html +15 -15
- package/docs/interfaces/index.ParameterValue.html +21 -19
- package/docs/interfaces/index.ResolvedParameterValue.html +22 -20
- package/docs/interfaces/index.SplatData.html +10 -6
- package/docs/interfaces/index.Tile3DOptions.html +2 -2
- package/docs/interfaces/index.TopviewControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.VRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/interfaces/index.ViewLayer.html +22 -22
- package/docs/interfaces/index.WorkCubeHdrGainmapImage.html +1 -1
- package/docs/interfaces/index.WorkCubeImage.html +1 -1
- package/docs/interfaces/index.WorkImage.html +1 -1
- package/docs/interfaces/index.WorkModelLayer.html +2 -2
- package/docs/interfaces/index.WorkObserver.html +1 -1
- package/docs/interfaces/index.WorkTile.html +1 -1
- package/docs/interfaces/index.XRPanoramaControllerCustomInitArgs.html +1 -1
- package/docs/types/index.ParseOptions.html +1 -1
- package/five/application/five.d.ts +12 -0
- package/five/controllers/xrPanorama.d.ts +13 -0
- package/five/core/internalWebGPURenderer.d.ts +0 -3
- package/five/core/panoVideo.d.ts +2 -0
- package/five/gaussian-splatting/arena/splatArena.d.ts +227 -0
- package/five/gaussian-splatting/cullConstants.d.ts +68 -0
- package/five/gaussian-splatting/hybridConstants.d.ts +60 -0
- package/five/gaussian-splatting/instancePacking.d.ts +46 -0
- package/five/gaussian-splatting/mirrors/layoutMirror.d.ts +44 -0
- package/five/gaussian-splatting/mirrors/mirrorBuffer.d.ts +72 -0
- package/five/gaussian-splatting/mirrors/mirrorSet.d.ts +17 -0
- package/five/gaussian-splatting/mirrors/objectParamsMirror.d.ts +35 -0
- package/five/gaussian-splatting/mirrors/transformMirror.d.ts +26 -0
- package/five/gaussian-splatting/pipelines/gpuSortPipeline.d.ts +5 -31
- package/five/gaussian-splatting/pipelines/pipelineMode.d.ts +1 -2
- package/five/gaussian-splatting/sh-core/codec.d.ts +13 -0
- package/five/gaussian-splatting/sh-core/constants.d.ts +29 -0
- package/five/gaussian-splatting/sh-core/index.d.ts +4 -0
- package/five/gaussian-splatting/sh-core/rebakePolicy.d.ts +20 -0
- package/five/gaussian-splatting/sh-core/texelRange.d.ts +18 -0
- package/five/gaussian-splatting/shAssembler.d.ts +14 -0
- package/five/gaussian-splatting/shBakeScheduler.d.ts +26 -0
- package/five/gaussian-splatting/shBaker.d.ts +44 -0
- package/five/gaussian-splatting/shTileResource.d.ts +22 -0
- package/five/gaussian-splatting/splatAssembler.d.ts +1 -1
- package/five/gaussian-splatting/transformStore.d.ts +2 -2
- package/five/gaussian-splatting/worker/decodeWorker.d.ts +72 -0
- package/five/index.js +172 -97
- package/five/index.mjs +11754 -8963
- package/five/model/loaders/ply.d.ts +22 -6
- package/five/model/loaders/spz.d.ts +9 -48
- package/five/model/materials/pbmGaussianSplattingNodeMaterial.d.ts +6 -12
- package/five/model/objects/pbmGaussianSplattingObject.d.ts +91 -6
- package/five/model/objects/pbmGaussianSplattingRenderMesh.d.ts +357 -15
- package/five/model/parameter.d.ts +4 -0
- package/five/renderer/compute-renderers/binned/binned-core.d.ts +45 -2
- package/five/renderer/compute-renderers/binned/binned-pipelines.d.ts +82 -1
- package/five/renderer/compute-renderers/color-space.d.ts +13 -0
- package/five/renderer/compute-renderers/composite-pipelines.d.ts +36 -0
- package/five/renderer/compute-renderers/frame-plan.d.ts +166 -0
- package/five/renderer/compute-renderers/gsplat-hybrid-renderer.d.ts +386 -0
- package/five/renderer/compute-renderers/pointcloud-compute-renderer.d.ts +101 -16
- package/five/renderer/compute-renderers/shaders/composite-additive.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/composite-blend.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/gsplatHybridIndirect.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/gsplatProjector.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/gsplatQuad.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/write-additive.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/write-blend.d.ts +2 -0
- package/five/renderer/compute-renderers/shaders/lib/write-opaque.d.ts +2 -0
- package/five/renderer/compute-renderers/tile-uniform-writer.d.ts +70 -0
- package/five/renderer/compute-renderers/transparency-buffers.d.ts +59 -0
- package/five/renderer/compute-renderers/transparency-math.d.ts +70 -0
- package/five/renderer/compute-renderers/transparency-settings.d.ts +24 -0
- package/five/renderer/compute-renderers/uniform-layout.d.ts +11 -2
- package/five/renderer/five-renderer.d.ts +28 -3
- package/five/renderer/postprocessing/passes/pass.js +2 -2
- package/five/renderer/postprocessing/passes/pass.mjs +2 -2
- package/five/renderer/tools/full-screen-quad.js +2 -2
- package/five/renderer/tools/full-screen-quad.mjs +2 -2
- package/five/texture/videoTextureBridge.d.ts +43 -0
- package/five/utils/calculateThreeMouse.js +2 -2
- package/five/utils/calculateThreeMouse.mjs +2 -2
- package/five/utils/distance.js +2 -2
- package/five/utils/distance.mjs +2 -2
- package/five/utils/isNil.js +2 -2
- package/five/utils/isNil.mjs +2 -2
- package/five/utils/uuid.js +2 -2
- package/five/utils/uuid.mjs +2 -2
- package/gltf-loader/index.js +3 -3
- package/gltf-loader/index.mjs +3 -3
- package/line/index.js +3 -3
- package/line/index.mjs +3 -3
- package/package.json +1 -1
- package/plugins/BackgroundPlugin/Controller.js +2 -2
- package/plugins/BackgroundPlugin/Controller.mjs +2 -2
- package/plugins/BackgroundPlugin/index.js +2 -2
- package/plugins/BackgroundPlugin/index.mjs +2 -2
- package/plugins/BasePlugin/index.js +2 -2
- package/plugins/BasePlugin/index.mjs +2 -2
- package/plugins/CSS2DPlugin/Controller.js +2 -2
- package/plugins/CSS2DPlugin/Controller.mjs +2 -2
- package/plugins/CSS2DPlugin/index.js +2 -2
- package/plugins/CSS2DPlugin/index.mjs +2 -2
- package/plugins/CSS2DPlugin/style.css_raw.js +2 -2
- package/plugins/CSS2DPlugin/style.css_raw.mjs +2 -2
- package/plugins/CSS3DPlugin/Controller.js +2 -2
- package/plugins/CSS3DPlugin/Controller.mjs +2 -2
- package/plugins/CSS3DPlugin/index.js +2 -2
- package/plugins/CSS3DPlugin/index.mjs +2 -2
- package/plugins/CSS3DPlugin/style.css_raw.js +2 -2
- package/plugins/CSS3DPlugin/style.css_raw.mjs +2 -2
- package/plugins/FloorplanPlugin/Controller.js +2 -2
- package/plugins/FloorplanPlugin/Controller.mjs +2 -2
- package/plugins/FloorplanPlugin/index.js +2 -2
- package/plugins/FloorplanPlugin/index.mjs +2 -2
- package/plugins/FloorplanPlugin/render/assets.js +2 -2
- package/plugins/FloorplanPlugin/render/assets.mjs +2 -2
- package/plugins/FloorplanPlugin/render/index.js +2 -2
- package/plugins/FloorplanPlugin/render/index.mjs +2 -2
- package/plugins/FloorplanPlugin/render/isPointInPolygon.js +2 -2
- package/plugins/FloorplanPlugin/render/isPointInPolygon.mjs +2 -2
- package/plugins/FloorplanPlugin/render/renderFloor.js +2 -2
- package/plugins/FloorplanPlugin/render/renderFloor.mjs +2 -2
- package/plugins/FloorplanPlugin/render/roomLabelVisibility.js +2 -2
- package/plugins/FloorplanPlugin/render/roomLabelVisibility.mjs +2 -2
- package/plugins/FloorplanPlugin/render/style.css_raw.js +2 -2
- package/plugins/FloorplanPlugin/render/style.css_raw.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/changeMode.js +2 -2
- package/plugins/FloorplanPlugin/utils/changeMode.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.js +2 -2
- package/plugins/FloorplanPlugin/utils/changeModelCanvasOpacity.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/correctFiveState.js +2 -2
- package/plugins/FloorplanPlugin/utils/correctFiveState.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/equal.js +2 -2
- package/plugins/FloorplanPlugin/utils/equal.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/filter.js +2 -2
- package/plugins/FloorplanPlugin/utils/filter.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/fiveModelLoad.js +2 -2
- package/plugins/FloorplanPlugin/utils/fiveModelLoad.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/formatData.js +2 -2
- package/plugins/FloorplanPlugin/utils/formatData.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/formatFloorplanJson.js +2 -2
- package/plugins/FloorplanPlugin/utils/formatFloorplanJson.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/formatPosition.js +2 -2
- package/plugins/FloorplanPlugin/utils/formatPosition.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/getDistanceFromModel.js +2 -2
- package/plugins/FloorplanPlugin/utils/getDistanceFromModel.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/getPxmm.js +2 -2
- package/plugins/FloorplanPlugin/utils/getPxmm.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/isTruelyObject.js +2 -2
- package/plugins/FloorplanPlugin/utils/isTruelyObject.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/nearlyEqual.js +2 -2
- package/plugins/FloorplanPlugin/utils/nearlyEqual.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/polylabel.js +2 -2
- package/plugins/FloorplanPlugin/utils/polylabel.mjs +2 -2
- package/plugins/FloorplanPlugin/utils/to.js +2 -2
- package/plugins/FloorplanPlugin/utils/to.mjs +2 -2
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.d.ts +6 -0
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.js +3 -3
- package/plugins/GaussianSplattingEntranceAnimationPlugin/Controller.mjs +3 -3
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.js +2 -2
- package/plugins/GaussianSplattingEntranceAnimationPlugin/index.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Controller.js +2 -2
- package/plugins/Object3DHelperPlugin/Controller.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/BaseController.js +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/BaseController.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.js +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/BoundingBoxController.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/MoveController.js +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/MoveController.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/RotateController.js +2 -2
- package/plugins/Object3DHelperPlugin/Controllers/RotateController.mjs +2 -2
- package/plugins/Object3DHelperPlugin/FiveControllerWrapper.js +2 -2
- package/plugins/Object3DHelperPlugin/FiveControllerWrapper.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Helper/BaseHelper.js +2 -2
- package/plugins/Object3DHelperPlugin/Helper/BaseHelper.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.js +2 -2
- package/plugins/Object3DHelperPlugin/Helper/BoundingBoxHelper.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Helper/MoveHelper.js +2 -2
- package/plugins/Object3DHelperPlugin/Helper/MoveHelper.mjs +2 -2
- package/plugins/Object3DHelperPlugin/Helper/RotateHelper.js +2 -2
- package/plugins/Object3DHelperPlugin/Helper/RotateHelper.mjs +2 -2
- package/plugins/Object3DHelperPlugin/constant.js +2 -2
- package/plugins/Object3DHelperPlugin/constant.mjs +2 -2
- package/plugins/Object3DHelperPlugin/index.js +2 -2
- package/plugins/Object3DHelperPlugin/index.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/ArrowGroup.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/ArrowGroup.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/CenterHandle.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/CenterHandle.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/PlaneHandle.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/PlaneHandle.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/calculateScaleByCamera.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/cameraHooks.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/cameraHooks.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/direction.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/direction.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/getMouseRaycaster.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/getOrthographicCameraDirection.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/setObjectQuaternion.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/solidGuide.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/solidGuide.mjs +2 -2
- package/plugins/Object3DHelperPlugin/utils/tipsDom.js +2 -2
- package/plugins/Object3DHelperPlugin/utils/tipsDom.mjs +2 -2
- package/plugins/PanoAnimePlugin/Controller.js +2 -2
- package/plugins/PanoAnimePlugin/Controller.mjs +2 -2
- package/plugins/PanoAnimePlugin/index.js +2 -2
- package/plugins/PanoAnimePlugin/index.mjs +2 -2
- package/plugins/WordPassPlugin/Controller.js +2 -2
- package/plugins/WordPassPlugin/Controller.mjs +2 -2
- package/plugins/WordPassPlugin/hersheyFont.js +2 -2
- package/plugins/WordPassPlugin/hersheyFont.mjs +2 -2
- package/plugins/WordPassPlugin/index.js +2 -2
- package/plugins/WordPassPlugin/index.mjs +2 -2
- package/plugins/WordPassPlugin/textToStrokeOrderStrokes.js +2 -2
- package/plugins/WordPassPlugin/textToStrokeOrderStrokes.mjs +2 -2
- package/plugins/WordPassPlugin/word-pass.js +2 -2
- package/plugins/WordPassPlugin/word-pass.mjs +2 -2
- package/plugins/index.js +2 -2
- package/plugins/index.mjs +2 -2
- package/plugins/thirdParty/CSS2DRenderer.js +2 -2
- package/plugins/thirdParty/CSS2DRenderer.mjs +2 -2
- package/plugins/thirdParty/CSS3DRenderer.js +2 -2
- package/plugins/thirdParty/CSS3DRenderer.mjs +2 -2
- package/plugins/thirdParty/doctorstrange-model.js +2 -2
- package/plugins/thirdParty/doctorstrange-model.mjs +2 -2
- package/plugins/thirdParty/domevents.js +2 -2
- package/plugins/thirdParty/domevents.mjs +2 -2
- package/plugins/utils/absoluteUrl.js +2 -2
- package/plugins/utils/absoluteUrl.mjs +2 -2
- package/plugins/utils/calculatePath.js +2 -2
- package/plugins/utils/calculatePath.mjs +2 -2
- package/plugins/utils/clamp.js +2 -2
- package/plugins/utils/clamp.mjs +2 -2
- package/plugins/utils/uuid.js +2 -2
- package/plugins/utils/uuid.mjs +2 -2
- package/react/index.js +2 -2
- package/react/index.mjs +2 -2
- package/sticker/index.d.ts +7 -0
- package/sticker/index.js +37 -3
- package/sticker/index.mjs +175 -18
- package/umd/five-gltf-loader.js +3 -3
- package/umd/five-line.js +3 -3
- package/umd/five-plugins.js +3 -3
- package/umd/five-react.js +2 -2
- package/umd/five-sticker.js +37 -3
- package/umd/five-vfx.js +2 -2
- package/umd/five.js +203 -128
- package/vfx/index.js +2 -2
- package/vfx/index.mjs +2 -2
- package/work-downloader/index.js +2 -2
- package/work-downloader/index.mjs +2 -2
- package/five/gaussian-splatting/shStore.d.ts +0 -22
package/plugins/utils/clamp.js
CHANGED
package/plugins/utils/clamp.mjs
CHANGED
package/plugins/utils/uuid.js
CHANGED
package/plugins/utils/uuid.mjs
CHANGED
package/react/index.js
CHANGED
package/react/index.mjs
CHANGED
package/sticker/index.d.ts
CHANGED
|
@@ -18,6 +18,13 @@ interface IntersectionLike {
|
|
|
18
18
|
declare class Sticker extends THREE.Mesh<THREE.BufferGeometry, THREE.MeshBasicMaterial> {
|
|
19
19
|
static get version(): string;
|
|
20
20
|
private _needsRender;
|
|
21
|
+
/**
|
|
22
|
+
* 资源对应的原始纹理。
|
|
23
|
+
* @description
|
|
24
|
+
* 视频资源在 WebGPU 下 `material.map` 会被换成 GPU 中转纹理,`needsUpdate` 与 `dispose`
|
|
25
|
+
* 必须作用在原始纹理上(中转纹理不能 needsUpdate,否则 three 会重复初始化)。
|
|
26
|
+
*/
|
|
27
|
+
private _sourceTexture;
|
|
21
28
|
/**
|
|
22
29
|
* 贴纸
|
|
23
30
|
* @description
|
package/sticker/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five-webgpu
|
|
4
|
-
* Generated: 2026/10/
|
|
5
|
-
* Version: 1.0.0-alpha.
|
|
4
|
+
* Generated: 2026/10/30
|
|
5
|
+
* Version: 1.0.0-alpha.13
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -335,4 +335,38 @@
|
|
|
335
335
|
* writing and signed by Realsee. You and Realsee hereto confirm that this
|
|
336
336
|
* Agreement and all related documents shall be drafted in English.
|
|
337
337
|
|
|
338
|
-
*/Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("three/webgpu");c=s(c,1);var l=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),u=new Float32Array([0,0,1,0,0,1,1,1]),d=new Uint8Array([0,1,2,1,3,2]),f=new c.BufferGeometry;f.setAttribute(`position`,new c.BufferAttribute(l,3)),f.setAttribute(`uv`,new c.BufferAttribute(u,2)),f.setIndex(new c.BufferAttribute(d,1));var p
|
|
338
|
+
*/Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require("three/webgpu");c=s(c,1);var l=new Float32Array([-.5,-.5,0,.5,-.5,0,-.5,.5,0,.5,.5,0]),u=new Float32Array([0,0,1,0,0,1,1,1]),d=new Uint8Array([0,1,2,1,3,2]),f=new c.BufferGeometry;f.setAttribute(`position`,new c.BufferAttribute(l,3)),f.setAttribute(`uv`,new c.BufferAttribute(u,2)),f.setIndex(new c.BufferAttribute(d,1));var p=`rgba8unorm-srgb`,m=`
|
|
339
|
+
struct VSOut {
|
|
340
|
+
@builtin(position) position: vec4f,
|
|
341
|
+
@location(0) uv: vec2f,
|
|
342
|
+
};
|
|
343
|
+
|
|
344
|
+
@vertex
|
|
345
|
+
fn vs(@builtin(vertex_index) index: u32) -> VSOut {
|
|
346
|
+
// 全屏三角形:p ∈ {(0,0), (2,0), (0,2)}
|
|
347
|
+
let p = vec2f(f32((index << 1u) & 2u), f32(index & 2u));
|
|
348
|
+
var out: VSOut;
|
|
349
|
+
out.position = vec4f(p * 2.0 - 1.0, 0.0, 1.0);
|
|
350
|
+
// NDC y = +1 对应纹理第 0 行。three 的约定是 uv.v = 0 为图像底部、且存放在第 0 行,
|
|
351
|
+
// 而 external texture 的 uv (0,0) 是视频左上角,所以第 0 行要采视频的 v = 1,即 uv = p。
|
|
352
|
+
out.uv = p;
|
|
353
|
+
return out;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
@group(0) @binding(0) var source: texture_external;
|
|
357
|
+
@group(0) @binding(1) var sourceSampler: sampler;
|
|
358
|
+
|
|
359
|
+
fn srgbToLinear(c: vec3f) -> vec3f {
|
|
360
|
+
let low = c / 12.92;
|
|
361
|
+
let high = pow((c + 0.055) / 1.055, vec3f(2.4));
|
|
362
|
+
return select(high, low, c <= vec3f(0.04045));
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
@fragment
|
|
366
|
+
fn fs(in: VSOut) -> @location(0) vec4f {
|
|
367
|
+
// external texture 采样结果是 sRGB 编码值;目标是 -srgb 格式,写入时会再编码一次,
|
|
368
|
+
// 所以这里先解码为线性。
|
|
369
|
+
let color = textureSampleBaseClampToEdge(source, sourceSampler, in.uv);
|
|
370
|
+
return vec4f(srgbToLinear(color.rgb), 1.0);
|
|
371
|
+
}
|
|
372
|
+
`,h=new WeakMap;function g(e){let t=h.get(e);if(!t){let n=e.createShaderModule({label:`five.videoBlit`,code:m});t={pipeline:e.createRenderPipeline({label:`five.videoBlit`,layout:`auto`,vertex:{module:n,entryPoint:`vs`},fragment:{module:n,entryPoint:`fs`,targets:[{format:p}]},primitive:{topology:`triangle-list`}}),sampler:e.createSampler({magFilter:`linear`,minFilter:`linear`})},h.set(e,t)}return t}var _=null;function v(){return _||(_=new c.DataTexture(new Uint8Array([0,0,0,255]),1,1,c.RGBAFormat),_.colorSpace=c.SRGBColorSpace,_.magFilter=c.LinearFilter,_.minFilter=c.LinearFilter,_.needsUpdate=!0),_}var y=class{constructor(e){this.device=null,this.useBlit=null,this.broken=!1,this.gpuTexture=null,this.externalTexture=null,this.width=0,this.height=0,this.frameDirty=!0,this.lastVideoTime=-1,this.videoFrameCallbackId=null,this.disposed=!1,this.videoTexture=e,this.scheduleVideoFrameCallback()}get video(){return this.videoTexture.image}scheduleVideoFrameCallback(){let e=this.video;this.disposed||typeof(e==null?void 0:e.requestVideoFrameCallback)!=`function`||(this.videoFrameCallbackId=e.requestVideoFrameCallback(()=>{this.videoFrameCallbackId=null,this.frameDirty=!0,this.scheduleVideoFrameCallback()}))}get texture(){var e;return this.broken||this.useBlit!==!0?this.videoTexture:(e=this.externalTexture)==null?v():e}update(e){if(this.disposed||this.broken)return;if(this.useBlit===null){let t=e==null?void 0:e.backend;if(!t)return;if(t.isWebGPUBackend!==!0){this.useBlit=!1;return}if(!t.device)return;this.device=t.device,this.useBlit=!0}if(!this.useBlit||!this.device)return;let t=this.video;if(t instanceof HTMLVideoElement&&!(t.readyState<2||t.videoWidth===0||t.videoHeight===0)&&!(this.externalTexture&&!this.frameDirty&&t.currentTime===this.lastVideoTime))try{this.ensureTarget(t.videoWidth,t.videoHeight),this.blit(t),this.frameDirty=!1,this.lastVideoTime=t.currentTime}catch(e){console.warn(`[Five] 视频纹理 GPU 中转失败,回退为 VideoTexture 上传`,e),this.broken=!0,this.releaseTarget()}}ensureTarget(e,t){let n=this.device,r=n.limits.maxTextureDimension2D,i=Math.min(1,r/Math.max(e,t)),a=Math.max(1,Math.floor(e*i)),o=Math.max(1,Math.floor(t*i));if(this.gpuTexture&&this.width===a&&this.height===o)return;let s=this.gpuTexture,l=n.createTexture({label:`five.videoBlit.target`,size:{width:a,height:o},format:p,usage:GPUTextureUsage.TEXTURE_BINDING|GPUTextureUsage.RENDER_ATTACHMENT});if(this.gpuTexture=l,this.width=a,this.height=o,this.externalTexture)this.externalTexture.sourceTexture=l,this.externalTexture.image={width:a,height:o},this.externalTexture.dispose();else{let e=new c.ExternalTexture(l);e.colorSpace=c.SRGBColorSpace,e.flipY=!1,e.generateMipmaps=!1,e.minFilter=c.LinearFilter,e.magFilter=c.LinearFilter,e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.image={width:a,height:o},this.externalTexture=e}s==null||s.destroy()}blit(e){let t=this.device,{pipeline:n,sampler:r}=g(t),i=t.importExternalTexture({source:e}),a=t.createBindGroup({layout:n.getBindGroupLayout(0),entries:[{binding:0,resource:i},{binding:1,resource:r}]}),o=t.createCommandEncoder({label:`five.videoBlit`}),s=o.beginRenderPass({colorAttachments:[{view:this.gpuTexture.createView(),loadOp:`clear`,storeOp:`store`,clearValue:{r:0,g:0,b:0,a:1}}]});s.setPipeline(n),s.setBindGroup(0,a),s.draw(3),s.end(),t.queue.submit([o.finish()])}releaseTarget(){var e,t;(e=this.externalTexture)==null||e.dispose(),this.externalTexture=null,(t=this.gpuTexture)==null||t.destroy(),this.gpuTexture=null,this.width=this.height=0}dispose(){if(this.disposed)return;this.disposed=!0;let e=this.video;this.videoFrameCallbackId!==null&&typeof(e==null?void 0:e.cancelVideoFrameCallback)==`function`&&e.cancelVideoFrameCallback(this.videoFrameCallbackId),this.videoFrameCallbackId=null,this.releaseTarget()}},b=new WeakMap;function x(e){let t=b.get(e);if(!t){let n=new y(e);t=n,b.set(e,n);let r=()=>{e.removeEventListener(`dispose`,r),b.get(e)===n&&b.delete(e),n.dispose()};e.addEventListener(`dispose`,r)}return t}var S=window,C=S.requestAnimationFrame||S.mozRequestAnimationFrame||S.webkitRequestAnimationFrame||S.msRequestAnimationFrame||(e=>setTimeout(e,16)),w=typeof performance<`u`&&performance.timing!==void 0?performance.timing.navigationStart:Date.now(),T=typeof performance<`u`?(()=>w+performance.now()):(()=>Date.now());function E(e,t){e.naturalWidth>0&&C(()=>t());let n=()=>t();return e.addEventListener(`load`,n,!1),()=>e.removeEventListener(`load`,n,!1)}function D(e,t){let n=T(),r=!1,i=()=>{r=!0,t(),T()-n<3e3?C(i):r=!1},a=()=>{n=T(),r===!1&&i()};return e.addEventListener(`timeupdate`,a,!1),()=>{e.removeEventListener(`timeupdate`,a,!1),r=!1}}function O(e,t){let n=e.dispose;e.dispose=()=>{t(),n.call(e)}}var k=class extends c.Mesh{static get version(){return`1.0.0-alpha.13`}constructor(e,t,n){let r=new c.MeshBasicMaterial;if(super(f,r),this._sourceTexture=null,this._needsRender=!1,this.scale.set(e,t,1),typeof n==`string`){r.transparent=/\.png$/.test(n);let e=new Image;e.src=n,e.crossOrigin=``,n=e}if(n instanceof HTMLImageElement){let e=r.map=new c.Texture;e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.colorSpace=c.SRGBColorSpace,O(e,E(n,()=>{e.image=n,e.needsUpdate=!0,this._needsRender=!0}))}else if(n instanceof HTMLCanvasElement)r.map=new c.CanvasTexture(n);else if(n instanceof HTMLVideoElement){let e=r.map=new c.VideoTexture(n);e.wrapS=c.ClampToEdgeWrapping,e.wrapT=c.ClampToEdgeWrapping,e.minFilter=c.LinearFilter,e.colorSpace=c.SRGBColorSpace,O(e,D(n,()=>{this._needsRender=!0}));let t=x(e);this.onBeforeRender=e=>{t.update(e);let n=t.texture;r.map!==n&&(r.map=n)}}this._sourceTexture=r.map}get needsRender(){return this._needsRender}set needsRender(e){this._needsRender=e,e===!0&&this._sourceTexture&&(this._sourceTexture.needsUpdate=!0)}setSize(e,t){this.scale.set(e,t,1),this._needsRender=!0}setTransparent(e){this.material.transparent=e,this._needsRender=!0}locationWithIntersection(e,t=.005){let{point:n,face:r}=e;this.position.copy(n),r&&(this.position.add(r.normal.clone().setLength(t)),this.lookAt(n.clone().add(r.normal))),this._needsRender=!0}dispose(){var e;(e=this._sourceTexture)==null||e.dispose(),this.material.dispose()}};exports.Sticker=k;
|
package/sticker/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @license
|
|
3
3
|
* @realsee/five-webgpu
|
|
4
|
-
* Generated: 2026/10/
|
|
5
|
-
* Version: 1.0.0-alpha.
|
|
4
|
+
* Generated: 2026/10/30
|
|
5
|
+
* Version: 1.0.0-alpha.13
|
|
6
6
|
* License:
|
|
7
7
|
* Realsee SDK License Agreement
|
|
8
8
|
|
|
@@ -369,58 +369,215 @@ var t = new Float32Array([
|
|
|
369
369
|
]), i = new e.BufferGeometry();
|
|
370
370
|
i.setAttribute("position", new e.BufferAttribute(t, 3)), i.setAttribute("uv", new e.BufferAttribute(n, 2)), i.setIndex(new e.BufferAttribute(r, 1));
|
|
371
371
|
//#endregion
|
|
372
|
+
//#region build/five/texture/videoTextureBridge.js
|
|
373
|
+
var a = "rgba8unorm-srgb", o = "\nstruct VSOut {\n @builtin(position) position: vec4f,\n @location(0) uv: vec2f,\n};\n\n@vertex\nfn vs(@builtin(vertex_index) index: u32) -> VSOut {\n // 全屏三角形:p ∈ {(0,0), (2,0), (0,2)}\n let p = vec2f(f32((index << 1u) & 2u), f32(index & 2u));\n var out: VSOut;\n out.position = vec4f(p * 2.0 - 1.0, 0.0, 1.0);\n // NDC y = +1 对应纹理第 0 行。three 的约定是 uv.v = 0 为图像底部、且存放在第 0 行,\n // 而 external texture 的 uv (0,0) 是视频左上角,所以第 0 行要采视频的 v = 1,即 uv = p。\n out.uv = p;\n return out;\n}\n\n@group(0) @binding(0) var source: texture_external;\n@group(0) @binding(1) var sourceSampler: sampler;\n\nfn srgbToLinear(c: vec3f) -> vec3f {\n let low = c / 12.92;\n let high = pow((c + 0.055) / 1.055, vec3f(2.4));\n return select(high, low, c <= vec3f(0.04045));\n}\n\n@fragment\nfn fs(in: VSOut) -> @location(0) vec4f {\n // external texture 采样结果是 sRGB 编码值;目标是 -srgb 格式,写入时会再编码一次,\n // 所以这里先解码为线性。\n let color = textureSampleBaseClampToEdge(source, sourceSampler, in.uv);\n return vec4f(srgbToLinear(color.rgb), 1.0);\n}\n", s = /* @__PURE__ */ new WeakMap();
|
|
374
|
+
function c(e) {
|
|
375
|
+
let t = s.get(e);
|
|
376
|
+
if (!t) {
|
|
377
|
+
let n = e.createShaderModule({
|
|
378
|
+
label: "five.videoBlit",
|
|
379
|
+
code: o
|
|
380
|
+
});
|
|
381
|
+
t = {
|
|
382
|
+
pipeline: e.createRenderPipeline({
|
|
383
|
+
label: "five.videoBlit",
|
|
384
|
+
layout: "auto",
|
|
385
|
+
vertex: {
|
|
386
|
+
module: n,
|
|
387
|
+
entryPoint: "vs"
|
|
388
|
+
},
|
|
389
|
+
fragment: {
|
|
390
|
+
module: n,
|
|
391
|
+
entryPoint: "fs",
|
|
392
|
+
targets: [{ format: a }]
|
|
393
|
+
},
|
|
394
|
+
primitive: { topology: "triangle-list" }
|
|
395
|
+
}),
|
|
396
|
+
sampler: e.createSampler({
|
|
397
|
+
magFilter: "linear",
|
|
398
|
+
minFilter: "linear"
|
|
399
|
+
})
|
|
400
|
+
}, s.set(e, t);
|
|
401
|
+
}
|
|
402
|
+
return t;
|
|
403
|
+
}
|
|
404
|
+
var l = null;
|
|
405
|
+
function u() {
|
|
406
|
+
return l || (l = new e.DataTexture(new Uint8Array([
|
|
407
|
+
0,
|
|
408
|
+
0,
|
|
409
|
+
0,
|
|
410
|
+
255
|
|
411
|
+
]), 1, 1, e.RGBAFormat), l.colorSpace = e.SRGBColorSpace, l.magFilter = e.LinearFilter, l.minFilter = e.LinearFilter, l.needsUpdate = !0), l;
|
|
412
|
+
}
|
|
413
|
+
var d = class {
|
|
414
|
+
constructor(e) {
|
|
415
|
+
this.device = null, this.useBlit = null, this.broken = !1, this.gpuTexture = null, this.externalTexture = null, this.width = 0, this.height = 0, this.frameDirty = !0, this.lastVideoTime = -1, this.videoFrameCallbackId = null, this.disposed = !1, this.videoTexture = e, this.scheduleVideoFrameCallback();
|
|
416
|
+
}
|
|
417
|
+
get video() {
|
|
418
|
+
return this.videoTexture.image;
|
|
419
|
+
}
|
|
420
|
+
scheduleVideoFrameCallback() {
|
|
421
|
+
let e = this.video;
|
|
422
|
+
this.disposed || typeof (e == null ? void 0 : e.requestVideoFrameCallback) != "function" || (this.videoFrameCallbackId = e.requestVideoFrameCallback(() => {
|
|
423
|
+
this.videoFrameCallbackId = null, this.frameDirty = !0, this.scheduleVideoFrameCallback();
|
|
424
|
+
}));
|
|
425
|
+
}
|
|
426
|
+
get texture() {
|
|
427
|
+
var e;
|
|
428
|
+
return this.broken || this.useBlit !== !0 ? this.videoTexture : (e = this.externalTexture) == null ? u() : e;
|
|
429
|
+
}
|
|
430
|
+
update(e) {
|
|
431
|
+
if (this.disposed || this.broken) return;
|
|
432
|
+
if (this.useBlit === null) {
|
|
433
|
+
let t = e == null ? void 0 : e.backend;
|
|
434
|
+
if (!t) return;
|
|
435
|
+
if (t.isWebGPUBackend !== !0) {
|
|
436
|
+
this.useBlit = !1;
|
|
437
|
+
return;
|
|
438
|
+
}
|
|
439
|
+
if (!t.device) return;
|
|
440
|
+
this.device = t.device, this.useBlit = !0;
|
|
441
|
+
}
|
|
442
|
+
if (!this.useBlit || !this.device) return;
|
|
443
|
+
let t = this.video;
|
|
444
|
+
if (t instanceof HTMLVideoElement && !(t.readyState < 2 || t.videoWidth === 0 || t.videoHeight === 0) && !(this.externalTexture && !this.frameDirty && t.currentTime === this.lastVideoTime)) try {
|
|
445
|
+
this.ensureTarget(t.videoWidth, t.videoHeight), this.blit(t), this.frameDirty = !1, this.lastVideoTime = t.currentTime;
|
|
446
|
+
} catch (e) {
|
|
447
|
+
console.warn("[Five] 视频纹理 GPU 中转失败,回退为 VideoTexture 上传", e), this.broken = !0, this.releaseTarget();
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
ensureTarget(t, n) {
|
|
451
|
+
let r = this.device, i = r.limits.maxTextureDimension2D, o = Math.min(1, i / Math.max(t, n)), s = Math.max(1, Math.floor(t * o)), c = Math.max(1, Math.floor(n * o));
|
|
452
|
+
if (this.gpuTexture && this.width === s && this.height === c) return;
|
|
453
|
+
let l = this.gpuTexture, u = r.createTexture({
|
|
454
|
+
label: "five.videoBlit.target",
|
|
455
|
+
size: {
|
|
456
|
+
width: s,
|
|
457
|
+
height: c
|
|
458
|
+
},
|
|
459
|
+
format: a,
|
|
460
|
+
usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.RENDER_ATTACHMENT
|
|
461
|
+
});
|
|
462
|
+
if (this.gpuTexture = u, this.width = s, this.height = c, this.externalTexture) this.externalTexture.sourceTexture = u, this.externalTexture.image = {
|
|
463
|
+
width: s,
|
|
464
|
+
height: c
|
|
465
|
+
}, this.externalTexture.dispose();
|
|
466
|
+
else {
|
|
467
|
+
let t = new e.ExternalTexture(u);
|
|
468
|
+
t.colorSpace = e.SRGBColorSpace, t.flipY = !1, t.generateMipmaps = !1, t.minFilter = e.LinearFilter, t.magFilter = e.LinearFilter, t.wrapS = e.ClampToEdgeWrapping, t.wrapT = e.ClampToEdgeWrapping, t.image = {
|
|
469
|
+
width: s,
|
|
470
|
+
height: c
|
|
471
|
+
}, this.externalTexture = t;
|
|
472
|
+
}
|
|
473
|
+
l == null || l.destroy();
|
|
474
|
+
}
|
|
475
|
+
blit(e) {
|
|
476
|
+
let t = this.device, { pipeline: n, sampler: r } = c(t), i = t.importExternalTexture({ source: e }), a = t.createBindGroup({
|
|
477
|
+
layout: n.getBindGroupLayout(0),
|
|
478
|
+
entries: [{
|
|
479
|
+
binding: 0,
|
|
480
|
+
resource: i
|
|
481
|
+
}, {
|
|
482
|
+
binding: 1,
|
|
483
|
+
resource: r
|
|
484
|
+
}]
|
|
485
|
+
}), o = t.createCommandEncoder({ label: "five.videoBlit" }), s = o.beginRenderPass({ colorAttachments: [{
|
|
486
|
+
view: this.gpuTexture.createView(),
|
|
487
|
+
loadOp: "clear",
|
|
488
|
+
storeOp: "store",
|
|
489
|
+
clearValue: {
|
|
490
|
+
r: 0,
|
|
491
|
+
g: 0,
|
|
492
|
+
b: 0,
|
|
493
|
+
a: 1
|
|
494
|
+
}
|
|
495
|
+
}] });
|
|
496
|
+
s.setPipeline(n), s.setBindGroup(0, a), s.draw(3), s.end(), t.queue.submit([o.finish()]);
|
|
497
|
+
}
|
|
498
|
+
releaseTarget() {
|
|
499
|
+
var e, t;
|
|
500
|
+
(e = this.externalTexture) == null || e.dispose(), this.externalTexture = null, (t = this.gpuTexture) == null || t.destroy(), this.gpuTexture = null, this.width = this.height = 0;
|
|
501
|
+
}
|
|
502
|
+
dispose() {
|
|
503
|
+
if (this.disposed) return;
|
|
504
|
+
this.disposed = !0;
|
|
505
|
+
let e = this.video;
|
|
506
|
+
this.videoFrameCallbackId !== null && typeof (e == null ? void 0 : e.cancelVideoFrameCallback) == "function" && e.cancelVideoFrameCallback(this.videoFrameCallbackId), this.videoFrameCallbackId = null, this.releaseTarget();
|
|
507
|
+
}
|
|
508
|
+
}, f = /* @__PURE__ */ new WeakMap();
|
|
509
|
+
function p(e) {
|
|
510
|
+
let t = f.get(e);
|
|
511
|
+
if (!t) {
|
|
512
|
+
let n = new d(e);
|
|
513
|
+
t = n, f.set(e, n);
|
|
514
|
+
let r = () => {
|
|
515
|
+
e.removeEventListener("dispose", r), f.get(e) === n && f.delete(e), n.dispose();
|
|
516
|
+
};
|
|
517
|
+
e.addEventListener("dispose", r);
|
|
518
|
+
}
|
|
519
|
+
return t;
|
|
520
|
+
}
|
|
521
|
+
//#endregion
|
|
372
522
|
//#region build/sticker/index.js
|
|
373
|
-
var
|
|
374
|
-
function
|
|
375
|
-
e.naturalWidth > 0 &&
|
|
523
|
+
var m = window, h = m.requestAnimationFrame || m.mozRequestAnimationFrame || m.webkitRequestAnimationFrame || m.msRequestAnimationFrame || ((e) => setTimeout(e, 16)), g = typeof performance < "u" && performance.timing !== void 0 ? performance.timing.navigationStart : Date.now(), _ = typeof performance < "u" ? (() => g + performance.now()) : (() => Date.now());
|
|
524
|
+
function v(e, t) {
|
|
525
|
+
e.naturalWidth > 0 && h(() => t());
|
|
376
526
|
let n = () => t();
|
|
377
527
|
return e.addEventListener("load", n, !1), () => e.removeEventListener("load", n, !1);
|
|
378
528
|
}
|
|
379
|
-
function
|
|
380
|
-
let n =
|
|
381
|
-
r = !0, t(),
|
|
529
|
+
function y(e, t) {
|
|
530
|
+
let n = _(), r = !1, i = () => {
|
|
531
|
+
r = !0, t(), _() - n < 3e3 ? h(i) : r = !1;
|
|
382
532
|
}, a = () => {
|
|
383
|
-
n =
|
|
533
|
+
n = _(), r === !1 && i();
|
|
384
534
|
};
|
|
385
535
|
return e.addEventListener("timeupdate", a, !1), () => {
|
|
386
536
|
e.removeEventListener("timeupdate", a, !1), r = !1;
|
|
387
537
|
};
|
|
388
538
|
}
|
|
389
|
-
function
|
|
539
|
+
function b(e, t) {
|
|
390
540
|
let n = e.dispose;
|
|
391
541
|
e.dispose = () => {
|
|
392
542
|
t(), n.call(e);
|
|
393
543
|
};
|
|
394
544
|
}
|
|
395
|
-
var
|
|
545
|
+
var x = class extends e.Mesh {
|
|
396
546
|
static get version() {
|
|
397
|
-
return "1.0.0-alpha.
|
|
547
|
+
return "1.0.0-alpha.13";
|
|
398
548
|
}
|
|
399
549
|
constructor(t, n, r) {
|
|
400
550
|
let a = new e.MeshBasicMaterial();
|
|
401
|
-
if (super(i, a), this._needsRender = !1, this.scale.set(t, n, 1), typeof r == "string") {
|
|
551
|
+
if (super(i, a), this._sourceTexture = null, this._needsRender = !1, this.scale.set(t, n, 1), typeof r == "string") {
|
|
402
552
|
a.transparent = /\.png$/.test(r);
|
|
403
553
|
let e = new Image();
|
|
404
554
|
e.src = r, e.crossOrigin = "", r = e;
|
|
405
555
|
}
|
|
406
556
|
if (r instanceof HTMLImageElement) {
|
|
407
557
|
let t = a.map = new e.Texture();
|
|
408
|
-
t.wrapS = e.ClampToEdgeWrapping, t.wrapT = e.ClampToEdgeWrapping, t.minFilter = e.LinearFilter, t.colorSpace = e.SRGBColorSpace,
|
|
558
|
+
t.wrapS = e.ClampToEdgeWrapping, t.wrapT = e.ClampToEdgeWrapping, t.minFilter = e.LinearFilter, t.colorSpace = e.SRGBColorSpace, b(t, v(r, () => {
|
|
409
559
|
t.image = r, t.needsUpdate = !0, this._needsRender = !0;
|
|
410
560
|
}));
|
|
411
561
|
} else if (r instanceof HTMLCanvasElement) a.map = new e.CanvasTexture(r);
|
|
412
562
|
else if (r instanceof HTMLVideoElement) {
|
|
413
563
|
let t = a.map = new e.VideoTexture(r);
|
|
414
|
-
t.wrapS = e.ClampToEdgeWrapping, t.wrapT = e.ClampToEdgeWrapping, t.minFilter = e.LinearFilter, t.colorSpace = e.SRGBColorSpace,
|
|
564
|
+
t.wrapS = e.ClampToEdgeWrapping, t.wrapT = e.ClampToEdgeWrapping, t.minFilter = e.LinearFilter, t.colorSpace = e.SRGBColorSpace, b(t, y(r, () => {
|
|
415
565
|
this._needsRender = !0;
|
|
416
566
|
}));
|
|
567
|
+
let n = p(t);
|
|
568
|
+
this.onBeforeRender = (e) => {
|
|
569
|
+
n.update(e);
|
|
570
|
+
let t = n.texture;
|
|
571
|
+
a.map !== t && (a.map = t);
|
|
572
|
+
};
|
|
417
573
|
}
|
|
574
|
+
this._sourceTexture = a.map;
|
|
418
575
|
}
|
|
419
576
|
get needsRender() {
|
|
420
577
|
return this._needsRender;
|
|
421
578
|
}
|
|
422
579
|
set needsRender(e) {
|
|
423
|
-
this._needsRender = e, e === !0 && this.
|
|
580
|
+
this._needsRender = e, e === !0 && this._sourceTexture && (this._sourceTexture.needsUpdate = !0);
|
|
424
581
|
}
|
|
425
582
|
setSize(e, t) {
|
|
426
583
|
this.scale.set(e, t, 1), this._needsRender = !0;
|
|
@@ -434,8 +591,8 @@ var f = class extends e.Mesh {
|
|
|
434
591
|
}
|
|
435
592
|
dispose() {
|
|
436
593
|
var e;
|
|
437
|
-
(e = this.
|
|
594
|
+
(e = this._sourceTexture) == null || e.dispose(), this.material.dispose();
|
|
438
595
|
}
|
|
439
596
|
};
|
|
440
597
|
//#endregion
|
|
441
|
-
export {
|
|
598
|
+
export { x as Sticker };
|