@hology/core 0.0.138 → 0.0.140
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/dist/gameplay/actors/camera/third-person-camera-component.js +1 -1
- package/dist/gameplay/initiate.d.ts.map +1 -1
- package/dist/gameplay/initiate.js +1 -1
- package/dist/rendering/fog/fog-volume-actor.d.ts +1 -0
- package/dist/rendering/fog/fog-volume-actor.d.ts.map +1 -1
- package/dist/rendering/fog/fog-volume-actor.js +1 -1
- package/dist/rendering/fog/fog-volume-object.d.ts +1 -0
- package/dist/rendering/fog/fog-volume-object.d.ts.map +1 -1
- package/dist/rendering/fog/volumetric-fog-pass.d.ts +1 -0
- package/dist/rendering/fog/volumetric-fog-pass.d.ts.map +1 -1
- package/dist/rendering/fog/volumetric-fog-pass.js +1 -1
- package/dist/rendering.d.ts.map +1 -1
- package/dist/rendering.js +1 -1
- package/dist/scene/materializer.d.ts +4 -0
- package/dist/scene/materializer.d.ts.map +1 -1
- package/dist/scene/materializer.js +1 -1
- package/dist/scene/scene-data-service.js +1 -1
- package/dist/shader/builtin/standard-shader.d.ts.map +1 -1
- package/dist/shader/builtin/standard-shader.js +1 -1
- package/package.json +2 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as t,__metadata as e}from"tslib";import{ActorComponent as i,Component as s}from"../component.js";import{Vector3 as o,MathUtils as n,PerspectiveCamera as h,Object3D as r}from"three";import{ViewController as a}from"../../services/render.js";import{DecimalInput as c,RestrictedRotationInput as d}from"../../input/index.js";import{PhysicsSystem as l,RayTestResult as m}from"../../services/physics/physics-system.js";import{Parameter as p}from"../../../shader/parameter.js";import{World as f}from"../../services/world.js";import{inject as u}from"../../inject.js";import{ease as v}from"@hology/nebula";const w=void 0!==window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let k=class extends i{constructor(t,e){super(),this.viewController=t,this.physicsSystem=e,this.aspect=this.viewController.htmlElement.clientWidth/this.viewController.htmlElement.clientHeight,this.near=.5,this.far=500,this.viewAngle=w?30:45,this.camera=new h(this.viewAngle,this.aspect,this.near,this.far),this.distance=9,this.minDistance=1.5,this.maxDistance=this.distance,this.height=3,this.offsetX=-1,this.offsetZ=1.5,this.autoActivate=!0,this.bounceBackSpeed=5,this.collisionCheckRadius=.5,this.restrictedDistance=Math.max(this.distance,this.maxDistance),this.rotationInput=new d(-Math.PI/4,Math.PI/2-.7),this.zoomInput=new c(1,0,1),this.offset=new o,this.lookAtOffset=new o(this.offsetX,0,this.offsetZ),this.fixedBehind=!0,this.world=u(f),this.activated=!1,this.isMouseLocked=!1,this.prevFixedBehind=!1,this.blendDurationLeft=0,this.canvas=null,this.pointerLockInactivatedAt=null,this.onMouseDown=t=>{this.isMouseLocked||"mouse"!==t.pointerType||this.hideCursor()},this.onKeyDown=t=>{"Escape"===t.key&&this.showCursor()},this.onPointerLockChange=()=>{null!=document.pointerLockElement||null!=document.mozPointerLockElement||this.showCursor()},this.prevLookAt=new o}async onInit(){this.prevFixedBehind=this.fixedBehind,this.world.scene.add(this.camera),this.rotationInput.rotation.copy(this.actor.rotation),this.restrictedDistance=Math.max(this.distance,this.maxDistance),this.lookAtOffset.set(this.offsetX,0,this.offsetZ),this.autoActivate&&this.activate()}activate(){this.activated=!0,this.viewController.setCamera(this.camera);const t=this.element;null!=document.body.requestPointerLock&&(t.addEventListener("pointerdown",this.onMouseDown),t.addEventListener("keydown",this.onKeyDown),document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),this.disposed.subscribe(()=>{t.removeEventListener("pointerdown",this.onMouseDown),t.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1)}))}onLateUpdate(t){this.activated&&this.setFromRotation(t)}get element(){return this.viewController.htmlElement}hideCursor(){null!=this.pointerLockInactivatedAt&&performance.now()-this.pointerLockInactivatedAt<1600||(this.element.style.cursor="none",null==this.canvas&&(this.canvas=this.element.getElementsByTagName("canvas")[0]),this.canvas&&(this.canvas.requestPointerLock(),this.isMouseLocked=!0))}showCursor(){this.pointerLockInactivatedAt=performance.now(),this.element.style.cursor="default",window.document.exitPointerLock(),this.isMouseLocked=!1}setFromRotation(t){this.lookAtOffset.set(this.offsetX,0,this.offsetZ),this.fixedBehind!==this.prevFixedBehind?(this.blendDurationLeft=1,this.prevFixedBehind=this.fixedBehind):this.blendDurationLeft>0&&(this.blendDurationLeft-=t),this.checkForCollision(t);const e=n.clamp(Math.min(this.restrictedDistance,this.distance),Math.min(this.minDistance,this.restrictedDistance),Math.max(this.distance*this.zoomInput.value,this.minDistance)),i=Math.cos(this.rotationInput.rotation.x)*e,s=this.fixedBehind?0:this.rotationInput.rotation.y;this.offset.x=Math.sin(-s)*i,this.offset.y=Math.sin(this.rotationInput.rotation.x)*e+2,this.offset.z=Math.cos(-s)*-i,this.fixedBehind&&this.offset.add(this.lookAtOffset),this.updateCameraPosition()}checkForCollision(t){const e=this.getLookAtPosition(),i=x;let s=!1,o=this.distance;const h=new m,r=this.camera.getWorldPosition(A);for(let t=-1;t<=1;t++){const n=g.subVectors(r,e);i.copy(r).add(n.multiplyScalar(1.2)),i.x+=t*this.collisionCheckRadius,this.physicsSystem.rayTest(e,i,h,{debugLifetime:0,excludeActor:this.actor,excludeTriggers:!0}),h.hasHit&&h.distance<this.distance&&(o=Math.min(h.distance,o),s||(s=h.hasHit))}s
|
|
1
|
+
import{__decorate as t,__metadata as e}from"tslib";import{ActorComponent as i,Component as s}from"../component.js";import{Vector3 as o,MathUtils as n,PerspectiveCamera as h,Object3D as r}from"three";import{ViewController as a}from"../../services/render.js";import{DecimalInput as c,RestrictedRotationInput as d}from"../../input/index.js";import{PhysicsSystem as l,RayTestResult as m}from"../../services/physics/physics-system.js";import{Parameter as p}from"../../../shader/parameter.js";import{World as f}from"../../services/world.js";import{inject as u}from"../../inject.js";import{ease as v}from"@hology/nebula";const w=void 0!==window&&/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let k=class extends i{constructor(t,e){super(),this.viewController=t,this.physicsSystem=e,this.aspect=this.viewController.htmlElement.clientWidth/this.viewController.htmlElement.clientHeight,this.near=.5,this.far=500,this.viewAngle=w?30:45,this.camera=new h(this.viewAngle,this.aspect,this.near,this.far),this.distance=9,this.minDistance=1.5,this.maxDistance=this.distance,this.height=3,this.offsetX=-1,this.offsetZ=1.5,this.autoActivate=!0,this.bounceBackSpeed=5,this.collisionCheckRadius=.5,this.restrictedDistance=Math.max(this.distance,this.maxDistance),this.rotationInput=new d(-Math.PI/4,Math.PI/2-.7),this.zoomInput=new c(1,0,1),this.offset=new o,this.lookAtOffset=new o(this.offsetX,0,this.offsetZ),this.fixedBehind=!0,this.world=u(f),this.activated=!1,this.isMouseLocked=!1,this.prevFixedBehind=!1,this.blendDurationLeft=0,this.canvas=null,this.pointerLockInactivatedAt=null,this.onMouseDown=t=>{this.isMouseLocked||"mouse"!==t.pointerType||this.hideCursor()},this.onKeyDown=t=>{"Escape"===t.key&&this.showCursor()},this.onPointerLockChange=()=>{null!=document.pointerLockElement||null!=document.mozPointerLockElement||this.showCursor()},this.prevLookAt=new o}async onInit(){this.prevFixedBehind=this.fixedBehind,this.world.scene.add(this.camera),this.rotationInput.rotation.copy(this.actor.rotation),this.restrictedDistance=Math.max(this.distance,this.maxDistance),this.lookAtOffset.set(this.offsetX,0,this.offsetZ),this.autoActivate&&this.activate()}activate(){this.activated=!0,this.viewController.setCamera(this.camera);const t=this.element;null!=document.body.requestPointerLock&&(t.addEventListener("pointerdown",this.onMouseDown),t.addEventListener("keydown",this.onKeyDown),document.addEventListener("pointerlockchange",this.onPointerLockChange,!1),this.disposed.subscribe(()=>{t.removeEventListener("pointerdown",this.onMouseDown),t.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("pointerlockchange",this.onPointerLockChange,!1)}))}onLateUpdate(t){this.activated&&this.setFromRotation(t)}get element(){return this.viewController.htmlElement}hideCursor(){null!=this.pointerLockInactivatedAt&&performance.now()-this.pointerLockInactivatedAt<1600||(this.element.style.cursor="none",null==this.canvas&&(this.canvas=this.element.getElementsByTagName("canvas")[0]),this.canvas&&(this.canvas.requestPointerLock(),this.isMouseLocked=!0))}showCursor(){this.pointerLockInactivatedAt=performance.now(),this.element.style.cursor="default",window.document.exitPointerLock(),this.isMouseLocked=!1}setFromRotation(t){this.lookAtOffset.set(this.offsetX,0,this.offsetZ),this.fixedBehind!==this.prevFixedBehind?(this.blendDurationLeft=1,this.prevFixedBehind=this.fixedBehind):this.blendDurationLeft>0&&(this.blendDurationLeft-=t),this.checkForCollision(t);const e=n.clamp(Math.min(this.restrictedDistance,this.distance),Math.min(this.minDistance,this.restrictedDistance),Math.max(this.distance*this.zoomInput.value,this.minDistance)),i=Math.cos(this.rotationInput.rotation.x)*e,s=this.fixedBehind?0:this.rotationInput.rotation.y;this.offset.x=Math.sin(-s)*i,this.offset.y=Math.sin(this.rotationInput.rotation.x)*e+2,this.offset.z=Math.cos(-s)*-i,this.fixedBehind&&this.offset.add(this.lookAtOffset),this.updateCameraPosition()}checkForCollision(t){const e=this.getLookAtPosition(),i=x;let s=!1,o=this.distance;const h=new m,r=this.camera.getWorldPosition(A);for(let t=-1;t<=1;t++){const n=g.subVectors(r,e);i.copy(r).add(n.multiplyScalar(1.2)),i.x+=t*this.collisionCheckRadius,this.physicsSystem.rayTest(e,i,h,{debugLifetime:0,excludeActor:this.actor,excludeTriggers:!0}),h.hasHit&&h.distance<this.distance&&(o=Math.min(h.distance,o),s||(s=h.hasHit))}this.restrictedDistance=s?Math.min(o,this.distance):n.lerp(this.restrictedDistance,this.distance,n.clamp(this.bounceBackSpeed*t,0,1))}getLookAtPosition(){const t=L;return t.set(0,0,0),t.y=this.height,this.fixedBehind&&t.add(this.lookAtOffset),t.applyMatrix4(this.actor.object.matrixWorld),t}updateCameraPosition(){this.fixedBehind?(y.position.set(this.offset.x,this.offset.y,this.offset.z),y.rotation.set(0,0,0),y.scale.set(1,1,1),y.applyMatrix4(this.actor.object.matrix)):y.position.copy(this.actor.position).add(this.offset);const t=v.easeInOutCubic(1-this.blendDurationLeft);this.blendDurationLeft>0?this.camera.position.lerp(y.position,t):this.camera.position.copy(y.position);const e=this.getLookAtPosition();this.blendDurationLeft>0?(this.prevLookAt.lerp(e,t),this.camera.lookAt(this.prevLookAt)):(this.camera.lookAt(e),this.prevLookAt.copy(e))}};t([p(),e("design:type",Number)],k.prototype,"near",void 0),t([p(),e("design:type",Number)],k.prototype,"far",void 0),t([p(),e("design:type",Number)],k.prototype,"viewAngle",void 0),k=t([s(),e("design:paramtypes",[a,l])],k);export{k as ThirdPersonCameraComponent};const y=new r,L=new o,x=new o,g=(new o,new o),A=new o;export class ThirdPartyCameraComponent extends k{}/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"initiate.d.ts","sourceRoot":"","sources":["../../src/gameplay/initiate.ts"],"names":[],"mappings":"AAAA,OAAkB,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAA;AAEpE,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAA;AAa3C,OAAO,EAAE,UAAU,EAAW,MAAM,MAAM,CAAA;AAM1C,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAE/C,KAAK,SAAS,CAAC,CAAC,IAAI,aAAa,CAAC,CAAC,CAAC,CAAA;AAGpC,MAAM,MAAM,kBAAkB,GAAG;IAC/B,OAAO,EAAE,WAAW,CAAA;IACpB,SAAS,EAAE,MAAM,CAAA;IACjB,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE;QAAE,CAAC,IAAI,EAAE,MAAM,GAAG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U,CAAC,IAAI,CAAC,CAAsB;IAC9D,OAAO,CAAC,SAAS,CAA2B;IAC5C;;OAEG;IACH,SAAgB,KAAK,mBAA8D;gBAGzE,iBAAiB,EAAE,iBAAiB;IAE9C,QAAQ,IAAI,KAAK;IAIjB,UAAU,CAAC,CAAC,EAAE,WAAW,EAAE,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC;IAI/C;;OAEG;IACH,QAAQ;CA6BT"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import e from"typedi";import{loadScene as t}from"../scene/bootstrap.js";import{ActorFactory as n}from"./actors/factory.js";import{World as
|
|
1
|
+
import e from"typedi";import{loadScene as t}from"../scene/bootstrap.js";import{ActorFactory as n}from"./actors/factory.js";import{World as r}from"./services/world.js";import{SceneMaterializer as s}from"../scene/materializer.js";import{ViewController as o}from"./services/render.js";import{RenderingView as i}from"../rendering.js";import{PhysicsSystem as a}from"./services/physics/physics-system.js";import{MeshComponent as c}from"./actors/builtin/components/mesh-component.js";import{activeContainerInstance as m}from"./actors/internal/container-map.js";import{InputService as d}from"./input/index.js";import{RuntimeAssetsService as l}from"../scene/runtime-asset-service.js";import{AssetResourceLoader as p}from"../scene/asset-resource-loader.js";import{AssetLoader as h}from"./services/asset-loader.js";import{polyfillClient as u}from"./polyfill.js";import{Subject as f}from"rxjs";import{PointerEvents as w}from"./services/pointer-events.js";import{RuntimeBundledBackendService as g}from"../scene/runtime-bundled-backend-service.js";import{Scene as j}from"three";import{ShaderProvider as v}from"./services/shader-provider.js";import{SceneDataService as b}from"../scene/scene-data-service.js";export function initiateGame(d,f){if(u(),0!=f.element.childNodes.length)return console.error("Can not initialize the game with a non-empty html element"),null;e.has(o);const S=e.of("default"),y=new HologyRuntime(S),I=new n(S,{inEditor:!1});var x;e.set(n,I),x=f.element,Object.assign(x.style,{position:"absolute",top:"0",left:"0",width:"100%",height:"100%",overflow:"hidden"});const D=new i(f.element,{enableXR:!0===f.xr?.enabled,maxPixelRatio:f.rendering?.maxPixelRatio,bloom:{enabled:!1!==f?.rendering?.bloom?.enabled},reflection:{enabled:!1!==f?.rendering?.reflection?.enabled}});D.renderer.shadowMap.enabled=f.rendering?.shadows?.enabled??!0,D.renderer.shadowMap.autoUpdate=f.rendering?.shadows?.autoUpdate??!0,null!=f?.rendering?.resolutionScale&&(D.resolutionScale=f.rendering.resolutionScale),D.renderer.debug.checkShaderErrors=!1,e.set(i,D);const R=new o(D);e.set(o,R);const G=new g,P=new l(G),z=new p;z.setDataDir(f.dataDir),z.initKtx2(D.renderer);const H=Object.entries(f.shaders).map(([e,t])=>({name:e,type:t})),M=Object.entries(f.actors).map(([e,t])=>({name:e,type:t})),O=new v(H);e.set(v,O);const W=new h(z,P,H);e.set(h,W);const k=new j,A=new s(k,new b,P,z,D,H,M,I);e.set(s,A);const E=e.get(r);return e.set(r,E),E.materializer=A,(async()=>{const n=e.get(a);if(await n.start(),y.isShutdown)return;if(await G.preloadData(),y.isShutdown)return;E.scene=k;const{scene:r,actors:s}=await t(D,f.sceneName,f.dataDir,f.shaders,f.actors,I,G,P,z,{detailTier:f.detailTier});E.scene=r,n.scene=E.scene;for(const e of k.children)E.scene.add(e);if(y.isShutdown)return void D.stop();e.import([c]);for(const e of s)E.addActor(e);n.addFromScene(r),D.loop(e=>{}),y.status=5,m.value=S,S.remove(d),S.set({id:d,type:d});const o=S.get(d);m.value=null,y.gameInstance=o,S.get(w).start(),o instanceof GameInstance&&await o.onStart(),y._resolver(!0)})(),y}export class GameInstance{onStart(){}onShutdown(){}}export function createHologyScene(){}export class HologyRuntime{constructor(e){this.containerInstance=e,this.status=0,this.isShutdown=!1,this.shutdownStarted=new f,this.ready=new Promise(e=>{this._resolver=e})}getWorld(){return this.containerInstance.get(r)}getService(e){return this.containerInstance.get(e)}shutdown(){this.isShutdown=!0,this.shutdownStarted.next(),this.gameInstance instanceof GameInstance&&this.gameInstance.onShutdown(),this.containerInstance.get(d).stop();const e=this.containerInstance.get(i);e?.stop();const t=this.containerInstance.get(o);t.setMuted(!0),t.audioListener.removeFromParent();for(const e of this.getWorld().actors)this.getWorld().removeActor(e);this.containerInstance.get(a).stop(),this.containerInstance.get(s).dispose(),this.containerInstance.get(w).stop(),this.containerInstance.reset()}}/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fog-volume-actor.d.ts","sourceRoot":"","sources":["../../../src/rendering/fog/fog-volume-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAY,MAAM,OAAO,CAAC;AACxC,OAAO,EAAiB,SAAS,EAAa,MAAM,gBAAgB,CAAC;AAIrE,qBACa,SAAU,SAAQ,SAAS;IAGtC,WAAW,EAAE,MAAM,CAAM;IAGzB,aAAa,EAAE,MAAM,CAAI;IAGzB,YAAY,EAAE,MAAM,CAAI;IAGxB,sBAAsB,EAAE,MAAM,CAAI;IAGlC,MAAM,EAAE,KAAK,CAAoB;IAEjC,OAAO,CAAC,MAAM,CAEZ;IAEF,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;CAI/B"}
|
|
1
|
+
{"version":3,"file":"fog-volume-actor.d.ts","sourceRoot":"","sources":["../../../src/rendering/fog/fog-volume-actor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAY,MAAM,OAAO,CAAC;AACxC,OAAO,EAAiB,SAAS,EAAa,MAAM,gBAAgB,CAAC;AAIrE,qBACa,SAAU,SAAQ,SAAS;IAGtC,WAAW,EAAE,MAAM,CAAM;IAGzB,aAAa,EAAE,MAAM,CAAI;IAGzB,YAAY,EAAE,MAAM,CAAI;IAGxB,aAAa,EAAE,MAAM,CAAI;IAGzB,sBAAsB,EAAE,MAAM,CAAI;IAGlC,MAAM,EAAE,KAAK,CAAoB;IAEjC,OAAO,CAAC,MAAM,CAEZ;IAEF,MAAM,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;CAI/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{__decorate as t,__metadata as e}from"tslib";import{Color as i}from"three";import{Actor as o,attach as s,BaseActor as r,Parameter as p}from"../../gameplay";import{FogVolumeObject as n}from"./fog-volume-object";import{EditorSpriteComponent as
|
|
1
|
+
import{__decorate as t,__metadata as e}from"tslib";import{Color as i}from"three";import{Actor as o,attach as s,BaseActor as r,Parameter as p}from"../../gameplay";import{FogVolumeObject as n}from"./fog-volume-object";import{EditorSpriteComponent as a}from"../../gameplay/actors/builtin/components/editor-sprite-component";let m=class extends r{constructor(){super(...arguments),this.baseDensity=.5,this.heightFalloff=1,this.heightOffset=0,this.startDistance=3,this.scatteringDistribution=0,this.albedo=new i(1,1,.6),this.sprite=s(a,{file:"assets/cloud-icon.webp"})}onInit(){this.object.add(new n(this))}};t([p({range:[0,5],stepSize:.01}),e("design:type",Number)],m.prototype,"baseDensity",void 0),t([p(),e("design:type",Number)],m.prototype,"heightFalloff",void 0),t([p(),e("design:type",Number)],m.prototype,"heightOffset",void 0),t([p(),e("design:type",Number)],m.prototype,"startDistance",void 0),t([p({range:[-1,1]}),e("design:type",Number)],m.prototype,"scatteringDistribution",void 0),t([p(),e("design:type",i)],m.prototype,"albedo",void 0),m=t([o()],m);export{m as FogVolume};/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fog-volume-object.d.ts","sourceRoot":"","sources":["../../../src/rendering/fog/fog-volume-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAGtC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,QAAQ,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,MAAM,EAAE,KAAK,CAAA;CACd,CAAA"}
|
|
1
|
+
{"version":3,"file":"fog-volume-object.d.ts","sourceRoot":"","sources":["../../../src/rendering/fog/fog-volume-object.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAGtC,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,QAAQ,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,aAAa,EAAE,MAAM,CAAA;IACrB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,sBAAsB,EAAE,MAAM,CAAA;IAC9B,MAAM,EAAE,KAAK,CAAA;CACd,CAAA"}
|
|
@@ -20,6 +20,7 @@ export declare class VolumetricFogPass extends Pass {
|
|
|
20
20
|
get volumetric(): boolean;
|
|
21
21
|
private getVolumeUniforms;
|
|
22
22
|
private getPointLightUniforms;
|
|
23
|
+
private getSpotLightUniforms;
|
|
23
24
|
private updateArrayUniforms;
|
|
24
25
|
private _viewProjection;
|
|
25
26
|
private _invViewProjection;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"volumetric-fog-pass.d.ts","sourceRoot":"","sources":["../../../src/rendering/fog/volumetric-fog-pass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAA0C,YAAY,EAAE,KAAK,EAAW,aAAa,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAEvI,OAAO,EAAE,GAAG,EAAkB,IAAI,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"volumetric-fog-pass.d.ts","sourceRoot":"","sources":["../../../src/rendering/fog/volumetric-fog-pass.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,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";import{Matrix4 as t,PerspectiveCamera as n,PointLight as i,Vector3 as a,WebGLRenderTarget as o}from"three";import{FullScreenQuad as r,Pass as l}from"three/examples/jsm/Addons.js";import{ambientLightName as s}from"../../scene/sky.js";import{FogVolumeObject as h}from"./fog-volume-object";const c=new a;export class VolumetricFogPass extends l{constructor(n){super(),this.resolution=n,this.fsQuad=new r(null),this.downSampleRatio=4,this._oldClearColor=new e.Color,this.oldClearAlpha=1,this.volumesCache=new WeakMap,this._viewProjection=new t,this._invViewProjection=new t;const i={minFilter:e.LinearFilter,magFilter:e.LinearFilter,format:e.RGBAFormat,depthBuffer:!1,stencilBuffer:!1},l=Math.round(this.resolution.x/this.downSampleRatio),s=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetFog=new o(l,s,i),this.renderTargetFog.texture.generateMipmaps=!1,this.renderTargetBlur=new o(l,s,i),this.renderTargetBlur.texture.generateMipmaps=!1,this.material=new e.ShaderMaterial({defines:{PERSPECTIVE_CAMERA:1,NUM_FOG_VOLUMES:0,MAX_POINT_LIGHTS:8,VOLUMETRIC:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},cameraPos:{value:new a},cameraMatrix:{value:new t},invProjection:{value:new t},fogVolumes:{value:[]},stepCount:{value:30},cameraNear:{value:null},cameraFar:{value:null},nearMinDistance:{value:3},pointLights:{value:new Array(8).fill(null).map(()=>({color:new a(0,0,0),distance:0,position:new a}))},activePointLightCount:{value:0},directionalLight:{value:{direction:new a(0,-1,1).normalize(),color:new a(1,1,1)}},ambientLight:{value:new a(1,1,1).multiplyScalar(1.35)},directionalShadowMatrix:{value:new t},directionalShadowMap:{value:null}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n }\n ",fragmentShader:"\n #define MAX_STEP_COUNT 64\n\n #if MAX_POINT_LIGHTS > 0\n struct PointLight {\n\t\t\tvec3 position;\n vec3 color;\n float distance;\n\t\t};\n #endif\n\n struct DirectionalLight {\n vec3 color; // pre multiplied with intensity\n vec3 direction; // should point *from the light*, normalized\n };\n\n struct FogVolume {\n vec3 sphereCenter;\n float sphereRadius;\n float baseDensity;\n float heightFalloff;\n float heightOffset;\n float scatteringDistribution;\n vec3 albedo;\n };\n\n varying vec2 vUv;\n uniform sampler2D tDiffuse;\n uniform vec3 cameraPos;\n\n uniform float stepCount;\n uniform float nearMinDistance;\n\n uniform mat4 cameraMatrix;\n uniform mat4 invProjection;\n uniform sampler2D tDepth;\n\t\tuniform float cameraNear;\n\t\tuniform float cameraFar;\n \n uniform DirectionalLight directionalLight;\n\n uniform mat4 directionalShadowMatrix;\n uniform sampler2D directionalShadowMap;\n\n uniform vec3 ambientLight;\n\n #if NUM_FOG_VOLUMES > 0\n uniform FogVolume fogVolumes[ NUM_FOG_VOLUMES ];\n #endif\n #if MAX_POINT_LIGHTS > 0\n uniform PointLight pointLights[ MAX_POINT_LIGHTS ];\n uniform int activePointLightCount;\n #endif\n\n #include <packing>\n\n // Ray-sphere intersection\n bool intersectSphere(vec3 rayOrigin, vec3 rayDir, vec3 sphereCenter, float sphereRadius, out float t0, out float t1) {\n // Vector from ray origin to sphere center\n vec3 L = rayOrigin - sphereCenter;\n float a = dot(rayDir, rayDir); // should be 1 if rayDir is normalized\n float b = 2.0 * dot(rayDir, L);\n float c = dot(L, L) - sphereRadius * sphereRadius;\n \n float discriminant = b * b - 4.0 * a * c;\n if (discriminant < 0.0) {\n return false; // no intersection\n }\n \n float sqrtD = sqrt(discriminant);\n t0 = (-b - sqrtD) / (2.0 * a);\n t1 = (-b + sqrtD) / (2.0 * a);\n \n // Make sure t0 <= t1\n if (t0 > t1) {\n float tmp = t0;\n t0 = t1;\n t1 = tmp;\n }\n return true;\n }\n\n float getLinearDepth( const in vec2 uv ) {\n\n float fragCoordZ = texture2D( tDepth, uv ).x;\n return perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n\n\t\t}\n\n float linearizeDepth(float depth) {\n float z = depth * 2.0 - 1.0; // back to NDC (-1..1)\n return (2.0 * cameraNear * cameraFar) / (cameraFar + cameraNear - z * (cameraFar - cameraNear));\n }\n\n\n\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n\n vec3 calcDirectionalLight(vec3 p, vec3 rayDir, float g, DirectionalLight dirLight) {\n vec3 toLight = dirLight.direction; // direction from sample point to light\n float cosTheta = dot(toLight, -rayDir); // angle between view ray and light\n cosTheta = clamp(cosTheta, -1.0, 1.0); // keep it safe\n\n // phase function (Henyey-Greenstein or isotropic)\n float denom = 1.0 + g*g - 2.0*g*cosTheta;\n float phase = (1.0 - g*g) / (4.0 * 3.14159265 * pow(denom, 1.5));\n phase *= 3.0 * 3.14159265; // scale to total energy\n\n vec4 shadowCoord = directionalShadowMatrix * vec4(p, 1.0);\n shadowCoord.xyz /= shadowCoord.w; // perspective divide\n\n float bias = 0.0; \n float inShadow = texture2DCompare(directionalShadowMap, shadowCoord.xy, shadowCoord.z - bias);\n\n return dirLight.color * phase * inShadow;\n }\n\n vec3 calcPointLight(vec3 p, vec3 rayDir, float g, PointLight pointLight) {\n vec3 lightPos = pointLight.position;\n vec3 lightColor = pointLight.color;\n float lightRadius = pointLight.distance;\n\n vec3 L = normalize(lightPos - p);\n float lightDist = length(lightPos - p);\n \n float attenuation = clamp(1.0 - lightDist / lightRadius, 0.0, 1.0);\n attenuation *= attenuation; // smoother falloff\n attenuation /= (1.0 + lightDist*lightDist); // inverse-square style\n\n attenuation *= 4.0 * 3.14159; // Manually scaled to match point light intensity\n // float attenuation = 1.0 / (4.0 * 3.14159 * lightDist * lightDist);\n\n\n float cosTheta = dot(L, -rayDir); // angle between light and view ray\n float phase = (1.0 - g*g) / pow(1.0 + g*g - 2.0*g*cosTheta, 1.5);\n phase *= 0.25 / 3.14159; // normalize\n\n // Intensity is part of color\n vec3 light = lightColor * attenuation * phase;\n return light;\n }\n\n float random01(vec2 p) {\n return fract(sin(dot(p, vec2(41.0, 289.0))) * 45758.5453);\n }\n\n void main() {\n // reconstruct ray in world space\n vec2 ndc = vUv * 2.0 - 1.0;\n vec4 nearPoint = invProjection * vec4(ndc, -1.0, 1.0);\n nearPoint /= nearPoint.w;\n vec4 farPoint = invProjection * vec4(ndc, 1.0, 1.0);\n farPoint /= farPoint.w;\n\n vec3 rayOrigin = cameraPos;\n vec3 rayDir = normalize(farPoint.xyz - cameraPos);\n\n float sceneDepth = -getLinearDepth(vUv); // in view space\n\n // vec4 scenePosView = invProjection * vec4(ndc, sceneDepth * 2.0 - 1.0, 1.0);\n // scenePosView /= scenePosView.w;\n\n // distance from camera to surface\n // float sceneDist = length(scenePosView.xyz - cameraPosition);\n\n float transmittance = 1.0;\n vec3 inscatter = vec3(0.0);\n float random = random01(vUv);\n\n\n #if NUM_FOG_VOLUMES > 0\n for (int v = 0; v < NUM_FOG_VOLUMES; v++) {\n FogVolume volume = fogVolumes[v];\n vec3 sphereCenter = volume.sphereCenter;\n float sphereRadius = volume.sphereRadius;\n float heightFalloff = volume.heightFalloff;\n float heightOffset = volume.heightOffset;\n float baseDensity = volume.baseDensity;\n float g = volume.scatteringDistribution;\n\n float t0, t1;\n if (!intersectSphere(rayOrigin, rayDir, sphereCenter, sphereRadius, t0, t1) || t1 <= 0.0) {\n continue;\n }\n // if camera inside sphere\n t0 = max(t0, 0.0);\n\n // An alternative method to get stepSize but is less dynamic\n // float stepSize = (t1 - t0) / float(MAX_STEP_COUNT);\n\n float maxStepSize = 0.5; // adjust for visual quality\n float distance = t1 - t0;\n int stepCount = int(ceil(distance / maxStepSize));\n stepCount = min(stepCount, MAX_STEP_COUNT); // optional clamp for performance\n float stepSize = distance / float(stepCount);\n \n // Add a slight random offset to reduce banding \n float jitterAmount = 1.0;\n float rayStartOffset = random * stepSize * jitterAmount;\n t0 += rayStartOffset;\n\n for (int i = 0; i < stepCount; i++) {\n\n float t = t0 + float(i) * stepSize;\n vec3 p = rayOrigin + rayDir * t;\n\n float geomDelta = sceneDepth - t; // how far fog sample is from hitting geometry\n float fade = clamp(geomDelta, 0.0, 1.0); \n // float fade = clamp((sceneDepth - t) / 0.1, 0.0, 1.0);\n\n float closeFade = smoothstep(0.0, 0.3, (t - nearMinDistance) / t);\n float edgeFade = clamp(sphereRadius - length(p - sphereCenter), 0.0, 1.0);\n\n // density with exponential height falloff\n float h = p.y - (sphereCenter.y + heightOffset);\n float heightFactor = clamp(exp(-h * heightFalloff), 0.0, 1.0);\n float density = baseDensity * heightFactor * fade * closeFade * edgeFade;\n\n\n vec3 light = vec3(0.0); // simple white light\n #if VOLUMETRIC == 1\n\n #if MAX_POINT_LIGHTS > 0\n for (int pi = 0; pi < activePointLightCount; pi++) {\n light += calcPointLight(p, rayDir, g, pointLights[pi]);\n } \n #endif\n\n light += calcDirectionalLight(p, rayDir, g, directionalLight);\n\n // Ambient \n light += ambientLight / 12.0;\n #else\n light = vec3(1.0);\n #endif\n\n light *= volume.albedo;\n\n inscatter += transmittance * light * density * stepSize;\n transmittance *= exp(-density * stepSize);\n }\n }\n #endif\n\n float alpha = 1.0 - transmittance;\n // inscatter += ambientLight * alpha;\n\n vec3 color = inscatter;\n\n gl_FragColor = vec4(color, alpha);\n }\n "}),this.material.onBeforeCompile=e=>{console.log("compile material",e)},this.materialBlur=new e.ShaderMaterial({uniforms:{tInput:{value:null},tDepth:{value:null},texelSize:{value:new e.Vector2(1,1)},direction:{value:new e.Vector2(1,0)},depthSigma:{value:2},blurSigma:{value:2}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D tInput;\n uniform sampler2D tDepth;\n uniform vec2 texelSize;\n uniform vec2 direction;\n uniform float depthSigma;\n uniform float blurSigma;\n varying vec2 vUv;\n\n #include <packing>\n\n void main() {\n // float centerDepth = texture2D(tDepth, vUv).r;\n\n float centerDepth = unpackRGBAToDepth( texture2D( tDepth, vUv ) );\n vec4 center = texture2D(tInput, vUv);\n vec4 centerColor = center;\n\n vec4 sum = vec4(0.0);\n float wsum = 0.0;\n\n // int radius = int(ceil(2.0 * blurSigma));\n\n for (int i = -5; i <= 5; i++) {\n // if (i > radius || i < -radius) continue;\n\n vec2 offset = direction * float(i) / 1000.0;\n vec2 uv = vUv + offset;\n\n vec4 sampleColor = texture2D(tInput, uv);\n float sampleDepth = unpackRGBAToDepth( texture2D( tDepth, uv ) );\n\n float spatialWeight = exp(-0.5 * (float(i) * float(i)) / (blurSigma * blurSigma));\n float depthDiff = abs(sampleDepth - centerDepth) * 100.0;\n float depthWeight = exp(-0.5 * (depthDiff * depthDiff) / (depthSigma * depthSigma));\n\n float w = spatialWeight * depthWeight;\n\n sum += sampleColor * w;\n wsum += w;\n }\n\n gl_FragColor = sum / wsum;\n }\n ",transparent:!0}),this.materialComposite=new e.ShaderMaterial({uniforms:{tDiffuse:{value:null},tFog:{value:null}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tFog;\n varying vec2 vUv;\n void main() {\n vec4 sceneColor = texture2D(tDiffuse, vUv);\n vec4 fogColor = texture2D(tFog, vUv);\n // Composite: fogColor.a is the fog alpha, blend over scene\n // vec3 color = mix(sceneColor.rgb, fogColor.rgb, fogColor.a);\n // Not sure why multipling alpha like this helps but it is necessary to avoid a dark\n // borders around the fog\n gl_FragColor = vec4(fogColor.rgb + (1.0 - fogColor.a * fogColor.a) * sceneColor.rgb, 1.0);\n }\n ",transparent:!0})}render(e,t,n){e.getClearColor(this._oldClearColor),this.oldClearAlpha=e.getClearAlpha();const i=e.autoClear;e.autoClear=!1,e.setClearColor(16777215,0),this.fsQuad.material=this.material,e.setRenderTarget(this.renderTargetFog),e.clear(),this.fsQuad.render(e),this.materialBlur.uniforms.tInput.value=this.renderTargetFog.texture,this.materialBlur.uniforms.direction.value=u,this.fsQuad.material=this.materialBlur,e.setRenderTarget(this.renderTargetBlur),e.clear(),this.fsQuad.render(e),this.materialBlur.uniforms.tInput.value=this.renderTargetBlur.texture,this.materialBlur.uniforms.direction.value=f,e.setRenderTarget(this.renderTargetFog),e.clear(),this.fsQuad.render(e),this.materialComposite.uniforms.tDiffuse.value=n.texture,this.materialComposite.uniforms.tFog.value=this.renderTargetFog.texture,this.fsQuad.material=this.materialComposite,this.renderToScreen?(e.setRenderTarget(null),this.fsQuad.render(e)):(e.setRenderTarget(t),this.clear&&e.clear(),this.fsQuad.render(e)),e.setClearColor(this._oldClearColor,this.oldClearAlpha),e.autoClear=i}setSize(e,t){let n=Math.round(e/this.downSampleRatio),i=Math.round(t/this.downSampleRatio);this.renderTargetFog.setSize(n,i),this.renderTargetBlur.setSize(n,i)}set volumetric(e){this.material.defines.VOLUMETRIC=e?1:0}get volumetric(){return!!this.material.defines.VOLUMETRIC}getVolumeUniforms(e){let t=this.volumesCache.get(e);return null==t&&(t={albedo:new a,baseDensity:e.baseDensity,heightFalloff:e.heightFalloff,heightOffset:e.heightOffset,scatteringDistribution:e.scatteringDistribution,sphereRadius:1,sphereCenter:new a},this.volumesCache.set(e,t)),e.object.getWorldPosition(t.sphereCenter),e.object.getWorldScale(c),t.sphereRadius=5*c.x,t.albedo.set(e.albedo.r,e.albedo.g,e.albedo.b),t.baseDensity=e.baseDensity,t.heightFalloff=e.heightFalloff,t.heightOffset=e.heightOffset,t.scatteringDistribution=e.scatteringDistribution,t}getPointLightUniforms(e){const t={position:new a,color:new a,distance:0};return e.getWorldPosition(t.position),t.color.set(e.color.r,e.color.g,e.color.b).multiplyScalar(e.intensity),t.distance=void 0!==e.distance&&e.distance>0?e.distance:1,t}updateArrayUniforms(e){const t=this.material.uniforms.fogVolumes.value;let n=0;const a=this.material.uniforms.pointLights.value;let o=0;e.traverseVisible(e=>{if(e instanceof h){const i=e.volume,a=this.getVolumeUniforms(i);t[n]=a,n++}else if(e instanceof i&&o<a.length){const t=this.getPointLightUniforms(e);a[o].position.copy(t.position),a[o].color.copy(t.color),a[o].distance=t.distance,o++}}),this.material.uniforms.activePointLightCount.value=o,this.material.defines.NUM_FOG_VOLUMES!==n&&(this.material.needsUpdate=!0,this.material.uniformsNeedUpdate=!0),this.material.defines.NUM_FOG_VOLUMES=n}get uniforms(){return this.material.uniforms}update(e,t,i,o){if(this.updateArrayUniforms(o),this.enabled=0!=this.material.defines.NUM_FOG_VOLUMES,!this.enabled)return;null==this.uniforms.cameraPosition&&(this.uniforms.cameraPos={value:new a}),this.uniforms.cameraPos.value.copy(e.position),this._viewProjection.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this.uniforms.invProjection.value.copy(this._invViewProjection.copy(this._viewProjection).invert()),this.uniforms.tDepth.value=t.depthTexture,this.materialBlur.uniforms.tDepth.value=t.depthTexture,e instanceof n&&(this.uniforms.cameraNear.value=e.near,this.uniforms.cameraFar.value=e.far),this.uniforms.directionalLight.value.direction=i.lightDirection,this.uniforms.directionalLight.value.color.set(1,1,1).multiplyScalar(i.lightIntensity);const r=i.lights[0];r&&r.shadow&&r.castShadow&&r.visible&&(this.uniforms.directionalShadowMap.value=r.shadow.map?.texture,this.uniforms.directionalShadowMatrix.value=r.shadow.matrix),r&&!r.visible?this.uniforms.directionalLight.value.color.set(0,0,0):this.uniforms.directionalLight.value.color.set(r.color.r,r.color.g,r.color.b).multiplyScalar(i.lightIntensity);const l=o.children.find(e=>e.name===s);null!=l&&l.visible?this.uniforms.ambientLight.value.set(l.color.r,l.color.g,l.color.b).multiplyScalar(l.intensity):this.uniforms.ambientLight.value.set(0,0,0)}}const u=new e.Vector2(1,0),f=new e.Vector2(0,1);/*
|
|
1
|
+
import*as t from"three";import{Matrix4 as e,PerspectiveCamera as n,PointLight as i,Vector3 as o,WebGLRenderTarget as a}from"three";import{FullScreenQuad as r,Pass as s}from"three/examples/jsm/Addons.js";import{ambientLightName as l}from"../../scene/sky.js";import{FogVolumeObject as c}from"./fog-volume-object";const h=new o;export class VolumetricFogPass extends s{constructor(n){super(),this.resolution=n,this.fsQuad=new r(null),this.downSampleRatio=4,this._oldClearColor=new t.Color,this.oldClearAlpha=1,this.volumesCache=new WeakMap,this._viewProjection=new e,this._invViewProjection=new e;const i={minFilter:t.LinearFilter,magFilter:t.LinearFilter,format:t.RGBAFormat,depthBuffer:!1,stencilBuffer:!1,type:t.HalfFloatType},s=Math.round(this.resolution.x/this.downSampleRatio),l=Math.round(this.resolution.y/this.downSampleRatio);this.renderTargetFog=new a(s,l,i),this.renderTargetFog.texture.generateMipmaps=!1,this.renderTargetBlur=new a(s,l,i),this.renderTargetBlur.texture.generateMipmaps=!1,this.material=new t.ShaderMaterial({defines:{PERSPECTIVE_CAMERA:1,NUM_FOG_VOLUMES:0,MAX_POINT_LIGHTS:8,MAX_SPOT_LIGHTS:2,VOLUMETRIC:1},uniforms:{tDepth:{value:null},tDiffuse:{value:null},cameraPos:{value:new o},cameraMatrix:{value:new e},invProjection:{value:new e},fogVolumes:{value:[]},stepCount:{value:30},cameraNear:{value:null},cameraFar:{value:null},pointLights:{value:new Array(8).fill(null).map(()=>({color:new o(0,0,0),distance:0,position:new o}))},activePointLightCount:{value:0},spotLights:{value:new Array(2).fill(null).map(()=>({position:new o,direction:new o,color:new o,distance:0,decay:0,coneCos:0,penumbraCos:0}))},activeSpotLightCount:{value:0},directionalLight:{value:{direction:new o(0,-1,1).normalize(),color:new o(1,1,1)}},ambientLight:{value:new o(1,1,1).multiplyScalar(1.35)},directionalShadowMatrix:{value:new e},directionalShadowMap:{value:null}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position,1.0);\n }\n ",fragmentShader:"\n #define MAX_STEP_COUNT 64\n\n struct IncidentLight {\n vec3 color;\n vec3 direction;\n bool visible;\n };\n\n #if MAX_POINT_LIGHTS > 0\n struct PointLight {\n\t\t\tvec3 position;\n vec3 color;\n float distance;\n\t\t};\n #endif\n\n #if MAX_SPOT_LIGHTS > 0\n struct SpotLight {\n vec3 position;\n vec3 direction;\n vec3 color;\n float distance;\n float decay;\n float coneCos;\n float penumbraCos;\n };\n uniform SpotLight spotLights[ MAX_SPOT_LIGHTS ];\n uniform int activeSpotLightCount;\n float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {\n return smoothstep( coneCosine, penumbraCosine, angleCosine );\n }\n #ifndef saturate\n #define saturate( a ) clamp( a, 0.0, 1.0 )\n #endif\n float pow2( const in float x ) { return x*x; }\n vec3 pow2( const in vec3 x ) { return x*x; }\n float pow4( const in float x ) { float x2 = x*x; return x2*x2; }\n float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {\n // based upon Frostbite 3 Moving to Physically-based Rendering\n // page 32, equation 26: E[window1]\n // https://seblagarde.files.wordpress.com/2015/07/course_notes_moving_frostbite_to_pbr_v32.pdf\n float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );\n if ( cutoffDistance > 0.0 ) {\n distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );\n }\n return distanceFalloff;\n }\n void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {\n vec3 lVector = spotLight.position - geometryPosition;\n light.direction = normalize( lVector );\n float angleCos = dot( light.direction, spotLight.direction );\n float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );\n if ( spotAttenuation > 0.0 ) {\n float lightDistance = length( lVector );\n light.color = spotLight.color * spotAttenuation;\n light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );\n light.visible = ( light.color != vec3( 0.0 ) );\n } else {\n light.color = vec3( 0.0 );\n light.visible = false;\n }\n }\n vec3 calcSpotLight(vec3 p, vec3 rayDir, float g, SpotLight spotLight) {\n IncidentLight directLight;\n getSpotLightInfo(spotLight, p, directLight);\n return directLight.color * 3.14;\n }\n #endif\n\n struct DirectionalLight {\n vec3 color; // pre multiplied with intensity\n vec3 direction; // should point *from the light*, normalized\n };\n\n struct FogVolume {\n vec3 sphereCenter;\n float sphereRadius;\n float baseDensity;\n float heightFalloff;\n float heightOffset;\n float scatteringDistribution;\n float startDistance;\n vec3 albedo;\n };\n\n varying vec2 vUv;\n uniform sampler2D tDiffuse;\n uniform vec3 cameraPos;\n\n uniform float stepCount;\n uniform float nearMinDistance;\n\n uniform mat4 cameraMatrix;\n uniform mat4 invProjection;\n uniform sampler2D tDepth;\n\t\tuniform float cameraNear;\n\t\tuniform float cameraFar;\n \n uniform DirectionalLight directionalLight;\n\n uniform mat4 directionalShadowMatrix;\n uniform sampler2D directionalShadowMap;\n\n uniform vec3 ambientLight;\n\n #if NUM_FOG_VOLUMES > 0\n uniform FogVolume fogVolumes[ NUM_FOG_VOLUMES ];\n #endif\n #if MAX_POINT_LIGHTS > 0\n uniform PointLight pointLights[ MAX_POINT_LIGHTS ];\n uniform int activePointLightCount;\n #endif\n\n #include <packing>\n\n // Ray-sphere intersection\n bool intersectSphere(vec3 rayOrigin, vec3 rayDir, vec3 sphereCenter, float sphereRadius, out float t0, out float t1) {\n // Vector from ray origin to sphere center\n vec3 L = rayOrigin - sphereCenter;\n float a = dot(rayDir, rayDir); // should be 1 if rayDir is normalized\n float b = 2.0 * dot(rayDir, L);\n float c = dot(L, L) - sphereRadius * sphereRadius;\n \n float discriminant = b * b - 4.0 * a * c;\n if (discriminant < 0.0) {\n return false; // no intersection\n }\n \n float sqrtD = sqrt(discriminant);\n t0 = (-b - sqrtD) / (2.0 * a);\n t1 = (-b + sqrtD) / (2.0 * a);\n \n // Make sure t0 <= t1\n if (t0 > t1) {\n float tmp = t0;\n t0 = t1;\n t1 = tmp;\n }\n return true;\n }\n\n float getLinearDepth( const in vec2 uv ) {\n\n float fragCoordZ = texture2D( tDepth, uv ).x;\n return perspectiveDepthToViewZ( fragCoordZ, cameraNear, cameraFar );\n\n\t\t}\n\n float linearizeDepth(float depth) {\n float z = depth * 2.0 - 1.0; // back to NDC (-1..1)\n return (2.0 * cameraNear * cameraFar) / (cameraFar + cameraNear - z * (cameraFar - cameraNear));\n }\n\n\n\n float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {\n return step( compare, unpackRGBAToDepth( texture2D( depths, uv ) ) );\n }\n\n vec3 calcDirectionalLight(vec3 p, vec3 rayDir, float g, DirectionalLight dirLight) {\n vec3 toLight = dirLight.direction; // direction from sample point to light\n float cosTheta = dot(toLight, -rayDir); // angle between view ray and light\n cosTheta = clamp(cosTheta, -1.0, 1.0); // keep it safe\n\n // phase function (Henyey-Greenstein or isotropic)\n float denom = 1.0 + g*g - 2.0*g*cosTheta;\n float phase = (1.0 - g*g) / (4.0 * 3.14159265 * pow(denom, 1.5));\n phase *= 3.0 * 3.14159265; // scale to total energy\n\n vec4 shadowCoord = directionalShadowMatrix * vec4(p, 1.0);\n shadowCoord.xyz /= shadowCoord.w; // perspective divide\n\n float bias = 0.0; \n float inShadow = texture2DCompare(directionalShadowMap, shadowCoord.xy, shadowCoord.z - bias);\n\n return dirLight.color * phase * inShadow;\n }\n\n vec3 calcPointLight(vec3 p, vec3 rayDir, float g, PointLight pointLight) {\n vec3 lightPos = pointLight.position;\n vec3 lightColor = pointLight.color;\n float lightRadius = pointLight.distance;\n\n vec3 L = normalize(lightPos - p);\n float lightDist = length(lightPos - p);\n \n float attenuation = clamp(1.0 - lightDist / lightRadius, 0.0, 1.0);\n attenuation *= attenuation; // smoother falloff\n attenuation /= (1.0 + lightDist*lightDist); // inverse-square style\n\n attenuation *= 4.0 * 3.14159; // Manually scaled to match point light intensity\n // float attenuation = 1.0 / (4.0 * 3.14159 * lightDist * lightDist);\n\n\n float cosTheta = dot(L, -rayDir); // angle between light and view ray\n float phase = (1.0 - g*g) / pow(1.0 + g*g - 2.0*g*cosTheta, 1.5);\n phase *= 0.25 / 3.14159; // normalize\n\n // Intensity is part of color\n vec3 light = lightColor * attenuation * phase;\n return light;\n }\n\n float random01(vec2 p) {\n return fract(sin(dot(p, vec2(41.0, 289.0))) * 45758.5453);\n }\n\n float hash(vec3 p) { return fract(sin(dot(p, vec3(12.9898,78.233,37.719))) * 43758.5453); }\n\n void main() {\n // reconstruct ray in world space\n vec2 ndc = vUv * 2.0 - 1.0;\n vec4 nearPoint = invProjection * vec4(ndc, -1.0, 1.0);\n nearPoint /= nearPoint.w;\n vec4 farPoint = invProjection * vec4(ndc, 1.0, 1.0);\n farPoint /= farPoint.w;\n\n vec3 rayOrigin = cameraPos;\n vec3 rayDir = normalize(farPoint.xyz - cameraPos);\n\n float sceneDepth = -getLinearDepth(vUv); // in view space\n\n // vec4 scenePosView = invProjection * vec4(ndc, sceneDepth * 2.0 - 1.0, 1.0);\n // scenePosView /= scenePosView.w;\n\n // distance from camera to surface\n // float sceneDist = length(scenePosView.xyz - cameraPosition);\n\n float transmittance = 1.0;\n vec3 inscatter = vec3(0.0);\n float random = random01(vUv);\n\n\n #if NUM_FOG_VOLUMES > 0\n for (int v = 0; v < NUM_FOG_VOLUMES; v++) {\n FogVolume volume = fogVolumes[v];\n vec3 sphereCenter = volume.sphereCenter;\n float sphereRadius = volume.sphereRadius;\n float heightFalloff = volume.heightFalloff;\n float heightOffset = volume.heightOffset;\n float baseDensity = volume.baseDensity;\n float startDistance = volume.startDistance;\n float g = volume.scatteringDistribution;\n\n float t0, t1;\n if (!intersectSphere(rayOrigin, rayDir, sphereCenter, sphereRadius, t0, t1) || t1 <= 0.0) {\n continue;\n }\n // if camera inside sphere\n t0 = max(t0, 0.0);\n\n // An alternative method to get stepSize but is less dynamic\n // float stepSize = (t1 - t0) / float(MAX_STEP_COUNT);\n\n float maxStepSize = 0.3; // adjust for visual quality\n float distance = t1 - t0;\n int stepCount = int(ceil(distance / maxStepSize));\n stepCount = min(stepCount, MAX_STEP_COUNT); // optional clamp for performance\n float stepSize = distance / float(stepCount);\n \n // Add a slight random offset to reduce banding \n float jitterAmount = 1.0;\n float rayStartOffset = random * stepSize * jitterAmount;\n t0 += rayStartOffset;\n\n for (int i = 0; i < stepCount; i++) {\n\n float t = t0 + float(i) * stepSize;\n vec3 p = rayOrigin + rayDir * t;\n\n float geomDelta = sceneDepth - t; // how far fog sample is from hitting geometry\n float fade = clamp(geomDelta, 0.0, 1.0); \n // float fade = clamp((sceneDepth - t) / 0.1, 0.0, 1.0);\n\n float closeFade = smoothstep(0.0, 0.3, (t - startDistance) / t);\n float edgeFade = clamp(sphereRadius - length(p - sphereCenter), 0.0, 1.0);\n\n // density with exponential height falloff\n float h = p.y - (sphereCenter.y + heightOffset);\n float heightFactor = clamp(exp(-h * heightFalloff), 0.0, 1.0);\n float density = baseDensity * heightFactor * fade * closeFade * edgeFade;\n\n vec3 light = vec3(0.0); // simple white light\n #if VOLUMETRIC == 1\n\n #if MAX_POINT_LIGHTS > 0\n for (int pi = 0; pi < activePointLightCount; pi++) {\n light += calcPointLight(p, rayDir, g, pointLights[pi]);\n } \n #endif\n\n #if MAX_SPOT_LIGHTS > 0\n for (int pi = 0; pi < activeSpotLightCount; pi++) {\n light += calcSpotLight(p, rayDir, g, spotLights[pi]);\n } \n #endif\n\n light += calcDirectionalLight(p, rayDir, g, directionalLight);\n\n // Ambient \n light += ambientLight / 12.0;\n #else\n light = vec3(1.0);\n #endif\n\n light *= volume.albedo;\n\n \n\n inscatter += transmittance * light * density * stepSize;\n transmittance *= exp(-density * stepSize);\n }\n }\n #endif\n\n float alpha = 1.0 - transmittance;\n // inscatter += ambientLight * alpha;\n\n vec3 color = inscatter;\n\n gl_FragColor = vec4(color, alpha);\n }\n "}),this.material.onBeforeCompile=t=>{console.log("compile material",t)},this.materialBlur=new t.ShaderMaterial({uniforms:{tInput:{value:null},tDepth:{value:null},texelSize:{value:new t.Vector2(1,1).divideScalar(1e3)},direction:{value:new t.Vector2(1,0)},depthSigma:{value:2},blurSigma:{value:2}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D tInput;\n uniform sampler2D tDepth;\n uniform vec2 texelSize;\n uniform vec2 direction;\n uniform float depthSigma;\n uniform float blurSigma;\n varying vec2 vUv;\n\n #include <packing>\n\n void main() {\n // float centerDepth = texture2D(tDepth, vUv).r;\n\n float centerDepth = unpackRGBAToDepth( texture2D( tDepth, vUv ) );\n vec4 center = texture2D(tInput, vUv);\n vec4 centerColor = center;\n\n vec4 sum = vec4(0.0);\n float wsum = 0.0;\n\n // int radius = int(ceil(2.0 * blurSigma));\n\n for (int i = -5; i <= 5; i++) {\n // if (i > radius || i < -radius) continue;\n\n vec2 offset = direction * float(i) * texelSize; // this should be based on resolution\n vec2 uv = vUv + offset;\n\n vec4 sampleColor = texture2D(tInput, uv);\n float sampleDepth = unpackRGBAToDepth( texture2D( tDepth, uv ) );\n\n float spatialWeight = exp(-0.5 * (float(i) * float(i)) / (blurSigma * blurSigma));\n float depthDiff = abs(sampleDepth - centerDepth) * 100.0;\n float depthWeight = exp(-0.5 * (depthDiff * depthDiff) / (depthSigma * depthSigma));\n\n float w = spatialWeight * depthWeight;\n\n sum += sampleColor * w;\n wsum += w;\n }\n\n gl_FragColor = sum / wsum;\n }\n ",transparent:!0}),this.materialComposite=new t.ShaderMaterial({uniforms:{tDiffuse:{value:null},tFog:{value:null}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);\n }\n ",fragmentShader:"\n uniform sampler2D tDiffuse;\n uniform sampler2D tFog;\n varying vec2 vUv;\n void main() {\n vec4 sceneColor = texture2D(tDiffuse, vUv);\n vec4 fogColor = texture2D(tFog, vUv);\n // Composite: fogColor.a is the fog alpha, blend over scene\n // vec3 color = mix(sceneColor.rgb, fogColor.rgb, fogColor.a);\n // Not sure why multipling alpha like this helps but it is necessary to avoid a dark\n // borders around the fog\n gl_FragColor = vec4(fogColor.rgb + (1.0 - fogColor.a * fogColor.a) * sceneColor.rgb, 1.0);\n }\n ",transparent:!0})}render(t,e,n){t.getClearColor(this._oldClearColor),this.oldClearAlpha=t.getClearAlpha();const i=t.autoClear;t.autoClear=!1,t.setClearColor(16777215,0),this.fsQuad.material=this.material,t.setRenderTarget(this.renderTargetFog),t.clear(),this.fsQuad.render(t),this.materialBlur.uniforms.tInput.value=this.renderTargetFog.texture,this.materialBlur.uniforms.direction.value=u,this.fsQuad.material=this.materialBlur,t.setRenderTarget(this.renderTargetBlur),t.clear(),this.fsQuad.render(t),this.materialBlur.uniforms.tInput.value=this.renderTargetBlur.texture,this.materialBlur.uniforms.direction.value=f,t.setRenderTarget(this.renderTargetFog),t.clear(),this.fsQuad.render(t),this.materialComposite.uniforms.tDiffuse.value=n.texture,this.materialComposite.uniforms.tFog.value=this.renderTargetFog.texture,this.fsQuad.material=this.materialComposite,this.renderToScreen?(t.setRenderTarget(null),this.fsQuad.render(t)):(t.setRenderTarget(e),this.clear&&t.clear(),this.fsQuad.render(t)),t.setClearColor(this._oldClearColor,this.oldClearAlpha),t.autoClear=i}setSize(t,e){let n=Math.round(t/this.downSampleRatio),i=Math.round(e/this.downSampleRatio);this.renderTargetFog.setSize(n,i),this.renderTargetBlur.setSize(n,i),this.materialBlur.uniforms.texelSize.value.set(1/n,1/i)}set volumetric(t){this.material.defines.VOLUMETRIC=t?1:0}get volumetric(){return!!this.material.defines.VOLUMETRIC}getVolumeUniforms(t){let e=this.volumesCache.get(t);return null==e&&(e={albedo:new o,baseDensity:t.baseDensity,heightFalloff:t.heightFalloff,heightOffset:t.heightOffset,startDistance:t.startDistance??3,scatteringDistribution:t.scatteringDistribution,sphereRadius:1,sphereCenter:new o},this.volumesCache.set(t,e)),t.object.getWorldPosition(e.sphereCenter),t.object.getWorldScale(h),e.sphereRadius=5*h.x,e.albedo.set(t.albedo.r,t.albedo.g,t.albedo.b),e.baseDensity=t.baseDensity,e.heightFalloff=t.heightFalloff,e.heightOffset=t.heightOffset,e.scatteringDistribution=t.scatteringDistribution,e.startDistance=t.startDistance,e}getPointLightUniforms(t){const e={position:new o,color:new o,distance:0};return t.getWorldPosition(e.position),e.color.set(t.color.r,t.color.g,t.color.b).multiplyScalar(t.intensity*(t.userData?.volumetricIntensity??1)),e.distance=void 0!==t.distance&&t.distance>0?t.distance:1,e}getSpotLightUniforms(t){const e={position:new o,direction:new o,color:new o,distance:0,coneCos:0,penumbraCos:0,decay:1};return t.getWorldPosition(e.position),e.direction.setFromMatrixPosition(t.matrixWorld),h.setFromMatrixPosition(t.target.matrixWorld),e.direction.sub(h),e.color.set(t.color.r,t.color.g,t.color.b).multiplyScalar(t.intensity*(t.userData?.volumetricIntensity??1)),e.distance=void 0!==t.distance&&t.distance>0?t.distance:0,e.coneCos=Math.cos(t.angle),e.penumbraCos=Math.cos(t.angle*(1-t.penumbra)),e.decay=void 0!==t.decay?t.decay:1,e}updateArrayUniforms(e){const n=this.material.uniforms.fogVolumes.value;let o=0;const a=this.material.uniforms.pointLights.value;let r=0;const s=this.material.uniforms.spotLights.value;let l=0;e.traverseVisible(e=>{if(e instanceof c){const t=e.volume,i=this.getVolumeUniforms(t);n[o]=i,o++}else if(e instanceof i){if(r<a.length){if(0===e.userData.volumetricIntensity)return;const t=this.getPointLightUniforms(e);a[r].position.copy(t.position),a[r].color.copy(t.color),a[r].distance=t.distance,r++}}else if(e instanceof t.SpotLight&&l<s.length){if(0===e.userData.volumetricIntensity)return;const t=this.getSpotLightUniforms(e);s[l].position.copy(t.position),s[l].direction.copy(t.direction),s[l].color.copy(t.color),s[l].distance=t.distance,s[l].coneCos=t.coneCos,s[l].penumbraCos=t.penumbraCos,s[l].decay=t.decay,l++}}),this.material.uniforms.activePointLightCount.value=r,this.material.uniforms.activeSpotLightCount.value=l,this.material.defines.NUM_FOG_VOLUMES!==o&&(this.material.needsUpdate=!0,this.material.uniformsNeedUpdate=!0),this.material.defines.NUM_FOG_VOLUMES=o}get uniforms(){return this.material.uniforms}update(t,e,i,a){if(this.updateArrayUniforms(a),this.enabled=0!=this.material.defines.NUM_FOG_VOLUMES,!this.enabled)return;null==this.uniforms.cameraPosition&&(this.uniforms.cameraPos={value:new o}),this.uniforms.cameraPos.value.copy(t.position),this._viewProjection.multiplyMatrices(t.projectionMatrix,t.matrixWorldInverse),this.uniforms.invProjection.value.copy(this._invViewProjection.copy(this._viewProjection).invert()),this.uniforms.tDepth.value=e.depthTexture,this.materialBlur.uniforms.tDepth.value=e.depthTexture,t instanceof n&&(this.uniforms.cameraNear.value=t.near,this.uniforms.cameraFar.value=t.far),this.uniforms.directionalLight.value.direction=i.lightDirection,this.uniforms.directionalLight.value.color.set(1,1,1).multiplyScalar(i.lightIntensity);const r=i.lights[0];r&&r.shadow&&r.castShadow&&r.visible&&(this.uniforms.directionalShadowMap.value=r.shadow.map?.texture,this.uniforms.directionalShadowMatrix.value=r.shadow.matrix),r&&!r.visible?this.uniforms.directionalLight.value.color.set(0,0,0):this.uniforms.directionalLight.value.color.set(r.color.r,r.color.g,r.color.b).multiplyScalar(r.intensity*(r.userData?.volumetricIntensity??1));const s=a.children.find(t=>t.name===l);null!=s&&s.visible?this.uniforms.ambientLight.value.set(s.color.r,s.color.g,s.color.b).multiplyScalar(s.intensity*(s.userData?.volumetricIntensity??1)):this.uniforms.ambientLight.value.set(0,0,0)}}const u=new t.Vector2(1,0),f=new t.Vector2(0,1);/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
package/dist/rendering.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rendering.d.ts","sourceRoot":"","sources":["../src/rendering.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EACL,MAAM,EAKN,QAAQ,EAIR,aAAa,EACb,iBAAiB,EAClB,MAAM,OAAO,CAAC;AACf,OAAO,EAA0E,UAAU,EAA6B,MAAM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AAC,EAAE,MAAM;IAiFhC,OAAO,CAAC,oBAAoB,CAAK;IACjC,OAAO,CAAC,WAAW,CAAiB;IAEpC,OAAO,CAAC,QAAQ;IAIhB,OAAO,CAAC,gBAAgB;IAuBxB,OAAO,CAAC,eAAe;IAUvB,OAAO,CAAC,gBAAgB;IAkBxB,OAAO,CAAC,qBAAqB;CAe9B;AAgBD,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,OAAO,QAIhD;AAiHD;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAIzF"}
|
package/dist/rendering.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var e;import{__decorate as t,__metadata as s}from"tslib";import*as i from"three";import{Color as r,Material as n,Matrix4 as a,Mesh as o,PerspectiveCamera as l,ShaderChunk as h,ShaderMaterial as d}from"three";import{EffectComposer as c,FXAAShader as p,GammaCorrectionShader as u,LUTPass as m,RenderPass as g,ShaderPass as f,UnrealBloomPass as v,VRButton as x}from"three-stdlib";import{CSMShader as P,CSMUtil as b}from"./csm.js";import{NodeShaderMaterial as T}from"three-shader-graph";import{Reflector as y}from"three-stdlib";import{BokehPass as w,OutputPass as M}from"three/examples/jsm/Addons.js";import{CSM as R}from"three/examples/jsm/csm/CSM.js";import S from"three/examples/jsm/libs/stats.module.js";import{GTAOPass as C}from"three/examples/jsm/postprocessing/GTAOPass.js";import{Service as F}from"typedi";import{depthUniformName as D,farUniformName as I,nearUniformName as A,resolutionUniformName as E,supportsDepthTextureExtension as W}from"./shader-nodes/depth.js";import{elapsedTimeUniformName as B}from"./shader-nodes/time.js";import{sceneMapUniformName as j}from"./shader-nodes/scene-sample.js";import{DepthPass as H}from"./utils/three/depth-pass.js";import{GPUStatsPanel as U}from"./utils/three/gpu-stats-panel.js";import{OutlinePass as O}from"./utils/three/outline-pass.js";import{findFirstVisibleObject as V}from"./utils/three/traverse.js";import{clamp as L}from"./utils/math.js";import{ColorPass as k}from"./rendering/color-pass.js";import{SSRPass as z}from"./rendering/ssr/SSRPass.js";import{SSRShader as _}from"./rendering/ssr/SSRShader.js";import{VolumetricFogPass as N}from"./rendering/fog/volumetric-fog-pass.js";import{OutlineEffect as G}from"./rendering/outline-effect.js";b.patchSetupMaterial();const q=document.createElement("div");q.style.position="absolute",q.style.left="50%",q.style.top="50%",q.style.color="black",q.style.zIndex="999";(new i.Layers).set(9);const X=new i.MeshBasicMaterial({color:"black"}),Y=new i.MeshDepthMaterial;Y.depthPacking=i.RGBADepthPacking,Y.blending=i.NoBlending,Y.side=i.DoubleSide;const Q=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let K=e=class{setPaused(e){this.paused=e}resizeRender(){this.previousClientWith===this.container.clientWidth&&this.previousClientHeight===this.container.clientHeight||0!==this.container.clientWidth&&0!==this.container.clientHeight&&(this.previousClientWith=this.container.clientWidth,this.previousClientHeight=this.container.clientHeight,this.camera instanceof l&&(this.camera.aspect=this.container.clientWidth/this.container.clientHeight,this.camera.updateProjectionMatrix()),this.renderer.setPixelRatio(Math.min(this.maxPixelRatio,window.devicePixelRatio)*this.resolutionScale),this.renderer.setSize(this.container.clientWidth,this.container.clientHeight),this.composer.setSize(this.container.clientWidth*this.resolutionScale,this.container.clientHeight*this.resolutionScale),this.bloomComposer.setSize(this.container.clientWidth*this.resolutionScale,this.container.clientHeight*this.resolutionScale),this.dofPass.setSize(this.container.clientWidth*this.resolutionScale,this.container.clientHeight*this.resolutionScale),this.aoMaskDepthRenderTarget.dispose(),this.aoMaskDepthRenderTarget=e.createAOMaskDepthRenderTarget(this.renderer,this.container),this.aoPass.blendMaterial.uniforms.tDepth.value=this.aoMaskDepthRenderTarget.depthTexture,this.depthRenderTarget.dispose(),this.depthRenderTarget=e.createDepthRenderTarget(this.renderer,this.container),this.sceneColorRenderTarget.dispose(),this.sceneColorRenderTarget=e.createSceneColorRenderTarget(this.renderer,this.container))}addPostProcessVolume(e){if(0===this.postProcessVolumes.length)this.postProcessVolumes.push(e);else{let t=!1;for(let s=0;s<this.postProcessVolumes.length;s++)if(e.priority<this.postProcessVolumes[s].priority){this.postProcessVolumes.splice(s,0,e),t=!0;break}t||this.postProcessVolumes.push(e)}}removePostProcessVolume(e){const t=this.postProcessVolumes.indexOf(e);t>-1&&this.postProcessVolumes.splice(t,1)}constructor(t,s={}){this.container=t,this.options=s,this.windowVisible=!0,this.running=!0,this.paused=!1,this.fpsCap=null,this.postProcessVolumes=[],this.postProcessSettings={},this.resolutionScale=Q?.5:1,this.maxPixelRatio=Q?1:window.devicePixelRatio,this.onResize=()=>{if(this.resizeRender(),!this.paused)try{this.render()}catch(e){}},this.onVisiblityChane=()=>{this.windowVisible=!document.hidden},this.isDepthTextureExtensionSupported=!1,this.onLoopCallbacks=[],this.stats=new S,this._showStats=!0,this.insetHeight=200,this.insetWidth=this.insetHeight*(16/9),this.insetOffsetY=250,this.insetMargin=10,this.maxInsetCameras=4,this.overlayCameras=new Set,this.prevClearColor=new r,this.hadBloom=!1,this.bloomStoredMaterials={},this.bloomHidden=[],null!=s.maxPixelRatio&&(this.maxPixelRatio=s.maxPixelRatio),window.renderer=this.renderer=new i.WebGLRenderer({antialias:!1,powerPreference:"high-performance"}),this.scene=new i.Scene,this.scene.matrixWorldAutoUpdate=!0,this.renderer.setPixelRatio(Math.min(this.maxPixelRatio,window.devicePixelRatio)*this.resolutionScale),this.renderer.setSize(t.clientWidth,t.clientHeight),this.renderer.xr.enabled=this.options.enableXR??!1,!0===this.options.enableXR&&document.body.appendChild(x.createButton(this.renderer));const n=new G(this.renderer,{defaultThickness:.005,defaultColor:[0,0,0],defaultAlpha:1,defaultKeepAlive:!0});this.outlineEffect=n,this.composer=new c(this.renderer);var a=(t.clientWidth||1)/(t.clientHeight||1);const o=new i.PerspectiveCamera(45,a,.5,800);o.layers.enable(19),this.setCamera(o),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=i.PCFSoftShadowMap,this.renderer.shadowMap.autoUpdate=s.shadows?.autoUpdate??!1,this.renderer.outputColorSpace=i.SRGBColorSpace,this.renderer.toneMapping=i.NoToneMapping,this.renderer.toneMappingExposure=1,this.renderer.gammaFactor=1.4,b.renderingView=this,b.patchThreeAdd(),this.isDepthTextureExtensionSupported=W(this.renderer),t.replaceChildren(this.renderer.domElement),this.setupEventListeners(),this.depthRenderTarget=e.createDepthRenderTarget(this.renderer,this.container),this.aoMaskDepthRenderTarget=e.createAOMaskDepthRenderTarget(this.renderer,this.container),this.sceneColorRenderTarget=e.createSceneColorRenderTarget(this.renderer,this.container);const l=new i.Vector2(t.clientWidth,t.clientHeight),h=new g(this.scene,this.camera);this.composer.addPass(h);const d=new v(l,1.5,.4,.85);d.threshold=1,d.strength=.9,d.radius=.5,this.bloomPass=d;const P=new C(this.scene,this.camera,t.clientWidth,t.clientWidth);P.blendMaterial.uniforms.tDepth={value:this.aoMaskDepthRenderTarget.depthTexture},P.blendMaterial.uniforms.tAODepth={value:P.depthTexture},P.blendMaterial.fragmentShader="\n uniform float intensity;\n uniform sampler2D tDiffuse;\n uniform sampler2D tDepth;\n uniform sampler2D tAODepth;\n varying vec2 vUv;\n\n void main() {\n vec4 texel = texture2D( tDiffuse, vUv );\n float d = textureLod(tDepth, vUv.xy, 0.0).x;\n float d2 = textureLod(tAODepth, vUv.xy, 0.0).x;\n\n float depth = 2.0 * 1.0 * 500.0 / (500.0 + 1.0 - (2.0 * d - 1.0) * (500.0 - 1.0));\n gl_FragColor = vec4(mix(vec3(1.), texel.rgb, d2 > d ? 0.0 : intensity), texel.a);\n }\n ",P.output=C.OUTPUT.Default,P.enabled=!1,this.aoPass=P,_.fragmentShader=_.fragmentShader.replace("if(metalness==0.) return;","if(metalness<0.1) return;");const T=new z({renderer:this.renderer,scene:this.scene,camera:this.camera,groundReflector:null,selects:[]});T.output=z.OUTPUT.Default,T.blur=!0,T.fresnel=!1,T.distanceAttenuation=!0,T.maxDistance=50,T.selective=!0,T.bouncing=!1,T.opacity=.4,T.enabled=!1!==this.options?.reflection?.enabled,this.ssrPass=T,this.composer.addPass(T),!1!==this.options.ao?.enabled&&this.composer.addPass(P),this.renderer.info.autoReset=!1;const y=new c(this.renderer);y.renderToScreen=!1,y.addPass(h),y.addPass(d),this.bloomComposer=y,Q||(y.renderTarget2.texture.type=i.HalfFloatType,this.composer.renderTarget1.texture.type=i.HalfFloatType);const R=new f(new i.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:y.renderTarget2.texture}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n varying vec2 vUv;\n void main() {\n gl_FragColor = ( texture2D( baseTexture, vUv ) + vec4( 1.0 ) * texture2D( bloomTexture, vUv ) );\n }",defines:{}}),"baseTexture");R.needsSwap=!0,!1!==this.options.bloom?.enabled&&this.composer.addPass(R),this.volumetricFogPass=new N(l),this.composer.addPass(this.volumetricFogPass),this.volumetricFogPass.enabled=!0,this.dofPass=new w(this.scene,this.camera,{focus:1,aperture:.025,maxblur:.01}),this.dofPass.enabled=!1,this.composer.addPass(this.dofPass);const F=new k;this.composer.addPass(F),this.colorPass=F,F.vignetteEnabled=!1,this.outlinePass=new O(new i.Vector2(t.clientWidth,t.clientHeight),this.scene,this.camera),this.outlinePass.edgeGlow=0,this.outlinePass.edgeThickness=1.5,this.outlinePass.edgeStrength=5,this.outlinePass.clear=!1,this.outlinePass.enabled=!1,this.composer.addPass(this.outlinePass);const D=new f(p);D.uniforms.resolution.value.set(1/t.clientWidth,1/t.clientHeight),this.composer.addPass(D),this.fxaaPass=D,this.fxaaPass.enabled=!1,!0===s.enableOutlines&&this.setEnableOutlines(!0),new f(u).clear=!1,this.fixStatsStyle(),this.lutPass=new m({}),this.lutPass.enabled=!1,this.composer.addPass(this.lutPass);const I=new M;this.composer.addPass(I)}fixStatsStyle(){const e=this.stats.dom;e.style.position="absolute";const t=e.getElementsByTagName("canvas");for(let e=0;e<t.length;e++)t.item(e).style.display="inline-block"}setEnableOutlines(e){this.outlinePass.enabled=e,this.fxaaPass.enabled=e}setCamera(e){this.camera=e,this.composer.passes.forEach(t=>{t instanceof g?t.camera=e:t instanceof O?t.renderCamera=e:(t instanceof H||t instanceof C)&&(t.camera=e)}),this.ssrPass&&(this.ssrPass.camera=e),this.aoPass&&(this.aoPass.camera=e),null==this.csm?(this.csm=new R({maxFar:500,lightFar:250,lightMargin:20,cascades:Q?2:4,shadowMapSize:2048*(Q?.5:1),lightDirection:new i.Vector3(.5,-1,-.6).normalize(),lightIntensity:.5*Math.PI,camera:this.camera,parent:this.scene}),h.lights_fragment_begin=P.lights_fragment_begin):(this.csm.camera=this.camera,this.camera instanceof l&&(this.csm.maxFar=this.camera.far)),this.csm.updateFrustums()}setSelectedObjects(e){if(null==this.outlinePass)return;const t=new Map;for(const s of e)t.set(s.uuid,s);for(const s of e)s.traverse(e=>{e.uuid!==s.uuid&&t.has(e.uuid)&&t.delete(e.uuid)});this.outlinePass.selectedObjects=Array.from(t.values())}static createDepthRenderTarget(e,t){var s=!!e.extensions.get("WEBGL_depth_texture");const r=new i.WebGLRenderTarget(t.clientWidth*e.getPixelRatio(),t.clientHeight*e.getPixelRatio());return r.texture.minFilter=i.NearestFilter,r.texture.magFilter=i.NearestFilter,r.texture.type=i.FloatType,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,!0===s&&(r.depthTexture=new i.DepthTexture(128,128),r.depthTexture.type=i.UnsignedShortType,r.depthTexture.minFilter=i.NearestFilter,r.depthTexture.magFilter=i.NearestFilter),r}static createAOMaskDepthRenderTarget(e,t){const s=new i.WebGLRenderTarget(t.clientWidth*e.getPixelRatio(),t.clientHeight*e.getPixelRatio(),{type:i.HalfFloatType});return s.texture.minFilter=i.NearestFilter,s.texture.magFilter=i.NearestFilter,s.texture.generateMipmaps=!1,s.stencilBuffer=!1,s.depthTexture=new i.DepthTexture(128,128),s.depthTexture.type=i.UnsignedInt248Type,s.depthTexture.minFilter=i.NearestFilter,s.depthTexture.magFilter=i.NearestFilter,s}static createSceneColorRenderTarget(e,t){const s=new i.WebGLRenderTarget(t.clientWidth*e.getPixelRatio()*.5,t.clientHeight*e.getPixelRatio()*.5,{format:i.RGBAFormat,colorSpace:i.SRGBColorSpace,stencilBuffer:!1});return s.texture.minFilter=i.LinearFilter,s.texture.magFilter=i.LinearFilter,s.texture.generateMipmaps=!1,s}setupEventListeners(){window.addEventListener("resize",this.onResize),window.addEventListener("orientationchange",this.onResize),document.addEventListener("visibilitychange",this.onVisiblityChane)}stop(){this.running=!1,window.removeEventListener("resize",this.onResize),window.removeEventListener("orientationchange",this.onResize),document.removeEventListener("visibilitychange",this.onVisiblityChane),this.onLoopCallbacks=[],this.renderer.dispose(),this.depthRenderTarget.dispose(),this.aoMaskDepthRenderTarget.dispose(),this.sceneColorRenderTarget.dispose(),this.csm.dispose(),this.container.replaceChildren(),this.volumetricFogPass.dispose()}onLoop(e){this.onLoopCallbacks.push(e)}removeOnLoop(e){const t=this.onLoopCallbacks.find(e);t>=0&&this.onLoopCallbacks.splice(t,1)}set showStats(e){this._showStats=e,this._showStats&&!this.container.contains(this.stats.dom)?this.container.appendChild(this.stats.dom):!this._showStats&&this.container.contains(this.stats.dom)&&this.container.removeChild(this.stats.dom)}get showStats(){return this._showStats}applyEnvMap(e){null!=this.scene.environment&&e instanceof T&&(null==e.uniforms.envMap&&(e.uniforms.envMap={value:this.scene.environment}),null==e.uniforms.envMapIntensity&&(e.uniforms.envMapIntensity={value:1}),e.uniforms.envMap.value=this.scene.environment,e.uniforms.envMapIntensity.value=this.scene.environmentIntensity,e.envMap=this.scene.environment)}loop(e,t=!1){const s=this.stats,r=s.addPanel(new S.Panel("Calls","#83f","#002")),l=s.addPanel(new S.Panel("Triangles","#c32","#002"));let h;navigator.userAgent.includes("Chrome")&&navigator.userAgent.includes("HologyEngine")&&(h=new U(this.renderer.getContext()),s.addPanel(h)),this.showStats=t;let d=10,c=1e3;const p=()=>{const e=this.renderer.info.render.calls;e>d&&(d=e,setTimeout(()=>d=10,5e3)),r.update(e,d);const t=this.renderer.info.render.triangles;t>c&&(c=t,setTimeout(()=>c=1e3,5e3)),l.update(t,c)};performance.now();i.Ray.prototype.intersectTriangle;const u=[],m=[],g=[];let f=0;const v=new a,x=new a,P=t=>{const r=this.renderer.getContext();if(this.paused&&this.running&&r.drawingBufferHeight>1)return void setTimeout(()=>P(t),500);this.renderer.clear(),this.applyPostProcessSettings(),this.renderer.autoClear=!1,this.renderer.clear(),this.renderer.setViewport(0,0,this.container.clientWidth,this.container.clientHeight),this.camera,s.begin();let a=(t*=.001)-f;if(f=t,v.copy(this.camera.matrixWorld),a>1){let t=a;for(;t>.05;)e(Z),t-=Z;e(t)}else e(a);this.onLoopCallbacks.forEach(e=>e(a)),this.camera?.updateMatrixWorld(),x.copy(this.camera.matrixWorld),x.equals(v)||(this.renderer.shadowMap.needsUpdate=!0),this.resizeRender(),u.length=0,m.length=0,g.length=0;const l=ee;if(se.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),l.setFromProjectionMatrix(se),this.scene.traverseVisible(e=>{if(null!=this.scene.environment&&(e instanceof o||e instanceof i.Sprite)&&function(e,t){if(Array.isArray(e.material))for(const s of e.material)t(s);else null!=e.material&&t(e.material)}(e,e=>this.applyEnvMap(e)),this.outlineEffect.apply(e),(e instanceof o||e instanceof i.Sprite)&&this.initResolutionUniform(e.material),(e instanceof o||e instanceof i.Sprite)&&e.visible&&(e.material?.userData?.water||e.material?.uniforms&&null!=e.material?.uniforms[D])&&isObjectInFrustum(e,l)?(e.visible=!1,u.push(e),this.initDepthUniform(e.material),e.renderOrder=100):e instanceof y&&(e.visible=!1,m.push(e)),(e instanceof o||e instanceof i.Sprite)&&e.material?.uniforms&&null!=e.material?.uniforms[j]&&isObjectInFrustum(e,l)?(e.visible=!1,g.push(e),e.material.uniforms[j].value=this.sceneColorRenderTarget.texture):(e instanceof o||e instanceof i.Sprite)&&function(e){if(e.material instanceof n)return e.material.transparent||e.material.alphaTest>0;if(Array.isArray(e.material))for(const t of e.material)if(t.transparent||t.alphaTest>0)return!0}(e)&&(e.visible=!1,e.layers.enable(5),m.push(e)),e instanceof o&&e.material?.uniforms&&null!=e.material?.uniforms[B])e.material.uniforms[B].value=t;else if(e instanceof o&&Array.isArray(e.material))for(const s of e.material)s.uniforms&&null!=s.uniforms[B]&&(s.uniforms[B].value=t)}),u.length>0){if(this.scene.overrideMaterial=Y,this.renderer.setRenderTarget(this.depthRenderTarget),!this.paused&&null!=this.camera)try{this.renderer.clear(),this.renderer.render(this.scene,this.camera)}catch(e){console.warn(e)}this.renderer.setRenderTarget(null),this.scene.overrideMaterial=null}if(g.length>0){if(this.renderer.setRenderTarget(this.sceneColorRenderTarget),!this.paused&&null!=this.camera)try{this.renderer.clear(!0,!0,!1);try{this.renderer.render(this.scene,this.camera)}catch(e){}}catch(e){console.warn("Error rendering scene color:",e)}this.renderer.setRenderTarget(null)}if(u.forEach(e=>e.visible=!0),m.forEach(e=>e.visible=!0),g.forEach(e=>e.visible=!0),this.aoPass.enabled){if(this.scene.overrideMaterial=Y,this.camera.layers.set(5),this.renderer.setRenderTarget(this.aoMaskDepthRenderTarget),!this.paused&&null!=this.camera)try{this.renderer.clear(),this.renderer.render(this.scene,this.camera)}catch(e){console.warn(e)}this.camera.layers.enableAll(),this.renderer.setRenderTarget(null),this.scene.overrideMaterial=null}this.ssrPass&&(this.ssrPass.elapsedTime=t),this.volumetricFogPass&&this.volumetricFogPass.update(this.camera,this.ssrPass.beautyRenderTarget,this.csm,this.scene);try{!this.paused&&this.running&&(this.showStats&&h?.startQuery(),this.render(a),this.showStats&&h?.endQuery(),this.showStats&&p(),this.renderer.info.reset(),this.renderOverlay())}catch(e){console.warn(e)}s.end(),this.csm?.update(),this.running&&!0!==this.options.enableXR&&(this.fpsCap?setTimeout(()=>{requestAnimationFrame(P)},1e3/this.fpsCap):requestAnimationFrame(P))};!0===this.options.enableXR?this.renderer.setAnimationLoop(P):requestAnimationFrame(P)}applyPostProcessSettings(){if(0==this.postProcessVolumes.length)return;var e;(e=this.postProcessSettings).tonemapMapping=void 0,e.tonemapExposure=1,e.envIntensity=1,e.envTexture=void 0,e.vignetteIntensity=0,e.colorTint=new i.Color("white"),e.colorTintIntensity=0,e.depthFocus=void 0,e.depthAperture=void 0,e.depthMaxBlur=void 0,e.temperature=6500,e.temperatureTint=0,e.lut=void 0,e.lutIntensity=0;const t=this.postProcessSettings;let s,r=!1,n=!1,a=!1;const o=this.camera?.position;if(null==o)return;let h=[];for(const e of this.postProcessVolumes){if(!$(e.object))continue;let l=e.blendWeight??1;const d=e.distanceToPoint(o);d>e.blendRadius||(e.blendRadius>0&&(l*=L(1-d/e.blendRadius,0,1)),l>1&&(l=1),l>0&&(h.push(e),void 0!==e.settings.tonemapMapping&&(t.tonemapMapping=e.settings.tonemapMapping),void 0!==e.settings.tonemapExposure&&(t.tonemapExposure=i.MathUtils.lerp(t.tonemapExposure,e.settings.tonemapExposure,l)),void 0!==e.settings.envTexture&&(t.envTexture=e.settings.envTexture),void 0!==e.settings.envIntensity&&(t.envIntensity=i.MathUtils.lerp(t.envIntensity,e.settings.envIntensity,l)),void 0!==e.settings.vignetteIntensity&&(t.vignetteIntensity=i.MathUtils.lerp(t.vignetteIntensity,e.settings.vignetteIntensity,l),n=!0),void 0!==e.settings.colorTint&&void 0!==e.settings.colorTintIntensity&&e.settings.colorTintIntensity>0&&(t.colorTint=t.colorTint.lerp(e.settings.colorTint,l)),void 0!==e.settings.colorTintIntensity&&(t.colorTintIntensity=i.MathUtils.lerp(t.colorTintIntensity,e.settings.colorTintIntensity,l)),void 0!==e.settings.depthFocus&&(r=!0,t.depthFocus=void 0!==t.depthFocus?i.MathUtils.lerp(t.depthFocus,e.settings.depthFocus,l):e.settings.depthFocus),void 0!==e.settings.depthAperture&&(r=!0,t.depthAperture=void 0!==t.depthAperture?i.MathUtils.lerp(t.depthAperture,e.settings.depthAperture,l):e.settings.depthAperture),void 0!==e.settings.depthMaxBlur&&(r=!0,t.depthMaxBlur=void 0!==t.depthMaxBlur?i.MathUtils.lerp(t.depthMaxBlur,e.settings.depthMaxBlur,l):e.settings.depthMaxBlur),void 0!==e.settings.temperature&&(t.temperature=i.MathUtils.lerp(t.temperature,e.settings.temperature,l)),void 0!==e.settings.temperatureTint&&(t.temperatureTint=i.MathUtils.lerp(t.temperatureTint,e.settings.temperatureTint,l)),void 0!==e.settings.lut&&(s=e.settings.lut,a=!0),void 0!==e.settings.lutIntensity&&(t.lutIntensity=i.MathUtils.lerp(t.lutIntensity,e.settings.lutIntensity,l),a=!0)))}this.renderer.toneMapping=t.tonemapMapping??i.NoToneMapping,this.renderer.toneMappingExposure=t.tonemapExposure,this.scene.environment=t.envTexture,this.scene.environmentIntensity=t.envIntensity,this.colorPass.vignetteIntensity=t.vignetteIntensity,this.colorPass.vignetteEnabled=n,this.colorPass.colorTint=t.colorTint,this.colorPass.colorTintIntensity=t.colorTintIntensity,r&&this.camera instanceof l?(this.dofPass.enabled=!0,void 0!==t.depthFocus&&(this.dofPass.uniforms.focus.value=t.depthFocus),void 0!==t.depthAperture&&(this.dofPass.uniforms.aperture.value=t.depthAperture),void 0!==t.depthMaxBlur&&(this.dofPass.uniforms.maxblur.value=t.depthMaxBlur)):this.dofPass.enabled=!1,this.colorPass.temperature=t.temperature,this.colorPass.temperatureTint=t.temperatureTint,this.lutPass.enabled=a,a&&(null!=s&&(s.flipY=!0,s.generateMipmaps=!1),this.lutPass.lut=s,this.lutPass.intensity=t.lutIntensity)}renderOverlay(){const e=Array.from(this.overlayCameras.values()).slice(0,this.maxInsetCameras),t=this.container.clientWidth/2,s=e.length*this.insetWidth+(e.length-1)*this.insetMargin;for(let i=0;i<e.length;i++)this.renderer.clearDepth(),this.renderer.setViewport(t-s/2+this.insetWidth*i+this.insetMargin*i,this.insetOffsetY,this.insetWidth,this.insetHeight),this.renderer.render(this.scene,e[i])}addOverlayCamera(e){this.overlayCameras.add(e)}clearOverlayCameras(){this.overlayCameras.clear()}removeOverlayCamera(e){this.overlayCameras.delete(e)}render(e){if(0===this.composer.renderTarget1.width||0===this.composer.renderTarget1.height)return;if(0===this.composer.renderTarget2.width||0===this.composer.renderTarget2.height)return;let t=!1;if(this.ssrPass.enabled&&!1!==this.options?.reflection?.enabled){const e=this.ssrPass.selects??[];e.length=0,this.scene.traverseVisible(t=>{t instanceof o&&!0===t.material.userData?.reflective&&e.push(t)}),this.ssrPass.selects=e,0==e.length&&!1===this.volumetricFogPass.enabled&&(this.ssrPass.enabled=!1),t=!0}else!1===this.volumetricFogPass.enabled&&(this.ssrPass.enabled=!1,t=!0);if(!1!==this.options.bloom?.enabled){const e=this.hasBloom();if(e||this.hadBloom){const e=this.scene.fog;this.scene.fog=null;const t=this.renderer.getClearColor(this.prevClearColor);this.renderer.setClearColor(0),this.scene.traverseVisible(e=>this.darkenNonBloomed(e));try{this.bloomComposer.render()}catch(e){J||(console.error(e),J=!0)}this.scene.traverse(e=>this.restoreMaterial(e)),this.bloomHidden.forEach(e=>e.visible=!0),this.bloomHidden.length=0,this.renderer.setClearColor(t),this.scene.fog=e}this.hadBloom=e}this.composer.render(e),t&&(this.ssrPass.enabled=!0)}hasBloom(){return null!=V(this.scene,e=>e instanceof o&&!0===e.material?.userData?.hasBloom)}darkenNonBloomed(e){if((e instanceof o||e instanceof i.Sprite||e instanceof i.Line)&&e.visible&&(null==e.material.userData||!0!==e.material.userData.hasBloom)){if(e.material?.id===X.id)return;this.bloomStoredMaterials[e.uuid]=e.material,!0!==e.material.transparent?e.material=X:e.visible=!1}else"TransformControlsPlane"!==e.type&&"TransformControlsGizmo"!==e.type||(e.visible=!1,this.bloomHidden.push(e))}restoreMaterial(e){this.bloomStoredMaterials[e.uuid]&&(e.material=this.bloomStoredMaterials[e.uuid],delete this.bloomStoredMaterials[e.uuid],e.visible=!0)}initDepthUniform(e){e instanceof d&&(e.uniforms[D].value=this.isDepthTextureExtensionSupported?this.depthRenderTarget.depthTexture:this.depthRenderTarget.texture,this.camera instanceof l&&(null!=e.uniforms[A]&&(e.uniforms[A].value=this.camera.near),null!=e.uniforms[I]&&(e.uniforms[I].value=this.camera.far)))}initResolutionUniform(e){e instanceof d&&null!=e.uniforms[E]&&e.uniforms[E].value.set(this.container.clientWidth*this.renderer.getPixelRatio(),this.container.clientHeight*this.renderer.getPixelRatio())}};K=e=t([F(),s("design:paramtypes",[HTMLElement,Object])],K);export{K as RenderingView};let J=!1;export function setRenderingPaused(e){null!=window.editor?.viewer?.renderingView&&(window.editor.viewer.renderingView.paused=e)}const Z=.05;function $(e){let t=e;for(;t;){if(!1===t.visible)return!1;t=t.parent}return!0}C.prototype.overrideVisibility=function(){const e=this.scene,t=this._visibilityCache;e.traverse(function(e){if(t.set(e,e.visible),(e.isPoints||e.isLine||e.isTransformControls)&&(e.visible=!1),null!=e.material){let t=!1;if(Array.isArray(e.material)){for(const s of e.material)if(null!=s.alphaTest&&s.alphaTest>0){t=!0;break}}else null!=e.material.alphaTest&&e.material.alphaTest>0&&(t=!0);t&&(e.visible=!1)}})};const ee=new i.Frustum,te=new i.Box3,se=new i.Matrix4;export function isObjectInFrustum(e,t){const s=te.setFromObject(e);return t.intersectsBox(s)}/*
|
|
1
|
+
var e;import{__decorate as t,__metadata as s}from"tslib";import*as i from"three";import{Color as r,Material as n,Matrix4 as a,Mesh as o,PerspectiveCamera as l,ShaderChunk as h,ShaderMaterial as d}from"three";import{EffectComposer as c,FXAAShader as p,GammaCorrectionShader as u,LUTPass as m,RenderPass as g,ShaderPass as f,UnrealBloomPass as v,VRButton as x}from"three-stdlib";import{CSMShader as P,CSMUtil as b}from"./csm.js";import{NodeShaderMaterial as T}from"three-shader-graph";import{Reflector as y}from"three-stdlib";import{BokehPass as w,OutputPass as M}from"three/examples/jsm/Addons.js";import{CSM as R}from"three/examples/jsm/csm/CSM.js";import S from"three/examples/jsm/libs/stats.module.js";import{GTAOPass as C}from"three/examples/jsm/postprocessing/GTAOPass.js";import{Service as F}from"typedi";import{depthUniformName as D,farUniformName as I,nearUniformName as A,resolutionUniformName as E,supportsDepthTextureExtension as W}from"./shader-nodes/depth.js";import{elapsedTimeUniformName as B}from"./shader-nodes/time.js";import{sceneMapUniformName as j}from"./shader-nodes/scene-sample.js";import{DepthPass as H}from"./utils/three/depth-pass.js";import{GPUStatsPanel as U}from"./utils/three/gpu-stats-panel.js";import{OutlinePass as O}from"./utils/three/outline-pass.js";import{findFirstVisibleObject as V}from"./utils/three/traverse.js";import{clamp as L}from"./utils/math.js";import{ColorPass as k}from"./rendering/color-pass.js";import{SSRPass as z}from"./rendering/ssr/SSRPass.js";import{SSRShader as _}from"./rendering/ssr/SSRShader.js";import{VolumetricFogPass as N}from"./rendering/fog/volumetric-fog-pass.js";import{OutlineEffect as G}from"./rendering/outline-effect.js";b.patchSetupMaterial();const q=document.createElement("div");q.style.position="absolute",q.style.left="50%",q.style.top="50%",q.style.color="black",q.style.zIndex="999";(new i.Layers).set(9);const X=new i.MeshBasicMaterial({color:"black"}),Y=new i.MeshDepthMaterial;Y.depthPacking=i.RGBADepthPacking,Y.blending=i.NoBlending,Y.side=i.DoubleSide;const Q=/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent);let K=e=class{setPaused(e){this.paused=e}resizeRender(){this.previousClientWith===this.container.clientWidth&&this.previousClientHeight===this.container.clientHeight||0!==this.container.clientWidth&&0!==this.container.clientHeight&&(this.previousClientWith=this.container.clientWidth,this.previousClientHeight=this.container.clientHeight,this.camera instanceof l&&(this.camera.aspect=this.container.clientWidth/this.container.clientHeight,this.camera.updateProjectionMatrix()),this.renderer.setPixelRatio(Math.min(this.maxPixelRatio,window.devicePixelRatio)*this.resolutionScale),this.renderer.setSize(this.container.clientWidth,this.container.clientHeight),this.composer.setSize(this.container.clientWidth*this.resolutionScale,this.container.clientHeight*this.resolutionScale),this.bloomComposer.setSize(this.container.clientWidth*this.resolutionScale,this.container.clientHeight*this.resolutionScale),this.dofPass.setSize(this.container.clientWidth*this.resolutionScale,this.container.clientHeight*this.resolutionScale),this.aoMaskDepthRenderTarget.dispose(),this.aoMaskDepthRenderTarget=e.createAOMaskDepthRenderTarget(this.renderer,this.container),this.aoPass.blendMaterial.uniforms.tDepth.value=this.aoMaskDepthRenderTarget.depthTexture,this.depthRenderTarget.dispose(),this.depthRenderTarget=e.createDepthRenderTarget(this.renderer,this.container),this.sceneColorRenderTarget.dispose(),this.sceneColorRenderTarget=e.createSceneColorRenderTarget(this.renderer,this.container))}addPostProcessVolume(e){if(0===this.postProcessVolumes.length)this.postProcessVolumes.push(e);else{let t=!1;for(let s=0;s<this.postProcessVolumes.length;s++)if(e.priority<this.postProcessVolumes[s].priority){this.postProcessVolumes.splice(s,0,e),t=!0;break}t||this.postProcessVolumes.push(e)}}removePostProcessVolume(e){const t=this.postProcessVolumes.indexOf(e);t>-1&&this.postProcessVolumes.splice(t,1)}constructor(t,s={}){this.container=t,this.options=s,this.windowVisible=!0,this.running=!0,this.paused=!1,this.fpsCap=null,this.postProcessVolumes=[],this.postProcessSettings={},this.resolutionScale=Q?.5:1,this.maxPixelRatio=Q?1:window.devicePixelRatio,this.onResize=()=>{if(this.resizeRender(),!this.paused)try{this.render()}catch(e){}},this.onVisiblityChane=()=>{this.windowVisible=!document.hidden},this.isDepthTextureExtensionSupported=!1,this.onLoopCallbacks=[],this.stats=new S,this._showStats=!0,this.insetHeight=200,this.insetWidth=this.insetHeight*(16/9),this.insetOffsetY=250,this.insetMargin=10,this.maxInsetCameras=4,this.overlayCameras=new Set,this.prevClearColor=new r,this.hadBloom=!1,this.bloomStoredMaterials={},this.bloomHidden=[],null!=s.maxPixelRatio&&(this.maxPixelRatio=s.maxPixelRatio),window.renderer=this.renderer=new i.WebGLRenderer({antialias:!1,powerPreference:"high-performance"}),this.scene=new i.Scene,this.scene.matrixWorldAutoUpdate=!0,this.renderer.setPixelRatio(Math.min(this.maxPixelRatio,window.devicePixelRatio)*this.resolutionScale),this.renderer.setSize(t.clientWidth,t.clientHeight),this.renderer.xr.enabled=this.options.enableXR??!1,!0===this.options.enableXR&&document.body.appendChild(x.createButton(this.renderer));const n=new G(this.renderer,{defaultThickness:.005,defaultColor:[0,0,0],defaultAlpha:1,defaultKeepAlive:!0});this.outlineEffect=n,this.composer=new c(this.renderer);var a=(t.clientWidth||1)/(t.clientHeight||1);const o=new i.PerspectiveCamera(45,a,.5,800);o.layers.enable(19),this.setCamera(o),this.renderer.shadowMap.enabled=!0,this.renderer.shadowMap.type=i.PCFSoftShadowMap,this.renderer.shadowMap.autoUpdate=s.shadows?.autoUpdate??!1,this.renderer.outputColorSpace=i.SRGBColorSpace,this.renderer.toneMapping=i.NoToneMapping,this.renderer.toneMappingExposure=1,this.renderer.gammaFactor=1.4,b.renderingView=this,b.patchThreeAdd(),this.isDepthTextureExtensionSupported=W(this.renderer),t.replaceChildren(this.renderer.domElement),this.setupEventListeners(),this.depthRenderTarget=e.createDepthRenderTarget(this.renderer,this.container),this.aoMaskDepthRenderTarget=e.createAOMaskDepthRenderTarget(this.renderer,this.container),this.sceneColorRenderTarget=e.createSceneColorRenderTarget(this.renderer,this.container);const l=new i.Vector2(t.clientWidth,t.clientHeight),h=new g(this.scene,this.camera);this.composer.addPass(h);const d=new v(l,1.5,.4,.85);d.threshold=1,d.strength=.9,d.radius=.5,this.bloomPass=d;const P=new C(this.scene,this.camera,t.clientWidth,t.clientWidth);P.blendMaterial.uniforms.tDepth={value:this.aoMaskDepthRenderTarget.depthTexture},P.blendMaterial.uniforms.tAODepth={value:P.depthTexture},P.blendMaterial.fragmentShader="\n uniform float intensity;\n uniform sampler2D tDiffuse;\n uniform sampler2D tDepth;\n uniform sampler2D tAODepth;\n varying vec2 vUv;\n\n void main() {\n vec4 texel = texture2D( tDiffuse, vUv );\n float d = textureLod(tDepth, vUv.xy, 0.0).x;\n float d2 = textureLod(tAODepth, vUv.xy, 0.0).x;\n\n float depth = 2.0 * 1.0 * 500.0 / (500.0 + 1.0 - (2.0 * d - 1.0) * (500.0 - 1.0));\n gl_FragColor = vec4(mix(vec3(1.), texel.rgb, d2 > d ? 0.0 : intensity), texel.a);\n }\n ",P.output=C.OUTPUT.Default,P.enabled=!1,this.aoPass=P,_.fragmentShader=_.fragmentShader.replace("if(metalness==0.) return;","if(metalness<0.1) return;");const T=new z({renderer:this.renderer,scene:this.scene,camera:this.camera,groundReflector:null,selects:[]});T.output=z.OUTPUT.Default,T.blur=!0,T.fresnel=!1,T.distanceAttenuation=!0,T.maxDistance=50,T.selective=!0,T.bouncing=!1,T.opacity=.4,T.enabled=!1!==this.options?.reflection?.enabled,this.ssrPass=T,this.composer.addPass(T),!1!==this.options.ao?.enabled&&this.composer.addPass(P),this.renderer.info.autoReset=!1;const y=new c(this.renderer);y.renderToScreen=!1,y.addPass(h),y.addPass(d),this.bloomComposer=y,Q||(y.renderTarget2.texture.type=i.HalfFloatType,this.composer.renderTarget1.texture.type=i.HalfFloatType);const R=new f(new i.ShaderMaterial({uniforms:{baseTexture:{value:null},bloomTexture:{value:y.renderTarget2.texture}},vertexShader:"\n varying vec2 vUv;\n void main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n }",fragmentShader:"\n uniform sampler2D baseTexture;\n uniform sampler2D bloomTexture;\n varying vec2 vUv;\n void main() {\n gl_FragColor = ( texture2D( baseTexture, vUv ) + vec4( 1.0 ) * texture2D( bloomTexture, vUv ) );\n }",defines:{}}),"baseTexture");R.needsSwap=!0,!1!==this.options.bloom?.enabled&&this.composer.addPass(R),this.volumetricFogPass=new N(l),this.composer.addPass(this.volumetricFogPass),this.volumetricFogPass.enabled=!0,this.dofPass=new w(this.scene,this.camera,{focus:1,aperture:.025,maxblur:.01}),this.dofPass.enabled=!1,this.composer.addPass(this.dofPass);const F=new k;this.composer.addPass(F),this.colorPass=F,F.vignetteEnabled=!1,this.outlinePass=new O(new i.Vector2(t.clientWidth,t.clientHeight),this.scene,this.camera),this.outlinePass.edgeGlow=0,this.outlinePass.edgeThickness=1.5,this.outlinePass.edgeStrength=5,this.outlinePass.clear=!1,this.outlinePass.enabled=!1,this.composer.addPass(this.outlinePass);const D=new f(p);D.uniforms.resolution.value.set(1/t.clientWidth,1/t.clientHeight),this.composer.addPass(D),this.fxaaPass=D,this.fxaaPass.enabled=!1,!0===s.enableOutlines&&this.setEnableOutlines(!0),new f(u).clear=!1,this.fixStatsStyle(),this.lutPass=new m({}),this.lutPass.enabled=!1,this.composer.addPass(this.lutPass);const I=new M;this.composer.addPass(I)}fixStatsStyle(){const e=this.stats.dom;e.style.position="absolute";const t=e.getElementsByTagName("canvas");for(let e=0;e<t.length;e++)t.item(e).style.display="inline-block"}setEnableOutlines(e){this.outlinePass.enabled=e,this.fxaaPass.enabled=e}setCamera(e){this.camera=e,this.composer.passes.forEach(t=>{t instanceof g?t.camera=e:t instanceof O?t.renderCamera=e:(t instanceof H||t instanceof C)&&(t.camera=e)}),this.ssrPass&&(this.ssrPass.camera=e),this.aoPass&&(this.aoPass.camera=e),null==this.csm?(this.csm=new R({maxFar:500,lightFar:250,lightMargin:20,cascades:Q?2:4,shadowMapSize:2048*(Q?.5:1),lightDirection:new i.Vector3(.5,-1,-.6).normalize(),lightIntensity:.5*Math.PI,camera:this.camera,parent:this.scene}),h.lights_fragment_begin=P.lights_fragment_begin):(this.csm.camera=this.camera,this.camera instanceof l&&(this.csm.maxFar=this.camera.far)),this.csm.updateFrustums()}setSelectedObjects(e){if(null==this.outlinePass)return;const t=new Map;for(const s of e)t.set(s.uuid,s);for(const s of e)s.traverse(e=>{e.uuid!==s.uuid&&t.has(e.uuid)&&t.delete(e.uuid)});this.outlinePass.selectedObjects=Array.from(t.values())}static createDepthRenderTarget(e,t){var s=!!e.extensions.get("WEBGL_depth_texture");const r=new i.WebGLRenderTarget(t.clientWidth*e.getPixelRatio(),t.clientHeight*e.getPixelRatio());return r.texture.minFilter=i.NearestFilter,r.texture.magFilter=i.NearestFilter,r.texture.type=i.FloatType,r.texture.generateMipmaps=!1,r.stencilBuffer=!1,!0===s&&(r.depthTexture=new i.DepthTexture(128,128),r.depthTexture.type=i.UnsignedShortType,r.depthTexture.minFilter=i.NearestFilter,r.depthTexture.magFilter=i.NearestFilter),r}static createAOMaskDepthRenderTarget(e,t){const s=new i.WebGLRenderTarget(t.clientWidth*e.getPixelRatio(),t.clientHeight*e.getPixelRatio(),{type:i.HalfFloatType});return s.texture.minFilter=i.NearestFilter,s.texture.magFilter=i.NearestFilter,s.texture.generateMipmaps=!1,s.stencilBuffer=!1,s.depthTexture=new i.DepthTexture(128,128),s.depthTexture.type=i.UnsignedInt248Type,s.depthTexture.minFilter=i.NearestFilter,s.depthTexture.magFilter=i.NearestFilter,s}static createSceneColorRenderTarget(e,t){const s=new i.WebGLRenderTarget(t.clientWidth*e.getPixelRatio()*.5,t.clientHeight*e.getPixelRatio()*.5,{format:i.RGBAFormat,colorSpace:i.SRGBColorSpace,stencilBuffer:!1});return s.texture.minFilter=i.LinearFilter,s.texture.magFilter=i.LinearFilter,s.texture.generateMipmaps=!1,s}setupEventListeners(){window.addEventListener("resize",this.onResize),window.addEventListener("orientationchange",this.onResize),document.addEventListener("visibilitychange",this.onVisiblityChane)}stop(){this.running=!1,window.removeEventListener("resize",this.onResize),window.removeEventListener("orientationchange",this.onResize),document.removeEventListener("visibilitychange",this.onVisiblityChane),this.onLoopCallbacks=[],this.renderer.dispose(),this.depthRenderTarget.dispose(),this.aoMaskDepthRenderTarget.dispose(),this.sceneColorRenderTarget.dispose(),this.csm.dispose(),this.container.replaceChildren(),this.volumetricFogPass.dispose()}onLoop(e){this.onLoopCallbacks.push(e)}removeOnLoop(e){const t=this.onLoopCallbacks.find(e);t>=0&&this.onLoopCallbacks.splice(t,1)}set showStats(e){this._showStats=e,this._showStats&&!this.container.contains(this.stats.dom)?this.container.appendChild(this.stats.dom):!this._showStats&&this.container.contains(this.stats.dom)&&this.container.removeChild(this.stats.dom)}get showStats(){return this._showStats}applyEnvMap(e){null!=this.scene.environment&&e instanceof T&&(null==e.uniforms.envMap&&(e.uniforms.envMap={value:this.scene.environment}),null==e.uniforms.envMapIntensity&&(e.uniforms.envMapIntensity={value:1}),e.uniforms.envMap.value=this.scene.environment,e.uniforms.envMapIntensity.value=this.scene.environmentIntensity,e.envMap=this.scene.environment)}loop(e,t=!1){const s=this.stats,r=s.addPanel(new S.Panel("Calls","#83f","#002")),l=s.addPanel(new S.Panel("Triangles","#c32","#002"));let h;navigator.userAgent.includes("Chrome")&&navigator.userAgent.includes("HologyEngine")&&(h=new U(this.renderer.getContext()),s.addPanel(h)),this.showStats=t;let d=10,c=1e3;const p=()=>{const e=this.renderer.info.render.calls;e>d&&(d=e,setTimeout(()=>d=10,5e3)),r.update(e,d);const t=this.renderer.info.render.triangles;t>c&&(c=t,setTimeout(()=>c=1e3,5e3)),l.update(t,c)};performance.now();i.Ray.prototype.intersectTriangle;const u=[],m=[],g=[];let f=0;const v=new a,x=new a;let P=this.paused;const b=t=>{const r=this.renderer.getContext();if(this.paused&&this.running&&r.drawingBufferHeight>1)return setTimeout(()=>b(t),500),void(P=!0);this.renderer.clear(),this.applyPostProcessSettings(),this.renderer.autoClear=!1,this.renderer.clear(),this.renderer.setViewport(0,0,this.container.clientWidth,this.container.clientHeight),this.camera,s.begin();let a=(t*=.001)-f;if(f=t,P&&(a=.016,P=!1),v.copy(this.camera.matrixWorld),a>1){let t=a;for(;t>.05;)e(Z),t-=Z;e(t)}else e(a);this.onLoopCallbacks.forEach(e=>e(a)),this.camera?.updateMatrixWorld(),x.copy(this.camera.matrixWorld),x.equals(v)||(this.renderer.shadowMap.needsUpdate=!0),this.resizeRender(),u.length=0,m.length=0,g.length=0;const l=ee;if(se.multiplyMatrices(this.camera.projectionMatrix,this.camera.matrixWorldInverse),l.setFromProjectionMatrix(se),this.scene.traverseVisible(e=>{if(null!=this.scene.environment&&(e instanceof o||e instanceof i.Sprite)&&function(e,t){if(Array.isArray(e.material))for(const s of e.material)t(s);else null!=e.material&&t(e.material)}(e,e=>this.applyEnvMap(e)),this.outlineEffect.apply(e),(e instanceof o||e instanceof i.Sprite)&&this.initResolutionUniform(e.material),(e instanceof o||e instanceof i.Sprite)&&e.visible&&(e.material?.userData?.water||e.material?.uniforms&&null!=e.material?.uniforms[D])&&isObjectInFrustum(e,l)?(e.visible=!1,u.push(e),this.initDepthUniform(e.material),e.renderOrder=100):e instanceof y&&(e.visible=!1,m.push(e)),(e instanceof o||e instanceof i.Sprite)&&e.material?.uniforms&&null!=e.material?.uniforms[j]&&isObjectInFrustum(e,l)?(e.visible=!1,g.push(e),e.material.uniforms[j].value=this.sceneColorRenderTarget.texture):(e instanceof o||e instanceof i.Sprite)&&function(e){if(e.material instanceof n)return e.material.transparent||e.material.alphaTest>0;if(Array.isArray(e.material))for(const t of e.material)if(t.transparent||t.alphaTest>0)return!0}(e)&&(e.visible=!1,e.layers.enable(5),m.push(e)),e instanceof o&&e.material?.uniforms&&null!=e.material?.uniforms[B])e.material.uniforms[B].value=t;else if(e instanceof o&&Array.isArray(e.material))for(const s of e.material)s.uniforms&&null!=s.uniforms[B]&&(s.uniforms[B].value=t)}),u.length>0){if(this.scene.overrideMaterial=Y,this.renderer.setRenderTarget(this.depthRenderTarget),!this.paused&&null!=this.camera)try{this.renderer.clear(),this.renderer.render(this.scene,this.camera)}catch(e){console.warn(e)}this.renderer.setRenderTarget(null),this.scene.overrideMaterial=null}if(g.length>0){if(this.renderer.setRenderTarget(this.sceneColorRenderTarget),!this.paused&&null!=this.camera)try{this.renderer.clear(!0,!0,!1);try{this.renderer.render(this.scene,this.camera)}catch(e){}}catch(e){console.warn("Error rendering scene color:",e)}this.renderer.setRenderTarget(null)}if(u.forEach(e=>e.visible=!0),m.forEach(e=>e.visible=!0),g.forEach(e=>e.visible=!0),this.aoPass.enabled){if(this.scene.overrideMaterial=Y,this.camera.layers.set(5),this.renderer.setRenderTarget(this.aoMaskDepthRenderTarget),!this.paused&&null!=this.camera)try{this.renderer.clear(),this.renderer.render(this.scene,this.camera)}catch(e){console.warn(e)}this.camera.layers.enableAll(),this.renderer.setRenderTarget(null),this.scene.overrideMaterial=null}this.ssrPass&&(this.ssrPass.elapsedTime=t),this.volumetricFogPass&&this.volumetricFogPass.update(this.camera,this.ssrPass.beautyRenderTarget,this.csm,this.scene);try{!this.paused&&this.running&&(this.showStats&&h?.startQuery(),this.render(a),this.showStats&&h?.endQuery(),this.showStats&&p(),this.renderer.info.reset(),this.renderOverlay())}catch(e){console.warn(e)}s.end(),this.csm?.update(),this.running&&!0!==this.options.enableXR&&(this.fpsCap?setTimeout(()=>{requestAnimationFrame(b)},1e3/this.fpsCap):requestAnimationFrame(b))};!0===this.options.enableXR?this.renderer.setAnimationLoop(b):requestAnimationFrame(b)}applyPostProcessSettings(){if(0==this.postProcessVolumes.length)return;var e;(e=this.postProcessSettings).tonemapMapping=void 0,e.tonemapExposure=1,e.envIntensity=1,e.envTexture=void 0,e.vignetteIntensity=0,e.colorTint=new i.Color("white"),e.colorTintIntensity=0,e.depthFocus=void 0,e.depthAperture=void 0,e.depthMaxBlur=void 0,e.temperature=6500,e.temperatureTint=0,e.lut=void 0,e.lutIntensity=0;const t=this.postProcessSettings;let s,r=!1,n=!1,a=!1;const o=this.camera?.position;if(null==o)return;let h=[];for(const e of this.postProcessVolumes){if(!$(e.object))continue;let l=e.blendWeight??1;const d=e.distanceToPoint(o);d>e.blendRadius||(e.blendRadius>0&&(l*=L(1-d/e.blendRadius,0,1)),l>1&&(l=1),l>0&&(h.push(e),void 0!==e.settings.tonemapMapping&&(t.tonemapMapping=e.settings.tonemapMapping),void 0!==e.settings.tonemapExposure&&(t.tonemapExposure=i.MathUtils.lerp(t.tonemapExposure,e.settings.tonemapExposure,l)),void 0!==e.settings.envTexture&&(t.envTexture=e.settings.envTexture),void 0!==e.settings.envIntensity&&(t.envIntensity=i.MathUtils.lerp(t.envIntensity,e.settings.envIntensity,l)),void 0!==e.settings.vignetteIntensity&&(t.vignetteIntensity=i.MathUtils.lerp(t.vignetteIntensity,e.settings.vignetteIntensity,l),n=!0),void 0!==e.settings.colorTint&&void 0!==e.settings.colorTintIntensity&&e.settings.colorTintIntensity>0&&(t.colorTint=t.colorTint.lerp(e.settings.colorTint,l)),void 0!==e.settings.colorTintIntensity&&(t.colorTintIntensity=i.MathUtils.lerp(t.colorTintIntensity,e.settings.colorTintIntensity,l)),void 0!==e.settings.depthFocus&&(r=!0,t.depthFocus=void 0!==t.depthFocus?i.MathUtils.lerp(t.depthFocus,e.settings.depthFocus,l):e.settings.depthFocus),void 0!==e.settings.depthAperture&&(r=!0,t.depthAperture=void 0!==t.depthAperture?i.MathUtils.lerp(t.depthAperture,e.settings.depthAperture,l):e.settings.depthAperture),void 0!==e.settings.depthMaxBlur&&(r=!0,t.depthMaxBlur=void 0!==t.depthMaxBlur?i.MathUtils.lerp(t.depthMaxBlur,e.settings.depthMaxBlur,l):e.settings.depthMaxBlur),void 0!==e.settings.temperature&&(t.temperature=i.MathUtils.lerp(t.temperature,e.settings.temperature,l)),void 0!==e.settings.temperatureTint&&(t.temperatureTint=i.MathUtils.lerp(t.temperatureTint,e.settings.temperatureTint,l)),void 0!==e.settings.lut&&(s=e.settings.lut,a=!0),void 0!==e.settings.lutIntensity&&(t.lutIntensity=i.MathUtils.lerp(t.lutIntensity,e.settings.lutIntensity,l),a=!0)))}this.renderer.toneMapping=t.tonemapMapping??i.NoToneMapping,this.renderer.toneMappingExposure=t.tonemapExposure,this.scene.environment=t.envTexture,this.scene.environmentIntensity=t.envIntensity,this.colorPass.vignetteIntensity=t.vignetteIntensity,this.colorPass.vignetteEnabled=n,this.colorPass.colorTint=t.colorTint,this.colorPass.colorTintIntensity=t.colorTintIntensity,r&&this.camera instanceof l?(this.dofPass.enabled=!0,void 0!==t.depthFocus&&(this.dofPass.uniforms.focus.value=t.depthFocus),void 0!==t.depthAperture&&(this.dofPass.uniforms.aperture.value=t.depthAperture),void 0!==t.depthMaxBlur&&(this.dofPass.uniforms.maxblur.value=t.depthMaxBlur)):this.dofPass.enabled=!1,this.colorPass.temperature=t.temperature,this.colorPass.temperatureTint=t.temperatureTint,this.lutPass.enabled=a,a&&(null!=s&&(s.flipY=!0,s.generateMipmaps=!1),this.lutPass.lut=s,this.lutPass.intensity=t.lutIntensity)}renderOverlay(){const e=Array.from(this.overlayCameras.values()).slice(0,this.maxInsetCameras),t=this.container.clientWidth/2,s=e.length*this.insetWidth+(e.length-1)*this.insetMargin;for(let i=0;i<e.length;i++)this.renderer.clearDepth(),this.renderer.setViewport(t-s/2+this.insetWidth*i+this.insetMargin*i,this.insetOffsetY,this.insetWidth,this.insetHeight),this.renderer.render(this.scene,e[i])}addOverlayCamera(e){this.overlayCameras.add(e)}clearOverlayCameras(){this.overlayCameras.clear()}removeOverlayCamera(e){this.overlayCameras.delete(e)}render(e){if(0===this.composer.renderTarget1.width||0===this.composer.renderTarget1.height)return;if(0===this.composer.renderTarget2.width||0===this.composer.renderTarget2.height)return;let t=!1;if(this.ssrPass.enabled&&!1!==this.options?.reflection?.enabled){const e=this.ssrPass.selects??[];e.length=0,this.scene.traverseVisible(t=>{t instanceof o&&!0===t.material.userData?.reflective&&e.push(t)}),this.ssrPass.selects=e,0==e.length&&!1===this.volumetricFogPass.enabled&&(this.ssrPass.enabled=!1),t=!0}else!1===this.volumetricFogPass.enabled&&(this.ssrPass.enabled=!1,t=!0);if(!1!==this.options.bloom?.enabled){const e=this.hasBloom();if(e||this.hadBloom){const e=this.scene.fog;this.scene.fog=null;const t=this.renderer.getClearColor(this.prevClearColor);this.renderer.setClearColor(0),this.scene.traverseVisible(e=>this.darkenNonBloomed(e));try{this.bloomComposer.render()}catch(e){J||(console.error(e),J=!0)}this.scene.traverse(e=>this.restoreMaterial(e)),this.bloomHidden.forEach(e=>e.visible=!0),this.bloomHidden.length=0,this.renderer.setClearColor(t),this.scene.fog=e}this.hadBloom=e}this.composer.render(e),t&&(this.ssrPass.enabled=!0)}hasBloom(){return null!=V(this.scene,e=>e instanceof o&&!0===e.material?.userData?.hasBloom)}darkenNonBloomed(e){if((e instanceof o||e instanceof i.Sprite||e instanceof i.Line)&&e.visible&&(null==e.material.userData||!0!==e.material.userData.hasBloom)){if(e.material?.id===X.id)return;this.bloomStoredMaterials[e.uuid]=e.material,!0!==e.material.transparent?e.material=X:e.visible=!1}else"TransformControlsPlane"!==e.type&&"TransformControlsGizmo"!==e.type||(e.visible=!1,this.bloomHidden.push(e))}restoreMaterial(e){this.bloomStoredMaterials[e.uuid]&&(e.material=this.bloomStoredMaterials[e.uuid],delete this.bloomStoredMaterials[e.uuid],e.visible=!0)}initDepthUniform(e){e instanceof d&&(e.uniforms[D].value=this.isDepthTextureExtensionSupported?this.depthRenderTarget.depthTexture:this.depthRenderTarget.texture,this.camera instanceof l&&(null!=e.uniforms[A]&&(e.uniforms[A].value=this.camera.near),null!=e.uniforms[I]&&(e.uniforms[I].value=this.camera.far)))}initResolutionUniform(e){e instanceof d&&null!=e.uniforms[E]&&e.uniforms[E].value.set(this.container.clientWidth*this.renderer.getPixelRatio(),this.container.clientHeight*this.renderer.getPixelRatio())}};K=e=t([F(),s("design:paramtypes",[HTMLElement,Object])],K);export{K as RenderingView};let J=!1;export function setRenderingPaused(e){null!=window.editor?.viewer?.renderingView&&(window.editor.viewer.renderingView.paused=e)}const Z=.05;function $(e){let t=e;for(;t;){if(!1===t.visible)return!1;t=t.parent}return!0}C.prototype.overrideVisibility=function(){const e=this.scene,t=this._visibilityCache;e.traverse(function(e){if(t.set(e,e.visible),(e.isPoints||e.isLine||e.isTransformControls)&&(e.visible=!1),null!=e.material){let t=!1;if(Array.isArray(e.material)){for(const s of e.material)if(null!=s.alphaTest&&s.alphaTest>0){t=!0;break}}else null!=e.material.alphaTest&&e.material.alphaTest>0&&(t=!0);t&&(e.visible=!1)}})};const ee=new i.Frustum,te=new i.Box3,se=new i.Matrix4;export function isObjectInFrustum(e,t){const s=te.setFromObject(e);return t.intersectsBox(s)}/*
|
|
2
2
|
* Copyright (©) 2025 Hology Interactive AB. All rights reserved.
|
|
3
3
|
* See the LICENSE.md file for details.
|
|
4
4
|
*/
|
|
@@ -21,6 +21,7 @@ type DirectionalLightSettings = {
|
|
|
21
21
|
intensity: number;
|
|
22
22
|
direction: number[];
|
|
23
23
|
castShadow: boolean;
|
|
24
|
+
volumetricIntensity: number;
|
|
24
25
|
};
|
|
25
26
|
type PointLightSettings = {
|
|
26
27
|
color: string;
|
|
@@ -28,6 +29,7 @@ type PointLightSettings = {
|
|
|
28
29
|
distance: number;
|
|
29
30
|
decay: number;
|
|
30
31
|
castShadow: boolean;
|
|
32
|
+
volumetricIntensity: number;
|
|
31
33
|
};
|
|
32
34
|
type SpotLightSettings = {
|
|
33
35
|
color: string;
|
|
@@ -37,10 +39,12 @@ type SpotLightSettings = {
|
|
|
37
39
|
angle: number;
|
|
38
40
|
penumbra: number;
|
|
39
41
|
castShadow: boolean;
|
|
42
|
+
volumetricIntensity: number;
|
|
40
43
|
};
|
|
41
44
|
type AmbientLightSettings = {
|
|
42
45
|
color: string;
|
|
43
46
|
intensity: number;
|
|
47
|
+
volumetricIntensity: number;
|
|
44
48
|
};
|
|
45
49
|
export type SceneObject = {
|
|
46
50
|
id: SceneObjectId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"materializer.d.ts","sourceRoot":"","sources":["../../src/scene/materializer.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAgB,MAAM,MAAM,CAAA;AAC5C,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAGE,KAAK,EAEZ,QAAQ,EAMR,QAAQ,EAGR,KAAK,EAIL,OAAO,EAER,MAAM,OAAO,CAAA;AAad,OAAO,EAAC,iBAAiB,EAAU,MAAM,QAAQ,CAAC;AAGlD,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AAC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