@hology/core 0.0.20
Sign up to get free protection for your applications and to get access to all the features.
- package/LICENSE.md +15 -0
- package/README.md +3 -0
- package/dist/config/project-config.d.ts +10 -0
- package/dist/config/project-config.js +5 -0
- package/dist/controllers/base-game-controller.d.ts +3 -0
- package/dist/controllers/base-game-controller.js +5 -0
- package/dist/csm.d.ts +7 -0
- package/dist/csm.js +5 -0
- package/dist/effects/particles/examples.d.ts +271 -0
- package/dist/effects/particles/examples.js +5 -0
- package/dist/effects/particles/particle-system-config.d.ts +85 -0
- package/dist/effects/particles/particle-system-config.js +5 -0
- package/dist/game-component/component-decorators.d.ts +5 -0
- package/dist/game-component/component-decorators.js +5 -0
- package/dist/game-component/game-component.d.ts +8 -0
- package/dist/game-component/game-component.js +5 -0
- package/dist/gameplay/actors/actor.d.ts +37 -0
- package/dist/gameplay/actors/actor.js +5 -0
- package/dist/gameplay/actors/builtin/camera-actor.d.ts +11 -0
- package/dist/gameplay/actors/builtin/camera-actor.js +5 -0
- package/dist/gameplay/actors/builtin/components/character/character-animation.d.ts +67 -0
- package/dist/gameplay/actors/builtin/components/character/character-animation.js +5 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement copy.d.ts +37 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement copy.js +5 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement.d.ts +51 -0
- package/dist/gameplay/actors/builtin/components/character/character-movement.js +5 -0
- package/dist/gameplay/actors/builtin/components/character/modes.d.ts +18 -0
- package/dist/gameplay/actors/builtin/components/character/modes.js +5 -0
- package/dist/gameplay/actors/builtin/components/mesh-component.d.ts +20 -0
- package/dist/gameplay/actors/builtin/components/mesh-component.js +5 -0
- package/dist/gameplay/actors/builtin/components/scene-component.d.ts +7 -0
- package/dist/gameplay/actors/builtin/components/scene-component.js +5 -0
- package/dist/gameplay/actors/builtin/index.d.ts +11 -0
- package/dist/gameplay/actors/builtin/index.js +5 -0
- package/dist/gameplay/actors/builtin/positional-audio-actor.d.ts +19 -0
- package/dist/gameplay/actors/builtin/positional-audio-actor.js +5 -0
- package/dist/gameplay/actors/builtin/spawn-point.d.ts +11 -0
- package/dist/gameplay/actors/builtin/spawn-point.js +5 -0
- package/dist/gameplay/actors/builtin/trigger-volume.d.ts +23 -0
- package/dist/gameplay/actors/builtin/trigger-volume.js +5 -0
- package/dist/gameplay/actors/camera/camera-component.d.ts +13 -0
- package/dist/gameplay/actors/camera/camera-component.js +5 -0
- package/dist/gameplay/actors/camera/third-party-camera-component.d.ts +43 -0
- package/dist/gameplay/actors/camera/third-party-camera-component.js +5 -0
- package/dist/gameplay/actors/component.d.ts +41 -0
- package/dist/gameplay/actors/component.js +5 -0
- package/dist/gameplay/actors/factory.d.ts +12 -0
- package/dist/gameplay/actors/factory.js +5 -0
- package/dist/gameplay/actors/index.d.ts +10 -0
- package/dist/gameplay/actors/index.js +5 -0
- package/dist/gameplay/actors/internal/component-init.d.ts +3 -0
- package/dist/gameplay/actors/internal/component-init.js +5 -0
- package/dist/gameplay/actors/internal/container-map.d.ts +6 -0
- package/dist/gameplay/actors/internal/container-map.js +5 -0
- package/dist/gameplay/animation/anim-sm.d.ts +38 -0
- package/dist/gameplay/animation/anim-sm.js +5 -0
- package/dist/gameplay/animation/root-motion.d.ts +31 -0
- package/dist/gameplay/animation/root-motion.js +5 -0
- package/dist/gameplay/env.d.ts +3 -0
- package/dist/gameplay/env.js +5 -0
- package/dist/gameplay/index.d.ts +14 -0
- package/dist/gameplay/index.js +5 -0
- package/dist/gameplay/initiate.d.ts +51 -0
- package/dist/gameplay/initiate.js +5 -0
- package/dist/gameplay/inject.d.ts +3 -0
- package/dist/gameplay/inject.js +5 -0
- package/dist/gameplay/input/index.d.ts +3 -0
- package/dist/gameplay/input/index.js +5 -0
- package/dist/gameplay/input/input-service.d.ts +33 -0
- package/dist/gameplay/input/input-service.js +5 -0
- package/dist/gameplay/input/input.d.ts +41 -0
- package/dist/gameplay/input/input.js +5 -0
- package/dist/gameplay/input/keybind.d.ts +23 -0
- package/dist/gameplay/input/keybind.js +5 -0
- package/dist/gameplay/services/asset-loader.d.ts +34 -0
- package/dist/gameplay/services/asset-loader.js +5 -0
- package/dist/gameplay/services/physics/collision-contact.d.ts +2 -0
- package/dist/gameplay/services/physics/collision-contact.js +5 -0
- package/dist/gameplay/services/physics/physics-system.d.ts +145 -0
- package/dist/gameplay/services/physics/physics-system.js +5 -0
- package/dist/gameplay/services/render.d.ts +19 -0
- package/dist/gameplay/services/render.js +5 -0
- package/dist/gameplay/services/world.d.ts +15 -0
- package/dist/gameplay/services/world.js +5 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +5 -0
- package/dist/rendering/shader-override.d.ts +2 -0
- package/dist/rendering/shader-override.js +5 -0
- package/dist/rendering.d.ts +53 -0
- package/dist/rendering.js +5 -0
- package/dist/scene/asset-resource-loader.d.ts +32 -0
- package/dist/scene/asset-resource-loader.js +5 -0
- package/dist/scene/assets-provider.d.ts +9 -0
- package/dist/scene/assets-provider.js +5 -0
- package/dist/scene/bootstrap.d.ts +21 -0
- package/dist/scene/bootstrap.js +5 -0
- package/dist/scene/collision/collision-shape-import.d.ts +4 -0
- package/dist/scene/collision/collision-shape-import.js +5 -0
- package/dist/scene/collision/collision-shape.d.ts +59 -0
- package/dist/scene/collision/collision-shape.js +5 -0
- package/dist/scene/landscape/landscape-manager.d.ts +43 -0
- package/dist/scene/landscape/landscape-manager.js +5 -0
- package/dist/scene/landscape/landscape.d.ts +20 -0
- package/dist/scene/landscape/landscape.js +5 -0
- package/dist/scene/landscape/utils.d.ts +9 -0
- package/dist/scene/landscape/utils.js +5 -0
- package/dist/scene/materializer.d.ts +245 -0
- package/dist/scene/materializer.js +5 -0
- package/dist/scene/materials/grass-foliage.d.ts +8 -0
- package/dist/scene/materials/grass-foliage.js +5 -0
- package/dist/scene/materials/grass.d.ts +4 -0
- package/dist/scene/materials/grass.js +5 -0
- package/dist/scene/materials/utils/material-painting.d.ts +2 -0
- package/dist/scene/materials/utils/material-painting.js +5 -0
- package/dist/scene/materials/utils/noise.glsl.d.ts +1 -0
- package/dist/scene/materials/utils/noise.glsl.js +5 -0
- package/dist/scene/materials/water.d.ts +3 -0
- package/dist/scene/materials/water.js +5 -0
- package/dist/scene/model.d.ts +96 -0
- package/dist/scene/model.js +5 -0
- package/dist/scene/objects/ramp-geometry.d.ts +2 -0
- package/dist/scene/objects/ramp-geometry.js +5 -0
- package/dist/scene/objects/shapes.d.ts +121 -0
- package/dist/scene/objects/shapes.js +5 -0
- package/dist/scene/runtime-asset-service.d.ts +14 -0
- package/dist/scene/runtime-asset-service.js +5 -0
- package/dist/scene/runtime-backend-service.d.ts +12 -0
- package/dist/scene/runtime-backend-service.js +5 -0
- package/dist/scene/scene-data-service.d.ts +33 -0
- package/dist/scene/scene-data-service.js +5 -0
- package/dist/scene/sky.d.ts +3 -0
- package/dist/scene/sky.js +5 -0
- package/dist/scene/storage/storage.d.ts +39 -0
- package/dist/scene/storage/storage.js +5 -0
- package/dist/shader/builtin/index.d.ts +2 -0
- package/dist/shader/builtin/index.js +5 -0
- package/dist/shader/builtin/lambert-shader.d.ts +19 -0
- package/dist/shader/builtin/lambert-shader.js +5 -0
- package/dist/shader/builtin/standard-shader.d.ts +29 -0
- package/dist/shader/builtin/standard-shader.js +5 -0
- package/dist/shader/index.d.ts +2 -0
- package/dist/shader/index.js +5 -0
- package/dist/shader/parameter.d.ts +23 -0
- package/dist/shader/parameter.js +5 -0
- package/dist/shader/shader.d.ts +25 -0
- package/dist/shader/shader.js +5 -0
- package/dist/shader-nodes/depth.d.ts +10 -0
- package/dist/shader-nodes/depth.js +5 -0
- package/dist/shader-nodes/index.d.ts +5 -0
- package/dist/shader-nodes/index.js +5 -0
- package/dist/shader-nodes/landscape.d.ts +5 -0
- package/dist/shader-nodes/landscape.js +5 -0
- package/dist/shader-nodes/layers.d.ts +14 -0
- package/dist/shader-nodes/layers.js +5 -0
- package/dist/shader-nodes/time.d.ts +4 -0
- package/dist/shader-nodes/time.js +5 -0
- package/dist/test/injection.test.d.ts +1 -0
- package/dist/test/injection.test.js +5 -0
- package/dist/utils/async.d.ts +5 -0
- package/dist/utils/async.js +5 -0
- package/dist/utils/cannon/CannonUtils.d.ts +17 -0
- package/dist/utils/cannon/CannonUtils.js +5 -0
- package/dist/utils/cannon/three-to-cannon/ConvexHull.d.ts +47 -0
- package/dist/utils/cannon/three-to-cannon/ConvexHull.js +5 -0
- package/dist/utils/cannon/three-to-cannon/index.d.ts +63 -0
- package/dist/utils/cannon/three-to-cannon/index.js +5 -0
- package/dist/utils/cannon/three-to-cannon/utils.d.ts +9 -0
- package/dist/utils/cannon/three-to-cannon/utils.js +5 -0
- package/dist/utils/collections.d.ts +26 -0
- package/dist/utils/collections.js +5 -0
- package/dist/utils/files.d.ts +1 -0
- package/dist/utils/files.js +5 -0
- package/dist/utils/math.d.ts +24 -0
- package/dist/utils/math.js +5 -0
- package/dist/utils/mesh.d.ts +6 -0
- package/dist/utils/mesh.js +5 -0
- package/dist/utils/polyfill.d.ts +1 -0
- package/dist/utils/polyfill.js +5 -0
- package/dist/utils/three/depth-pass.d.ts +13 -0
- package/dist/utils/three/depth-pass.js +5 -0
- package/dist/utils/three/line-sphere.d.ts +2 -0
- package/dist/utils/three/line-sphere.js +5 -0
- package/dist/utils/three/outline-pass.d.ts +61 -0
- package/dist/utils/three/outline-pass.js +5 -0
- package/dist/utils/three/positional-audio-helper.d.ts +11 -0
- package/dist/utils/three/positional-audio-helper.js +5 -0
- package/dist/utils/three/stats.d.ts +12 -0
- package/dist/utils/three/stats.js +5 -0
- package/dist/utils/three/transform-controls.d.ts +73 -0
- package/dist/utils/three/transform-controls.js +5 -0
- package/dist/utils/three/traverse.d.ts +13 -0
- package/dist/utils/three/traverse.js +5 -0
- package/dist/utils/type.d.ts +4 -0
- package/dist/utils/type.js +5 -0
- package/dist/utils/uuid.d.ts +1 -0
- package/dist/utils/uuid.js +5 -0
- package/package.json +114 -0
- package/tsconfig.tsbuildinfo +1 -0
@@ -0,0 +1,61 @@
|
|
1
|
+
export class OutlinePass extends Pass {
|
2
|
+
constructor(resolution: any, scene: any, camera: any, selectedObjects: any);
|
3
|
+
renderScene: any;
|
4
|
+
renderCamera: any;
|
5
|
+
selectedObjects: any;
|
6
|
+
visibleEdgeColor: Color;
|
7
|
+
hiddenEdgeColor: Color;
|
8
|
+
edgeGlow: number;
|
9
|
+
usePatternTexture: boolean;
|
10
|
+
edgeThickness: number;
|
11
|
+
edgeStrength: number;
|
12
|
+
downSampleRatio: number;
|
13
|
+
pulsePeriod: number;
|
14
|
+
_visibilityCache: Map<any, any>;
|
15
|
+
resolution: Vector2;
|
16
|
+
maskBufferMaterial: MeshBasicMaterial;
|
17
|
+
renderTargetMaskBuffer: WebGLRenderTarget;
|
18
|
+
depthMaterial: MeshDepthMaterial;
|
19
|
+
prepareMaskMaterial: ShaderMaterial;
|
20
|
+
renderTargetDepthBuffer: WebGLRenderTarget;
|
21
|
+
renderTargetMaskDownSampleBuffer: WebGLRenderTarget;
|
22
|
+
renderTargetBlurBuffer1: WebGLRenderTarget;
|
23
|
+
renderTargetBlurBuffer2: WebGLRenderTarget;
|
24
|
+
edgeDetectionMaterial: ShaderMaterial;
|
25
|
+
renderTargetEdgeBuffer1: WebGLRenderTarget;
|
26
|
+
renderTargetEdgeBuffer2: WebGLRenderTarget;
|
27
|
+
separableBlurMaterial1: ShaderMaterial;
|
28
|
+
separableBlurMaterial2: ShaderMaterial;
|
29
|
+
overlayMaterial: ShaderMaterial;
|
30
|
+
copyUniforms: any;
|
31
|
+
materialCopy: ShaderMaterial;
|
32
|
+
_oldClearColor: Color;
|
33
|
+
oldClearAlpha: number;
|
34
|
+
fsQuad: FullScreenQuad<any>;
|
35
|
+
tempPulseColor1: Color;
|
36
|
+
tempPulseColor2: Color;
|
37
|
+
textureMatrix: Matrix4;
|
38
|
+
dispose(): void;
|
39
|
+
setSize(width: any, height: any): void;
|
40
|
+
changeVisibilityOfSelectedObjects(bVisible: any): void;
|
41
|
+
changeVisibilityOfNonSelectedObjects(bVisible: any): void;
|
42
|
+
updateTextureMatrix(): void;
|
43
|
+
render(renderer: any, writeBuffer: any, readBuffer: any, deltaTime: any, maskActive: any): void;
|
44
|
+
getPrepareMaskMaterial(): ShaderMaterial;
|
45
|
+
getEdgeDetectionMaterial(): ShaderMaterial;
|
46
|
+
getSeperableBlurMaterial(maxRadius: any): ShaderMaterial;
|
47
|
+
getOverlayMaterial(): ShaderMaterial;
|
48
|
+
}
|
49
|
+
export namespace OutlinePass {
|
50
|
+
const BlurDirectionX: Vector2;
|
51
|
+
const BlurDirectionY: Vector2;
|
52
|
+
}
|
53
|
+
import { Pass } from 'three-stdlib';
|
54
|
+
import { Color } from 'three';
|
55
|
+
import { Vector2 } from 'three';
|
56
|
+
import { MeshBasicMaterial } from 'three';
|
57
|
+
import { WebGLRenderTarget } from 'three';
|
58
|
+
import { MeshDepthMaterial } from 'three';
|
59
|
+
import { ShaderMaterial } from 'three';
|
60
|
+
import { FullScreenQuad } from 'three-stdlib';
|
61
|
+
import { Matrix4 } from 'three';
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import{AdditiveBlending as e,Color as r,DoubleSide as t,LinearFilter as i,Matrix4 as a,MeshBasicMaterial as s,MeshDepthMaterial as n,NoBlending as l,RGBADepthPacking as u,RGBAFormat as o,ShaderMaterial as d,UniformsUtils as h,Vector2 as f,Vector3 as v,WebGLRenderTarget as g}from"three";import{Pass as c,FullScreenQuad as m}from"three-stdlib";import{CopyShader as p}from"three-stdlib";class x extends c{constructor(e,v,c,x){super(),this.renderScene=v,this.renderCamera=c,this.selectedObjects=void 0!==x?x:[],this.visibleEdgeColor=new r(1,1,1),this.hiddenEdgeColor=new r(.1,.04,.02),this.edgeGlow=0,this.usePatternTexture=!1,this.edgeThickness=1,this.edgeStrength=3,this.downSampleRatio=2,this.pulsePeriod=0,this._visibilityCache=new Map,this.resolution=void 0!==e?new f(e.x,e.y):new f(256,256);const M={minFilter:i,magFilter:i,format:o},T=Math.round(this.resolution.x/this.downSampleRatio),B=Math.round(this.resolution.y/this.downSampleRatio);this.maskBufferMaterial=new s({color:16777215}),this.maskBufferMaterial.side=t,this.renderTargetMaskBuffer=new g(this.resolution.x,this.resolution.y,M),this.renderTargetMaskBuffer.texture.name="OutlinePass.mask",this.renderTargetMaskBuffer.texture.generateMipmaps=!1,this.depthMaterial=new n,this.depthMaterial.side=t,this.depthMaterial.depthPacking=u,this.depthMaterial.blending=l,this.prepareMaskMaterial=this.getPrepareMaskMaterial(),this.prepareMaskMaterial.side=t,this.prepareMaskMaterial.fragmentShader=function(e,r){var t=r.isPerspectiveCamera?"perspective":"orthographic";return e.replace(/DEPTH_TO_VIEW_Z/g,t+"DepthToViewZ")}(this.prepareMaskMaterial.fragmentShader,this.renderCamera),this.renderTargetDepthBuffer=new g(this.resolution.x,this.resolution.y,M),this.renderTargetDepthBuffer.texture.name="OutlinePass.depth",this.renderTargetDepthBuffer.texture.generateMipmaps=!1,this.renderTargetMaskDownSampleBuffer=new g(T,B,M),this.renderTargetMaskDownSampleBuffer.texture.name="OutlinePass.depthDownSample",this.renderTargetMaskDownSampleBuffer.texture.generateMipmaps=!1,this.renderTargetBlurBuffer1=new g(T,B,M),this.renderTargetBlurBuffer1.texture.name="OutlinePass.blur1",this.renderTargetBlurBuffer1.texture.generateMipmaps=!1,this.renderTargetBlurBuffer2=new g(Math.round(T/2),Math.round(B/2),M),this.renderTargetBlurBuffer2.texture.name="OutlinePass.blur2",this.renderTargetBlurBuffer2.texture.generateMipmaps=!1,this.edgeDetectionMaterial=this.getEdgeDetectionMaterial(),this.renderTargetEdgeBuffer1=new g(T,B,M),this.renderTargetEdgeBuffer1.texture.name="OutlinePass.edge1",this.renderTargetEdgeBuffer1.texture.generateMipmaps=!1,this.renderTargetEdgeBuffer2=new g(Math.round(T/2),Math.round(B/2),M),this.renderTargetEdgeBuffer2.texture.name="OutlinePass.edge2",this.renderTargetEdgeBuffer2.texture.generateMipmaps=!1;this.separableBlurMaterial1=this.getSeperableBlurMaterial(4),this.separableBlurMaterial1.uniforms.texSize.value.set(T,B),this.separableBlurMaterial1.uniforms.kernelRadius.value=1,this.separableBlurMaterial2=this.getSeperableBlurMaterial(4),this.separableBlurMaterial2.uniforms.texSize.value.set(Math.round(T/2),Math.round(B/2)),this.separableBlurMaterial2.uniforms.kernelRadius.value=4,this.overlayMaterial=this.getOverlayMaterial(),void 0===p&&console.error("THREE.OutlinePass relies on CopyShader");const S=p;this.copyUniforms=h.clone(S.uniforms),this.copyUniforms.opacity.value=1,this.materialCopy=new d({uniforms:this.copyUniforms,vertexShader:S.vertexShader,fragmentShader:S.fragmentShader,blending:l,depthTest:!1,depthWrite:!1,transparent:!0}),this.enabled=!0,this.needsSwap=!1,this._oldClearColor=new r,this.oldClearAlpha=1,this.fsQuad=new m(null),this.tempPulseColor1=new r,this.tempPulseColor2=new r,this.textureMatrix=new a}dispose(){this.renderTargetMaskBuffer.dispose(),this.renderTargetDepthBuffer.dispose(),this.renderTargetMaskDownSampleBuffer.dispose(),this.renderTargetBlurBuffer1.dispose(),this.renderTargetBlurBuffer2.dispose(),this.renderTargetEdgeBuffer1.dispose(),this.renderTargetEdgeBuffer2.dispose()}setSize(e,r){this.renderTargetMaskBuffer.setSize(e,r),this.renderTargetDepthBuffer.setSize(e,r);let t=Math.round(e/this.downSampleRatio),i=Math.round(r/this.downSampleRatio);this.renderTargetMaskDownSampleBuffer.setSize(t,i),this.renderTargetBlurBuffer1.setSize(t,i),this.renderTargetEdgeBuffer1.setSize(t,i),this.separableBlurMaterial1.uniforms.texSize.value.set(t,i),t=Math.round(t/2),i=Math.round(i/2),this.renderTargetBlurBuffer2.setSize(t,i),this.renderTargetEdgeBuffer2.setSize(t,i),this.separableBlurMaterial2.uniforms.texSize.value.set(t,i)}changeVisibilityOfSelectedObjects(e){const r=this._visibilityCache;function t(t){t.isMesh&&(!0===e?t.visible=r.get(t):(r.set(t,t.visible),t.visible=e))}for(let e=0;e<this.selectedObjects.length;e++){this.selectedObjects[e].traverse(t)}}changeVisibilityOfNonSelectedObjects(e){const r=this._visibilityCache,t=[];function i(e){e.isMesh&&t.push(e)}for(let e=0;e<this.selectedObjects.length;e++){this.selectedObjects[e].traverse(i)}this.renderScene.traverse((function(i){if(i.isMesh||i.isSprite||i.isTransformControls){let a=!1;for(let e=0;e<t.length;e++){if(t[e].id===i.id){a=!0;break}}if(!1===a){const t=i.visible;!1!==e&&!0!==r.get(i)||(i.visible=e),r.set(i,t)}}else(i.isPoints||i.isLine)&&(!0===e?i.visible=r.get(i):(r.set(i,i.visible),i.visible=e))}))}updateTextureMatrix(){this.textureMatrix.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),this.textureMatrix.multiply(this.renderCamera.projectionMatrix),this.textureMatrix.multiply(this.renderCamera.matrixWorldInverse)}render(e,r,t,i,a){if(this.selectedObjects.length>0){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const r=e.autoClear;e.autoClear=!1,a&&e.state.buffers.stencil.setTest(!1),e.setClearColor(16777215,1),this.changeVisibilityOfSelectedObjects(!1);const i=this.renderScene.background;if(this.renderScene.background=null,this.renderScene.overrideMaterial=this.depthMaterial,e.setRenderTarget(this.renderTargetDepthBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.changeVisibilityOfSelectedObjects(!0),this._visibilityCache.clear(),this.updateTextureMatrix(),this.changeVisibilityOfNonSelectedObjects(!1),this.renderScene.overrideMaterial=this.prepareMaskMaterial,this.prepareMaskMaterial.uniforms.cameraNearFar.value.set(this.renderCamera.near,this.renderCamera.far),this.prepareMaskMaterial.uniforms.depthTexture.value=this.renderTargetDepthBuffer.texture,this.prepareMaskMaterial.uniforms.textureMatrix.value=this.textureMatrix,e.setRenderTarget(this.renderTargetMaskBuffer),e.clear(),e.render(this.renderScene,this.renderCamera),this.renderScene.overrideMaterial=null,this.changeVisibilityOfNonSelectedObjects(!0),this._visibilityCache.clear(),this.renderScene.background=i,this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=this.renderTargetMaskBuffer.texture,e.setRenderTarget(this.renderTargetMaskDownSampleBuffer),e.clear(),this.fsQuad.render(e),this.tempPulseColor1.copy(this.visibleEdgeColor),this.tempPulseColor2.copy(this.hiddenEdgeColor),this.pulsePeriod>0){const e=.625+.75*Math.cos(.01*performance.now()/this.pulsePeriod)/2;this.tempPulseColor1.multiplyScalar(e),this.tempPulseColor2.multiplyScalar(e)}this.fsQuad.material=this.edgeDetectionMaterial,this.edgeDetectionMaterial.uniforms.maskTexture.value=this.renderTargetMaskDownSampleBuffer.texture,this.edgeDetectionMaterial.uniforms.texSize.value.set(this.renderTargetMaskDownSampleBuffer.width,this.renderTargetMaskDownSampleBuffer.height),this.edgeDetectionMaterial.uniforms.visibleEdgeColor.value=this.tempPulseColor1,this.edgeDetectionMaterial.uniforms.hiddenEdgeColor.value=this.tempPulseColor2,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial1,this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=x.BlurDirectionX,this.separableBlurMaterial1.uniforms.kernelRadius.value=this.edgeThickness,e.setRenderTarget(this.renderTargetBlurBuffer1),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial1.uniforms.colorTexture.value=this.renderTargetBlurBuffer1.texture,this.separableBlurMaterial1.uniforms.direction.value=x.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer1),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.separableBlurMaterial2,this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetEdgeBuffer1.texture,this.separableBlurMaterial2.uniforms.direction.value=x.BlurDirectionX,e.setRenderTarget(this.renderTargetBlurBuffer2),e.clear(),this.fsQuad.render(e),this.separableBlurMaterial2.uniforms.colorTexture.value=this.renderTargetBlurBuffer2.texture,this.separableBlurMaterial2.uniforms.direction.value=x.BlurDirectionY,e.setRenderTarget(this.renderTargetEdgeBuffer2),e.clear(),this.fsQuad.render(e),this.fsQuad.material=this.overlayMaterial,this.overlayMaterial.uniforms.maskTexture.value=this.renderTargetMaskBuffer.texture,this.overlayMaterial.uniforms.edgeTexture1.value=this.renderTargetEdgeBuffer1.texture,this.overlayMaterial.uniforms.edgeTexture2.value=this.renderTargetEdgeBuffer2.texture,this.overlayMaterial.uniforms.patternTexture.value=this.patternTexture,this.overlayMaterial.uniforms.edgeStrength.value=this.edgeStrength,this.overlayMaterial.uniforms.edgeGlow.value=this.edgeGlow,this.overlayMaterial.uniforms.usePatternTexture.value=this.usePatternTexture,a&&e.state.buffers.stencil.setTest(!0),e.setRenderTarget(t),this.fsQuad.render(e),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=r}this.renderToScreen&&(this.fsQuad.material=this.materialCopy,this.copyUniforms.tDiffuse.value=t.texture,e.setRenderTarget(null),this.fsQuad.render(e))}getPrepareMaskMaterial(){return new d({uniforms:{depthTexture:{value:null},cameraNearFar:{value:new f(.5,.5)},textureMatrix:{value:null}},vertexShader:"#include <morphtarget_pars_vertex>\n #include <skinning_pars_vertex>\n varying vec4 projTexCoord;\n varying vec4 vPosition;\n uniform mat4 textureMatrix;\n void main() {\n #include <skinbase_vertex>\n #include <begin_vertex>\n #include <morphtarget_vertex>\n #include <skinning_vertex>\n #include <project_vertex>\n vPosition = mvPosition;\n vec4 worldPosition = modelMatrix * vec4( transformed, 1.0 );\n projTexCoord = textureMatrix * worldPosition;\n }",fragmentShader:"#include <packing>\n varying vec4 vPosition;\n varying vec4 projTexCoord;\n uniform sampler2D depthTexture;\n uniform vec2 cameraNearFar;\n void main() {\n float depth = unpackRGBAToDepth(texture2DProj( depthTexture, projTexCoord ));\n float viewZ = - DEPTH_TO_VIEW_Z( depth, cameraNearFar.x, cameraNearFar.y );\n float depthTest = (-vPosition.z > viewZ) ? 1.0 : 0.0;\n gl_FragColor = vec4(0.0, depthTest, 1.0, 1.0);\n }"})}getEdgeDetectionMaterial(){return new d({uniforms:{maskTexture:{value:null},texSize:{value:new f(.5,.5)},visibleEdgeColor:{value:new v(1,1,1)},hiddenEdgeColor:{value:new v(1,1,1)}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"varying vec2 vUv;\n uniform sampler2D maskTexture;\n uniform vec2 texSize;\n uniform vec3 visibleEdgeColor;\n uniform vec3 hiddenEdgeColor;\n void main() {\n vec2 invSize = 1.0 / texSize;\n vec4 uvOffset = vec4(1.0, 0.0, 0.0, 1.0) * vec4(invSize, invSize);\n vec4 c1 = texture2D( maskTexture, vUv + uvOffset.xy);\n vec4 c2 = texture2D( maskTexture, vUv - uvOffset.xy);\n vec4 c3 = texture2D( maskTexture, vUv + uvOffset.yw);\n vec4 c4 = texture2D( maskTexture, vUv - uvOffset.yw);\n float diff1 = (c1.r - c2.r)*0.5;\n float diff2 = (c3.r - c4.r)*0.5;\n float d = length( vec2(diff1, diff2) );\n float a1 = min(c1.g, c2.g);\n float a2 = min(c3.g, c4.g);\n float visibilityFactor = min(a1, a2);\n vec3 edgeColor = 1.0 - visibilityFactor > 0.001 ? visibleEdgeColor : hiddenEdgeColor;\n gl_FragColor = vec4(edgeColor, 1.0) * vec4(d);\n }"})}getSeperableBlurMaterial(e){return new d({defines:{MAX_RADIUS:e},uniforms:{colorTexture:{value:null},texSize:{value:new f(.5,.5)},direction:{value:new f(.5,.5)},kernelRadius:{value:1}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"#include <common>\n varying vec2 vUv;\n uniform sampler2D colorTexture;\n uniform vec2 texSize;\n uniform vec2 direction;\n uniform float kernelRadius;\n float gaussianPdf(in float x, in float sigma) {\n return 0.39894 * exp( -0.5 * x * x/( sigma * sigma))/sigma;\n }\n void main() {\n vec2 invSize = 1.0 / texSize;\n float weightSum = gaussianPdf(0.0, kernelRadius);\n vec4 diffuseSum = texture2D( colorTexture, vUv) * weightSum;\n vec2 delta = direction * invSize * kernelRadius/float(MAX_RADIUS);\n vec2 uvOffset = delta;\n for( int i = 1; i <= MAX_RADIUS; i ++ ) {\n float w = gaussianPdf(uvOffset.x, kernelRadius);\n vec4 sample1 = texture2D( colorTexture, vUv + uvOffset);\n vec4 sample2 = texture2D( colorTexture, vUv - uvOffset);\n diffuseSum += ((sample1 + sample2) * w);\n weightSum += (2.0 * w);\n uvOffset += delta;\n }\n gl_FragColor = diffuseSum/weightSum;\n }"})}getOverlayMaterial(){return new d({uniforms:{maskTexture:{value:null},edgeTexture1:{value:null},edgeTexture2:{value:null},patternTexture:{value:null},edgeStrength:{value:1},edgeGlow:{value:1},usePatternTexture:{value:0}},vertexShader:"varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"varying vec2 vUv;\n uniform sampler2D maskTexture;\n uniform sampler2D edgeTexture1;\n uniform sampler2D edgeTexture2;\n uniform sampler2D patternTexture;\n uniform float edgeStrength;\n uniform float edgeGlow;\n uniform bool usePatternTexture;\n void main() {\n vec4 edgeValue1 = texture2D(edgeTexture1, vUv);\n vec4 edgeValue2 = texture2D(edgeTexture2, vUv);\n vec4 maskColor = texture2D(maskTexture, vUv);\n vec4 patternColor = texture2D(patternTexture, 6.0 * vUv);\n float visibilityFactor = 1.0 - maskColor.g > 0.0 ? 1.0 : 0.5;\n vec4 edgeValue = edgeValue1 + edgeValue2 * edgeGlow;\n vec4 finalColor = edgeStrength * maskColor.r * edgeValue;\n if(usePatternTexture)\n finalColor += + visibilityFactor * (1.0 - maskColor.r) * (1.0 - patternColor.r);\n gl_FragColor = finalColor;\n }",blending:e,depthTest:!1,depthWrite:!1,transparent:!0})}}x.BlurDirectionX=new f(1,0),x.BlurDirectionY=new f(0,1);export{x as OutlinePass};
|
2
|
+
/*
|
3
|
+
* Copyright (©) 2023. All rights reserved.
|
4
|
+
* See the LICENSE.md file for details.
|
5
|
+
*/
|
@@ -0,0 +1,11 @@
|
|
1
|
+
export class PositionalAudioHelper extends Line<BufferGeometry, import("three").Material | import("three").Material[]> {
|
2
|
+
constructor(audio: any, range?: number, divisionsInnerAngle?: number, divisionsOuterAngle?: number);
|
3
|
+
audio: any;
|
4
|
+
range: number;
|
5
|
+
divisionsInnerAngle: number;
|
6
|
+
divisionsOuterAngle: number;
|
7
|
+
update(): void;
|
8
|
+
dispose(): void;
|
9
|
+
}
|
10
|
+
import { BufferGeometry } from 'three';
|
11
|
+
import { Line } from 'three';
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import{BufferGeometry as t,BufferAttribute as e,LineBasicMaterial as i,Line as s,MathUtils as n}from"three";class o extends s{constructor(s,n=1,o=16,r=2){const a=new t,d=new Float32Array(3*(3*(o+2*r)+3));a.setAttribute("position",new e(d,3));const h=new i({color:65280,linewidth:2});super(a,[new i({color:16776960,linewidth:2}),h]),this.type="PositionalAudioHelper",this.audio=s,this.range=n,this.divisionsInnerAngle=o,this.divisionsOuterAngle=r,this.update()}update(){const t=this.audio,e=this.range,i=this.divisionsInnerAngle,s=this.divisionsOuterAngle,o=n.degToRad(t.panner.coneInnerAngle),r=n.degToRad(t.panner.coneOuterAngle),a=o/2,d=r/2;let h,l,p=0,c=0;const u=this.geometry,g=u.attributes.position;function m(t,i,s,n){const o=(i-t)/s;for(g.setXYZ(p,0,0,0),c++,h=t;h<i;h+=o)l=p+c,g.setXYZ(l,Math.sin(h)*e,0,Math.cos(h)*e),g.setXYZ(l+1,Math.sin(Math.min(h+o,i))*e,0,Math.cos(Math.min(h+o,i))*e),g.setXYZ(l+2,0,0,0),c+=3;u.addGroup(p,c,n),p+=c,c=0}u.clearGroups(),m(-d,-a,s,0),m(-a,a,i,1),m(a,d,s,0),g.needsUpdate=!0,o===r&&(this.material[0].visible=!1)}dispose(){this.geometry.dispose(),this.material[0].dispose(),this.material[1].dispose()}}export{o as PositionalAudioHelper};
|
2
|
+
/*
|
3
|
+
* Copyright (©) 2023. All rights reserved.
|
4
|
+
* See the LICENSE.md file for details.
|
5
|
+
*/
|
@@ -0,0 +1,12 @@
|
|
1
|
+
declare var Stats: () => {
|
2
|
+
REVISION: number;
|
3
|
+
dom: HTMLDivElement;
|
4
|
+
addPanel: (panel: any) => any;
|
5
|
+
showPanel: (id: any) => void;
|
6
|
+
begin: () => void;
|
7
|
+
end: () => number;
|
8
|
+
update: () => void;
|
9
|
+
domElement: HTMLDivElement;
|
10
|
+
setMode: (id: any) => void;
|
11
|
+
};
|
12
|
+
export default Stats;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
var e=function(){var t=0,l=document.createElement("div");function n(e){return l.appendChild(e.dom),e}function a(e){for(var n=0;n<l.children.length;n++)l.children[n].style.display=n===e?"block":"none";t=e}l.style.cssText="position:fixed;top:0;left:0;cursor:pointer;opacity:0.9;z-index:10000",l.addEventListener("click",(function(e){e.preventDefault(),a(++t%l.children.length)}),!1);var i=(performance||Date).now(),o=i,r=0,f=n(new e.Panel("FPS","#0ff","#002")),c=n(new e.Panel("MS","#0f0","#020"));if(self.performance&&self.performance.memory)var d=n(new e.Panel("MB","#f08","#201"));return a(0),{REVISION:16,dom:l,addPanel:n,showPanel:a,begin:function(){i=(performance||Date).now()},end:function(){r++;var e=(performance||Date).now();if(c.update(e-i,200),e>=o+1e3&&(f.update(1e3*r/(e-o),100),o=e,r=0,d)){var t=performance.memory;d.update(t.usedJSHeapSize/1048576,t.jsHeapSizeLimit/1048576)}return e},update:function(){i=this.end()},domElement:l,setMode:a}};e.Panel=function(e,t,l){var n=1/0,a=0,i=Math.round,o=i(window.devicePixelRatio||1),r=80*o,f=48*o,c=3*o,d=2*o,p=3*o,u=15*o,m=74*o,s=30*o,h=document.createElement("canvas");h.width=r,h.height=f,h.style.cssText="width:80px;height:48px";var v=h.getContext("2d");return v.font="bold "+9*o+"px Helvetica,Arial,sans-serif",v.textBaseline="top",v.fillStyle=l,v.fillRect(0,0,r,f),v.fillStyle=t,v.fillText(e,c,d),v.fillRect(p,u,m,s),v.fillStyle=l,v.globalAlpha=.9,v.fillRect(p,u,m,s),{dom:h,update:function(f,x){n=Math.min(n,f),a=Math.max(a,f),v.fillStyle=l,v.globalAlpha=1,v.fillRect(0,0,r,u),v.fillStyle=t,v.fillText(i(f)+" "+e+" ("+i(n)+"-"+i(a)+")",c,d),v.drawImage(h,p+o,u,m-o,s,p,u,m-o,s),v.fillRect(p+m-o,u,o,s),v.fillStyle=l,v.globalAlpha=.9,v.fillRect(p+m-o,u,o,i((1-f/x)*s))}}};export default e;
|
2
|
+
/*
|
3
|
+
* Copyright (©) 2023. All rights reserved.
|
4
|
+
* See the LICENSE.md file for details.
|
5
|
+
*/
|
@@ -0,0 +1,73 @@
|
|
1
|
+
export class TransformControls extends Object3D<import("three").Event> {
|
2
|
+
constructor(camera: any, domElement: any);
|
3
|
+
domElement: any;
|
4
|
+
_gizmo: TransformControlsGizmo;
|
5
|
+
_plane: TransformControlsPlane;
|
6
|
+
_offset: Vector3;
|
7
|
+
_startNorm: Vector3;
|
8
|
+
_endNorm: Vector3;
|
9
|
+
_cameraScale: Vector3;
|
10
|
+
_parentPosition: Vector3;
|
11
|
+
_parentQuaternion: Quaternion;
|
12
|
+
_parentQuaternionInv: Quaternion;
|
13
|
+
_parentScale: Vector3;
|
14
|
+
_worldScaleStart: Vector3;
|
15
|
+
_worldQuaternionInv: Quaternion;
|
16
|
+
_worldScale: Vector3;
|
17
|
+
_positionStart: Vector3;
|
18
|
+
_quaternionStart: Quaternion;
|
19
|
+
_scaleStart: Vector3;
|
20
|
+
_getPointer: any;
|
21
|
+
_onPointerDown: any;
|
22
|
+
_onPointerHover: any;
|
23
|
+
_onPointerMove: any;
|
24
|
+
_onPointerUp: any;
|
25
|
+
updateMatrixWorld(): void;
|
26
|
+
pointerHover(pointer: any): void;
|
27
|
+
axis: any;
|
28
|
+
pointerDown(pointer: any): void;
|
29
|
+
dragging: boolean;
|
30
|
+
pointerMove(pointer: any): void;
|
31
|
+
rotationAngle: any;
|
32
|
+
pointerUp(pointer: any): void;
|
33
|
+
dispose(): void;
|
34
|
+
attach(object: any): TransformControls;
|
35
|
+
object: any;
|
36
|
+
detach(): TransformControls;
|
37
|
+
reset(): void;
|
38
|
+
getRaycaster(): Raycaster;
|
39
|
+
getMode(): any;
|
40
|
+
setMode(mode: any): void;
|
41
|
+
mode: any;
|
42
|
+
setTranslationSnap(translationSnap: any): void;
|
43
|
+
translationSnap: any;
|
44
|
+
setRotationSnap(rotationSnap: any): void;
|
45
|
+
rotationSnap: any;
|
46
|
+
setScaleSnap(scaleSnap: any): void;
|
47
|
+
scaleSnap: any;
|
48
|
+
setSize(size: any): void;
|
49
|
+
size: any;
|
50
|
+
setSpace(space: any): void;
|
51
|
+
space: any;
|
52
|
+
update(): void;
|
53
|
+
isTransformControls: boolean;
|
54
|
+
}
|
55
|
+
export class TransformControlsGizmo extends Object3D<import("three").Event> {
|
56
|
+
constructor();
|
57
|
+
gizmo: {};
|
58
|
+
picker: {};
|
59
|
+
helper: {};
|
60
|
+
updateMatrixWorld(force: any): void;
|
61
|
+
isTransformControlsGizmo: boolean;
|
62
|
+
}
|
63
|
+
export class TransformControlsPlane extends Mesh<BufferGeometry, import("three").Material | import("three").Material[]> {
|
64
|
+
constructor();
|
65
|
+
updateMatrixWorld(force: any): void;
|
66
|
+
isTransformControlsPlane: boolean;
|
67
|
+
}
|
68
|
+
import { Object3D } from 'three';
|
69
|
+
import { Vector3 } from 'three';
|
70
|
+
import { Quaternion } from 'three';
|
71
|
+
import { Raycaster } from 'three';
|
72
|
+
import { BufferGeometry } from 'three';
|
73
|
+
import { Mesh } from 'three';
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import{BoxGeometry as t,BufferGeometry as e,CylinderGeometry as i,DoubleSide as n,Euler as o,Float32BufferAttribute as s,Line as a,LineBasicMaterial as r,Matrix4 as h,Mesh as l,MeshBasicMaterial as c,Object3D as p,OctahedronGeometry as d,PlaneGeometry as w,Quaternion as m,Raycaster as u,SphereGeometry as y,TorusGeometry as b,Vector3 as v}from"three";const M=new u,P=new v,g=new v,S=new m,x={X:new v(1,0,0),Y:new v(0,1,0),Z:new v(0,0,1)},_={type:"change"},f={type:"mouseDown"},E={type:"mouseUp",mode:null},I={type:"objectChange"};class X extends p{constructor(t,e){super(),void 0===e&&(console.warn('THREE.TransformControls: The second parameter "domElement" is now mandatory.'),e=document),this.visible=!1,this.domElement=e,this.domElement.style.touchAction="none";const i=new B;this._gizmo=i,this.add(i);const n=new J;this._plane=n,this.add(n);const o=this;function s(t,e){let s=e;Object.defineProperty(o,t,{get:function(){return void 0!==s?s:e},set:function(e){s!==e&&(s=e,n[t]=e,i[t]=e,o.dispatchEvent({type:t+"-changed",value:e}),o.dispatchEvent(_))}}),o[t]=e,n[t]=e,i[t]=e}s("camera",t),s("object",void 0),s("enabled",!0),s("axis",null),s("mode","translate"),s("translationSnap",null),s("rotationSnap",null),s("scaleSnap",null),s("space","world"),s("size",1),s("dragging",!1),s("showX",!0),s("showY",!0),s("showZ",!0);const a=new v,r=new v,h=new m,l=new m,c=new v,p=new m,d=new v,w=new v,u=new v,y=new v;s("worldPosition",a),s("worldPositionStart",r),s("worldQuaternion",h),s("worldQuaternionStart",l),s("cameraPosition",c),s("cameraQuaternion",p),s("pointStart",d),s("pointEnd",w),s("rotationAxis",u),s("rotationAngle",0),s("eye",y),this._offset=new v,this._startNorm=new v,this._endNorm=new v,this._cameraScale=new v,this._parentPosition=new v,this._parentQuaternion=new m,this._parentQuaternionInv=new m,this._parentScale=new v,this._worldScaleStart=new v,this._worldQuaternionInv=new m,this._worldScale=new v,this._positionStart=new v,this._quaternionStart=new m,this._scaleStart=new v,this._getPointer=Q.bind(this),this._onPointerDown=Z.bind(this),this._onPointerHover=Y.bind(this),this._onPointerMove=A.bind(this),this._onPointerUp=z.bind(this),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointermove",this._onPointerHover),this.domElement.addEventListener("pointerup",this._onPointerUp)}updateMatrixWorld(){void 0!==this.object&&(this.object.updateMatrixWorld(),null===this.object.parent?console.error("TransformControls: The attached 3D object must be a part of the scene graph."):this.object.parent.matrixWorld.decompose(this._parentPosition,this._parentQuaternion,this._parentScale),this.object.matrixWorld.decompose(this.worldPosition,this.worldQuaternion,this._worldScale),this._parentQuaternionInv.copy(this._parentQuaternion).invert(),this._worldQuaternionInv.copy(this.worldQuaternion).invert()),this.camera.updateMatrixWorld(),this.camera.matrixWorld.decompose(this.cameraPosition,this.cameraQuaternion,this._cameraScale),this.eye.copy(this.cameraPosition).sub(this.worldPosition).normalize(),super.updateMatrixWorld(this)}pointerHover(t){if(void 0===this.object||!0===this.dragging)return;M.setFromCamera(t,this.camera);const e=q(this._gizmo.picker[this.mode],M);this.axis=e?e.object.name:null}pointerDown(t){if(void 0!==this.object&&!0!==this.dragging&&0===t.button&&null!==this.axis){M.setFromCamera(t,this.camera);const e=q(this._plane,M,!0);e&&(this.object.updateMatrixWorld(),this.object.parent.updateMatrixWorld(),this._positionStart.copy(this.object.position),this._quaternionStart.copy(this.object.quaternion),this._scaleStart.copy(this.object.scale),this.object.matrixWorld.decompose(this.worldPositionStart,this.worldQuaternionStart,this._worldScaleStart),this.pointStart.copy(e.point).sub(this.worldPositionStart)),this.dragging=!0,f.mode=this.mode,this.dispatchEvent(f)}}pointerMove(t){const e=this.axis,i=this.mode,n=this.object;let o=this.space;if("scale"===i?o="local":"E"!==e&&"XYZE"!==e&&"XYZ"!==e||(o="world"),void 0===n||null===e||!1===this.dragging||-1!==t.button)return;M.setFromCamera(t,this.camera);const s=q(this._plane,M,!0);if(s){if(this.pointEnd.copy(s.point).sub(this.worldPositionStart),"translate"===i)this._offset.copy(this.pointEnd).sub(this.pointStart),"local"===o&&"XYZ"!==e&&this._offset.applyQuaternion(this._worldQuaternionInv),-1===e.indexOf("X")&&(this._offset.x=0),-1===e.indexOf("Y")&&(this._offset.y=0),-1===e.indexOf("Z")&&(this._offset.z=0),"local"===o&&"XYZ"!==e?this._offset.applyQuaternion(this._quaternionStart).divide(this._parentScale):this._offset.applyQuaternion(this._parentQuaternionInv).divide(this._parentScale),n.position.copy(this._offset).add(this._positionStart),this.translationSnap&&("local"===o&&(n.position.applyQuaternion(S.copy(this._quaternionStart).invert()),-1!==e.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.position.applyQuaternion(this._quaternionStart)),"world"===o&&(n.parent&&n.position.add(P.setFromMatrixPosition(n.parent.matrixWorld)),-1!==e.search("X")&&(n.position.x=Math.round(n.position.x/this.translationSnap)*this.translationSnap),-1!==e.search("Y")&&(n.position.y=Math.round(n.position.y/this.translationSnap)*this.translationSnap),-1!==e.search("Z")&&(n.position.z=Math.round(n.position.z/this.translationSnap)*this.translationSnap),n.parent&&n.position.sub(P.setFromMatrixPosition(n.parent.matrixWorld))));else if("scale"===i){if(-1!==e.search("XYZ")){let t=this.pointEnd.length()/this.pointStart.length();this.pointEnd.dot(this.pointStart)<0&&(t*=-1),g.set(t,t,t)}else P.copy(this.pointStart),g.copy(this.pointEnd),P.applyQuaternion(this._worldQuaternionInv),g.applyQuaternion(this._worldQuaternionInv),g.divide(P),-1===e.search("X")&&(g.x=1),-1===e.search("Y")&&(g.y=1),-1===e.search("Z")&&(g.z=1);n.scale.copy(this._scaleStart).multiply(g),this.scaleSnap&&(-1!==e.search("X")&&(n.scale.x=Math.round(n.scale.x/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Y")&&(n.scale.y=Math.round(n.scale.y/this.scaleSnap)*this.scaleSnap||this.scaleSnap),-1!==e.search("Z")&&(n.scale.z=Math.round(n.scale.z/this.scaleSnap)*this.scaleSnap||this.scaleSnap))}else if("rotate"===i){this._offset.copy(this.pointEnd).sub(this.pointStart);const t=20/this.worldPosition.distanceTo(P.setFromMatrixPosition(this.camera.matrixWorld));"E"===e?(this.rotationAxis.copy(this.eye),this.rotationAngle=this.pointEnd.angleTo(this.pointStart),this._startNorm.copy(this.pointStart).normalize(),this._endNorm.copy(this.pointEnd).normalize(),this.rotationAngle*=this._endNorm.cross(this._startNorm).dot(this.eye)<0?1:-1):"XYZE"===e?(this.rotationAxis.copy(this._offset).cross(this.eye).normalize(),this.rotationAngle=this._offset.dot(P.copy(this.rotationAxis).cross(this.eye))*t):"X"!==e&&"Y"!==e&&"Z"!==e||(this.rotationAxis.copy(x[e]),P.copy(x[e]),"local"===o&&P.applyQuaternion(this.worldQuaternion),this.rotationAngle=this._offset.dot(P.cross(this.eye).normalize())*t),this.rotationSnap&&(this.rotationAngle=Math.round(this.rotationAngle/this.rotationSnap)*this.rotationSnap),"local"===o&&"E"!==e&&"XYZE"!==e?(n.quaternion.copy(this._quaternionStart),n.quaternion.multiply(S.setFromAxisAngle(this.rotationAxis,this.rotationAngle)).normalize()):(this.rotationAxis.applyQuaternion(this._parentQuaternionInv),n.quaternion.copy(S.setFromAxisAngle(this.rotationAxis,this.rotationAngle)),n.quaternion.multiply(this._quaternionStart).normalize())}this.dispatchEvent(_),this.dispatchEvent(I)}}pointerUp(t){0===t.button&&(this.dragging&&null!==this.axis&&(E.mode=this.mode,this.dispatchEvent(E)),this.dragging=!1,this.axis=null)}dispose(){this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointermove",this._onPointerHover),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerup",this._onPointerUp),this.traverse((function(t){t.geometry&&t.geometry.dispose(),t.material&&t.material.dispose()}))}attach(t){return this.object=t,this.visible=!0,this}detach(){return this.object=void 0,this.visible=!1,this.axis=null,this}reset(){this.enabled&&this.dragging&&(this.object.position.copy(this._positionStart),this.object.quaternion.copy(this._quaternionStart),this.object.scale.copy(this._scaleStart),this.dispatchEvent(_),this.dispatchEvent(I),this.pointStart.copy(this.pointEnd))}getRaycaster(){return M}getMode(){return this.mode}setMode(t){this.mode=t}setTranslationSnap(t){this.translationSnap=t}setRotationSnap(t){this.rotationSnap=t}setScaleSnap(t){this.scaleSnap=t}setSize(t){this.size=t}setSpace(t){this.space=t}update(){console.warn("THREE.TransformControls: update function has no more functionality and therefore has been deprecated.")}}function Q(t){if(this.domElement.ownerDocument.pointerLockElement)return{x:0,y:0,button:t.button};{const e=this.domElement.getBoundingClientRect();return{x:(t.clientX-e.left)/e.width*2-1,y:-(t.clientY-e.top)/e.height*2+1,button:t.button}}}function Y(t){if(this.enabled)switch(t.pointerType){case"mouse":case"pen":this.pointerHover(this._getPointer(t))}}function Z(t){this.enabled&&(document.pointerLockElement||this.domElement.setPointerCapture(t.pointerId),this.domElement.addEventListener("pointermove",this._onPointerMove),this.pointerHover(this._getPointer(t)),this.pointerDown(this._getPointer(t)))}function A(t){this.enabled&&this.pointerMove(this._getPointer(t))}function z(t){this.enabled&&(this.domElement.releasePointerCapture(t.pointerId),this.domElement.removeEventListener("pointermove",this._onPointerMove),this.pointerUp(this._getPointer(t)))}function q(t,e,i){const n=e.intersectObject(t,!0);for(let t=0;t<n.length;t++)if(n[t].object.visible||i)return n[t];return!1}X.prototype.isTransformControls=!0;const j=new o,T=new v(0,1,0),k=new v(0,0,0),W=new h,F=new m,H=new m,C=new v,L=new h,D=new v(1,0,0),O=new v(0,1,0),R=new v(0,0,1),N=new v,U=new v,G=new v;class B extends p{constructor(){super(),this.type="TransformControlsGizmo";const n=new c({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),o=new r({depthTest:!1,depthWrite:!1,fog:!1,toneMapped:!1,transparent:!0}),h=n.clone();h.opacity=.15;const w=o.clone();w.opacity=.5;const m=n.clone();m.color.setHex(16711680);const u=n.clone();u.color.setHex(65280);const v=n.clone();v.color.setHex(255);const M=n.clone();M.color.setHex(16711680),M.opacity=.5;const P=n.clone();P.color.setHex(65280),P.opacity=.5;const g=n.clone();g.color.setHex(255),g.opacity=.5;const S=n.clone();S.opacity=.25;const x=n.clone();x.color.setHex(16776960),x.opacity=.25;n.clone().color.setHex(16776960);const _=n.clone();_.color.setHex(7895160);const f=new i(0,.04,.1,12);f.translate(0,.05,0);const E=new t(.08,.08,.08);E.translate(0,.04,0);const I=new e;I.setAttribute("position",new s([0,0,0,1,0,0],3));const X=new i(.0075,.0075,.5,3);function Q(t,e){const i=new b(t,.0075,3,64,e*Math.PI*2);return i.rotateY(Math.PI/2),i.rotateX(Math.PI/2),i}X.translate(0,.25,0);const Y={X:[[new l(f,m),[.5,0,0],[0,0,-Math.PI/2]],[new l(f,m),[-.5,0,0],[0,0,Math.PI/2]],[new l(X,m),[0,0,0],[0,0,-Math.PI/2]]],Y:[[new l(f,u),[0,.5,0]],[new l(f,u),[0,-.5,0],[Math.PI,0,0]],[new l(X,u)]],Z:[[new l(f,v),[0,0,.5],[Math.PI/2,0,0]],[new l(f,v),[0,0,-.5],[-Math.PI/2,0,0]],[new l(X,v),null,[Math.PI/2,0,0]]],XYZ:[[new l(new d(.1,0),S.clone()),[0,0,0]]],XY:[[new l(new t(.15,.15,.01),g.clone()),[.15,.15,0]]],YZ:[[new l(new t(.15,.15,.01),M.clone()),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new l(new t(.15,.15,.01),P.clone()),[.15,0,.15],[-Math.PI/2,0,0]]]},Z={X:[[new l(new i(.2,0,.6,4),h),[.3,0,0],[0,0,-Math.PI/2]],[new l(new i(.2,0,.6,4),h),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new l(new i(.2,0,.6,4),h),[0,.3,0]],[new l(new i(.2,0,.6,4),h),[0,-.3,0],[0,0,Math.PI]]],Z:[[new l(new i(.2,0,.6,4),h),[0,0,.3],[Math.PI/2,0,0]],[new l(new i(.2,0,.6,4),h),[0,0,-.3],[-Math.PI/2,0,0]]],XYZ:[[new l(new d(.2,0),h)]],XY:[[new l(new t(.2,.2,.01),h),[.15,.15,0]]],YZ:[[new l(new t(.2,.2,.01),h),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new l(new t(.2,.2,.01),h),[.15,0,.15],[-Math.PI/2,0,0]]]},A={START:[[new l(new d(.01,2),w),null,null,null,"helper"]],END:[[new l(new d(.01,2),w),null,null,null,"helper"]],DELTA:[[new a(function(){const t=new e;return t.setAttribute("position",new s([0,0,0,1,1,1],3)),t}(),w),null,null,null,"helper"]],X:[[new a(I,w.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new a(I,w.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new a(I,w.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]},z={XYZE:[[new l(Q(.5,1),_),null,[0,Math.PI/2,0]]],X:[[new l(Q(.5,.5),m)]],Y:[[new l(Q(.5,.5),u),null,[0,0,-Math.PI/2]]],Z:[[new l(Q(.5,.5),v),null,[0,Math.PI/2,0]]],E:[[new l(Q(.75,1),x),null,[0,Math.PI/2,0]]]},q={AXIS:[[new a(I,w.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]]},j={XYZE:[[new l(new y(.25,10,8),h)]],X:[[new l(new b(.5,.1,4,24),h),[0,0,0],[0,-Math.PI/2,-Math.PI/2]]],Y:[[new l(new b(.5,.1,4,24),h),[0,0,0],[Math.PI/2,0,0]]],Z:[[new l(new b(.5,.1,4,24),h),[0,0,0],[0,0,-Math.PI/2]]],E:[[new l(new b(.75,.1,2,24),h)]]},T={X:[[new l(E,m),[.5,0,0],[0,0,-Math.PI/2]],[new l(X,m),[0,0,0],[0,0,-Math.PI/2]],[new l(E,m),[-.5,0,0],[0,0,Math.PI/2]]],Y:[[new l(E,u),[0,.5,0]],[new l(X,u)],[new l(E,u),[0,-.5,0],[0,0,Math.PI]]],Z:[[new l(E,v),[0,0,.5],[Math.PI/2,0,0]],[new l(X,v),[0,0,0],[Math.PI/2,0,0]],[new l(E,v),[0,0,-.5],[-Math.PI/2,0,0]]],XY:[[new l(new t(.15,.15,.01),g),[.15,.15,0]]],YZ:[[new l(new t(.15,.15,.01),M),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new l(new t(.15,.15,.01),P),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new l(new t(.1,.1,.1),S.clone())]]},k={X:[[new l(new i(.2,0,.6,4),h),[.3,0,0],[0,0,-Math.PI/2]],[new l(new i(.2,0,.6,4),h),[-.3,0,0],[0,0,Math.PI/2]]],Y:[[new l(new i(.2,0,.6,4),h),[0,.3,0]],[new l(new i(.2,0,.6,4),h),[0,-.3,0],[0,0,Math.PI]]],Z:[[new l(new i(.2,0,.6,4),h),[0,0,.3],[Math.PI/2,0,0]],[new l(new i(.2,0,.6,4),h),[0,0,-.3],[-Math.PI/2,0,0]]],XY:[[new l(new t(.2,.2,.01),h),[.15,.15,0]]],YZ:[[new l(new t(.2,.2,.01),h),[0,.15,.15],[0,Math.PI/2,0]]],XZ:[[new l(new t(.2,.2,.01),h),[.15,0,.15],[-Math.PI/2,0,0]]],XYZ:[[new l(new t(.2,.2,.2),h),[0,0,0]]]},W={X:[[new a(I,w.clone()),[-1e3,0,0],null,[1e6,1,1],"helper"]],Y:[[new a(I,w.clone()),[0,-1e3,0],[0,0,Math.PI/2],[1e6,1,1],"helper"]],Z:[[new a(I,w.clone()),[0,0,-1e3],[0,-Math.PI/2,0],[1e6,1,1],"helper"]]};function F(t){const e=new p;for(const i in t)for(let n=t[i].length;n--;){const o=t[i][n][0].clone(),s=t[i][n][1],a=t[i][n][2],r=t[i][n][3],h=t[i][n][4];o.name=i,o.tag=h,s&&o.position.set(s[0],s[1],s[2]),a&&o.rotation.set(a[0],a[1],a[2]),r&&o.scale.set(r[0],r[1],r[2]),o.updateMatrix();const l=o.geometry.clone();l.applyMatrix4(o.matrix),o.geometry=l,o.renderOrder=1/0,o.position.set(0,0,0),o.rotation.set(0,0,0),o.scale.set(1,1,1),e.add(o)}return e}this.gizmo={},this.picker={},this.helper={},this.add(this.gizmo.translate=F(Y)),this.add(this.gizmo.rotate=F(z)),this.add(this.gizmo.scale=F(T)),this.add(this.picker.translate=F(Z)),this.add(this.picker.rotate=F(j)),this.add(this.picker.scale=F(k)),this.add(this.helper.translate=F(A)),this.add(this.helper.rotate=F(q)),this.add(this.helper.scale=F(W)),this.picker.translate.visible=!1,this.picker.rotate.visible=!1,this.picker.scale.visible=!1}updateMatrixWorld(t){const e="local"===("scale"===this.mode?"local":this.space)?this.worldQuaternion:H;this.gizmo.translate.visible="translate"===this.mode,this.gizmo.rotate.visible="rotate"===this.mode,this.gizmo.scale.visible="scale"===this.mode,this.helper.translate.visible="translate"===this.mode,this.helper.rotate.visible="rotate"===this.mode,this.helper.scale.visible="scale"===this.mode;let i=[];i=i.concat(this.picker[this.mode].children),i=i.concat(this.gizmo[this.mode].children),i=i.concat(this.helper[this.mode].children);for(let t=0;t<i.length;t++){const n=i[t];let o;if(n.visible=!0,n.rotation.set(0,0,0),n.position.copy(this.worldPosition),o=this.camera.isOrthographicCamera?(this.camera.top-this.camera.bottom)/this.camera.zoom:this.worldPosition.distanceTo(this.cameraPosition)*Math.min(1.9*Math.tan(Math.PI*this.camera.fov/360)/this.camera.zoom,7),n.scale.set(1,1,1).multiplyScalar(o*this.size/4),"helper"!==n.tag){if(n.quaternion.copy(e),"translate"===this.mode||"scale"===this.mode){const t=.99,i=.2;"X"===n.name&&Math.abs(T.copy(D).applyQuaternion(e).dot(this.eye))>t&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"Y"===n.name&&Math.abs(T.copy(O).applyQuaternion(e).dot(this.eye))>t&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"Z"===n.name&&Math.abs(T.copy(R).applyQuaternion(e).dot(this.eye))>t&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XY"===n.name&&Math.abs(T.copy(R).applyQuaternion(e).dot(this.eye))<i&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"YZ"===n.name&&Math.abs(T.copy(D).applyQuaternion(e).dot(this.eye))<i&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1),"XZ"===n.name&&Math.abs(T.copy(O).applyQuaternion(e).dot(this.eye))<i&&(n.scale.set(1e-10,1e-10,1e-10),n.visible=!1)}else"rotate"===this.mode&&(F.copy(e),T.copy(this.eye).applyQuaternion(S.copy(e).invert()),-1!==n.name.search("E")&&n.quaternion.setFromRotationMatrix(W.lookAt(this.eye,k,O)),"X"===n.name&&(S.setFromAxisAngle(D,Math.atan2(-T.y,T.z)),S.multiplyQuaternions(F,S),n.quaternion.copy(S)),"Y"===n.name&&(S.setFromAxisAngle(O,Math.atan2(T.x,T.z)),S.multiplyQuaternions(F,S),n.quaternion.copy(S)),"Z"===n.name&&(S.setFromAxisAngle(R,Math.atan2(T.y,T.x)),S.multiplyQuaternions(F,S),n.quaternion.copy(S)));n.visible=n.visible&&(-1===n.name.indexOf("X")||this.showX),n.visible=n.visible&&(-1===n.name.indexOf("Y")||this.showY),n.visible=n.visible&&(-1===n.name.indexOf("Z")||this.showZ),n.visible=n.visible&&(-1===n.name.indexOf("E")||this.showX&&this.showY&&this.showZ),n.material._color=n.material._color||n.material.color.clone(),n.material._opacity=n.material._opacity||n.material.opacity,n.material.color.copy(n.material._color),n.material.opacity=n.material._opacity,this.enabled&&this.axis&&(n.name===this.axis||this.axis.split("").some((function(t){return n.name===t})))&&(n.material.color.setHex(16776960),n.material.opacity=1)}else n.visible=!1,"AXIS"===n.name?(n.position.copy(this.worldPositionStart),n.visible=!!this.axis,"X"===this.axis&&(S.setFromEuler(j.set(0,0,0)),n.quaternion.copy(e).multiply(S),Math.abs(T.copy(D).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),"Y"===this.axis&&(S.setFromEuler(j.set(0,0,Math.PI/2)),n.quaternion.copy(e).multiply(S),Math.abs(T.copy(O).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),"Z"===this.axis&&(S.setFromEuler(j.set(0,Math.PI/2,0)),n.quaternion.copy(e).multiply(S),Math.abs(T.copy(R).applyQuaternion(e).dot(this.eye))>.9&&(n.visible=!1)),"XYZE"===this.axis&&(S.setFromEuler(j.set(0,Math.PI/2,0)),T.copy(this.rotationAxis),n.quaternion.setFromRotationMatrix(W.lookAt(k,T,O)),n.quaternion.multiply(S),n.visible=this.dragging),"E"===this.axis&&(n.visible=!1)):"START"===n.name?(n.position.copy(this.worldPositionStart),n.visible=this.dragging):"END"===n.name?(n.position.copy(this.worldPosition),n.visible=this.dragging):"DELTA"===n.name?(n.position.copy(this.worldPositionStart),n.quaternion.copy(this.worldQuaternionStart),P.set(1e-10,1e-10,1e-10).add(this.worldPositionStart).sub(this.worldPosition).multiplyScalar(-1),P.applyQuaternion(this.worldQuaternionStart.clone().invert()),n.scale.copy(P),n.visible=this.dragging):(n.quaternion.copy(e),this.dragging?n.position.copy(this.worldPositionStart):n.position.copy(this.worldPosition),this.axis&&(n.visible=-1!==this.axis.search(n.name)))}super.updateMatrixWorld(t)}}B.prototype.isTransformControlsGizmo=!0;class J extends l{constructor(){super(new w(1e5,1e5,2,2),new c({visible:!1,wireframe:!0,side:n,transparent:!0,opacity:.1,toneMapped:!1})),this.type="TransformControlsPlane"}updateMatrixWorld(t){let e=this.space;switch(this.position.copy(this.worldPosition),"scale"===this.mode&&(e="local"),N.copy(D).applyQuaternion("local"===e?this.worldQuaternion:H),U.copy(O).applyQuaternion("local"===e?this.worldQuaternion:H),G.copy(R).applyQuaternion("local"===e?this.worldQuaternion:H),T.copy(U),this.mode){case"translate":case"scale":switch(this.axis){case"X":T.copy(this.eye).cross(N),C.copy(N).cross(T);break;case"Y":T.copy(this.eye).cross(U),C.copy(U).cross(T);break;case"Z":T.copy(this.eye).cross(G),C.copy(G).cross(T);break;case"XY":C.copy(G);break;case"YZ":C.copy(N);break;case"XZ":T.copy(G),C.copy(U);break;case"XYZ":case"E":C.set(0,0,0)}break;default:C.set(0,0,0)}0===C.length()?this.quaternion.copy(this.cameraQuaternion):(L.lookAt(P.set(0,0,0),C,T),this.quaternion.setFromRotationMatrix(L)),super.updateMatrixWorld(t)}}J.prototype.isTransformControlsPlane=!0;export{X as TransformControls,B as TransformControlsGizmo,J as TransformControlsPlane};
|
2
|
+
/*
|
3
|
+
* Copyright (©) 2023. All rights reserved.
|
4
|
+
* See the LICENSE.md file for details.
|
5
|
+
*/
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { Object3D, Vector3 } from 'three';
|
2
|
+
type ObjectPredicate<T> = (obj: T) => boolean;
|
3
|
+
export declare function filterScene(scene: Object3D, predicate: ObjectPredicate<Object3D>): any[];
|
4
|
+
/**
|
5
|
+
* Only continue traverse through children if it has not yet matched.
|
6
|
+
* Use a traverse predicate to know if it chould event continue
|
7
|
+
*/
|
8
|
+
export declare function filterSceneShallow(scene: Object3D, predicate: ObjectPredicate<Object3D>, traversePredicate?: ObjectPredicate<Object3D>): Object3D[];
|
9
|
+
export declare function filterChildrenShallow<C extends {
|
10
|
+
children?: C[];
|
11
|
+
}, T extends C = C>(scene: T, predicate: ObjectPredicate<C>, traversePredicate?: ObjectPredicate<C>): C[];
|
12
|
+
export declare function calculateEffectiveScale(obj: Object3D): Vector3;
|
13
|
+
export {};
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import{Scene as e,Vector3 as t}from"three";export function filterScene(e,t){const r=[];return e.traverse((e=>{t(e)&&r.push(e)})),r}export function filterSceneShallow(e,t,r){return filterChildrenShallow(e,t,r)}export function filterChildrenShallow(t,r,n){var l;const o=[],c=[t];for(;c.length>0;){const t=c.pop();r(t)?o.push(t):(null==n||n(t)||t instanceof e)&&c.push(...null!==(l=t.children)&&void 0!==l?l:[])}return o}const r=new t;export function calculateEffectiveScale(e){return r.copy(e.scale),e.traverseAncestors((e=>{r.multiply(e.scale)})),r}
|
2
|
+
/*
|
3
|
+
* Copyright (©) 2023. All rights reserved.
|
4
|
+
* See the LICENSE.md file for details.
|
5
|
+
*/
|
@@ -0,0 +1 @@
|
|
1
|
+
export declare function randomUUID(): string;
|
@@ -0,0 +1,5 @@
|
|
1
|
+
const t=[];for(let e=0;e<256;++e)t.push((e+256).toString(16).substr(1));const n=new Uint8Array(256);let o=n.length;export function randomUUID(){const e=(o>n.length-10&&(crypto.getRandomValues(n),o=0),n.slice(o,o+=10)),r=function(){const t=100*(Date.now()+performance.now());return Math.round(t)}().toString(16);return e[0]=15&e[0]|64,e[2]=63&e[2]|128,function(n,o){return(n.slice(0,8)+"-"+n.slice(8,12)+"-"+t[o[0]]+t[o[1]]+"-"+t[o[2]]+t[o[3]]+"-"+t[o[4]]+t[o[5]]+t[o[6]]+t[o[7]]+t[o[8]]+t[o[9]]).toLowerCase()}(r,e)}
|
2
|
+
/*
|
3
|
+
* Copyright (©) 2023. All rights reserved.
|
4
|
+
* See the LICENSE.md file for details.
|
5
|
+
*/
|
package/package.json
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
{
|
2
|
+
"name": "@hology/core",
|
3
|
+
"version": "0.0.20",
|
4
|
+
"description": "",
|
5
|
+
"main": "dist/index.js",
|
6
|
+
"scripts": {
|
7
|
+
"clean": "rimraf tsconfig.tsbuildinfo dist",
|
8
|
+
"dev": "tsc --watch",
|
9
|
+
"build": "tsc",
|
10
|
+
"test": "vitest --environment jsdom",
|
11
|
+
"bump": "node scripts/bump.js",
|
12
|
+
"terse": "foreach -g \"dist/**/*.js\" -x \"mkdirp dist/#{reldir} && terser --mangle -c --module '#{path}' -o 'dist/#{reldir}/#{name}#{ext}' && cat copyright.txt >> 'dist/#{reldir}/#{name}#{ext}' && rm 'dist/#{reldir}/#{name}#{ext}.map'\""
|
13
|
+
},
|
14
|
+
"exports": {
|
15
|
+
".": "./dist/index.js",
|
16
|
+
"./rendering": "./dist/rendering.js",
|
17
|
+
"./utils/math": "./dist/utils/math.js",
|
18
|
+
"./utils/files": "./dist/utils/files.js",
|
19
|
+
"./utils/polyfill": "./dist/utils/polyfill.js",
|
20
|
+
"./utils/async": "./dist/utils/async.js",
|
21
|
+
"./utils/collections": "./dist/utils/collections.js",
|
22
|
+
"./utils/mesh": "./dist/utils/mesh.js",
|
23
|
+
"./scene/materializer": "./dist/scene/materializer.js",
|
24
|
+
"./csm": "./dist/csm.js",
|
25
|
+
"./shader/shader": "./dist/shader/shader.js",
|
26
|
+
"./shader/parameter": "./dist/shader/parameter.js",
|
27
|
+
"./shader-nodes": "./dist/shader-nodes/index.js",
|
28
|
+
"./gameplay": "./dist/gameplay/index.js",
|
29
|
+
"./gameplay/actors": "./dist/gameplay/actors/index.js",
|
30
|
+
"./gameplay/input": "./dist/gameplay/input/index.js"
|
31
|
+
},
|
32
|
+
"types": "./dist/index.d.ts",
|
33
|
+
"typesVersions": {
|
34
|
+
"*": {
|
35
|
+
"rendering": [
|
36
|
+
"./dist/rendering.d.ts"
|
37
|
+
],
|
38
|
+
"utils/math": [
|
39
|
+
"./dist/utils/math.d.ts"
|
40
|
+
],
|
41
|
+
"utils/files": [
|
42
|
+
"./dist/utils/files.d.ts"
|
43
|
+
],
|
44
|
+
"utils/polyfill": [
|
45
|
+
"./dist/utils/polyfill.d.ts"
|
46
|
+
],
|
47
|
+
"utils/async": [
|
48
|
+
"./dist/utils/async.d.ts"
|
49
|
+
],
|
50
|
+
"utils/collections": [
|
51
|
+
"./dist/utils/collections.d.ts"
|
52
|
+
],
|
53
|
+
"utils/mesh": [
|
54
|
+
"./dist/utils/mesh.d.ts"
|
55
|
+
],
|
56
|
+
"scene/materializer": [
|
57
|
+
"./dist/scene/materializer.d.ts"
|
58
|
+
],
|
59
|
+
"csm": [
|
60
|
+
"./dist/csm.d.ts"
|
61
|
+
],
|
62
|
+
"shader/shader": [
|
63
|
+
"./dist/shader/shader.d.ts"
|
64
|
+
],
|
65
|
+
"shader/parameter": [
|
66
|
+
"./dist/shader/parameter.d.ts"
|
67
|
+
],
|
68
|
+
"shader-nodes": [
|
69
|
+
"./dist/shader-nodes/index.d.ts"
|
70
|
+
],
|
71
|
+
"gameplay": [
|
72
|
+
"./dist/gameplay/index.d.ts"
|
73
|
+
],
|
74
|
+
"gameplay/actors": [
|
75
|
+
"./dist/gameplay/actors/index.d.ts"
|
76
|
+
],
|
77
|
+
"gameplay/input": [
|
78
|
+
"./dist/gameplay/input/index.d.ts"
|
79
|
+
]
|
80
|
+
}
|
81
|
+
},
|
82
|
+
"author": "",
|
83
|
+
"license": "SEE LICENSE IN LICENSE.md",
|
84
|
+
"dependencies": {
|
85
|
+
"@dimforge/rapier3d-compat": "^0.11.2",
|
86
|
+
"@plumier/reflect": "^1.1.0",
|
87
|
+
"cannon-es": "^0.20.0",
|
88
|
+
"cannon-es-debugger": "^1.0.0",
|
89
|
+
"rxjs": "7.4.0",
|
90
|
+
"stats.js": "^0.17.0",
|
91
|
+
"three": "^0.139.0",
|
92
|
+
"three-csm": "^3.2.0",
|
93
|
+
"three-mesh-bvh": "^0.4.0",
|
94
|
+
"three-nebula": "10.0.3",
|
95
|
+
"three-shader-graph": "^0.1.24",
|
96
|
+
"three-stdlib": "~2.17.3",
|
97
|
+
"ts-key-enum": "^2.0.12",
|
98
|
+
"typedi": "^0.10.0"
|
99
|
+
},
|
100
|
+
"devDependencies": {
|
101
|
+
"@babel/runtime": "^7.16.7",
|
102
|
+
"@types/node": "^20.3.1",
|
103
|
+
"@types/offscreencanvas": "^2019.7.0",
|
104
|
+
"@types/three": "^0.139.0",
|
105
|
+
"foreach-cli": "^1.8.1",
|
106
|
+
"jsdom": "^22.1.0",
|
107
|
+
"mkdirp": "^3.0.1",
|
108
|
+
"reflect-metadata": "^0.1.13",
|
109
|
+
"rimraf": "^4.1.1",
|
110
|
+
"terser": "^5.25.0",
|
111
|
+
"typescript": "~5.0.4",
|
112
|
+
"vitest": "^0.34.2"
|
113
|
+
}
|
114
|
+
}
|