@dcl/wearable-preview 1.28.2-16127858797.commit-a29e698 → 1.28.2-16128120171.commit-95a6700
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.
|
@@ -16063,7 +16063,7 @@ vReflectionMapTexCoord.z=worldPos.w;
|
|
|
16063
16063
|
#endif
|
|
16064
16064
|
#include<logDepthVertex>
|
|
16065
16065
|
}
|
|
16066
|
-
`;ce.ShadersStore[NY]=FY;var BY=function(n){j(t,n);function t(){var e=n.call(this)||this;return e.BUMP=!1,e.REFLECTION=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SPECULARTERM=!1,e.LOGARITHMICDEPTH=!1,e.FRESNELSEPARATE=!1,e.BUMPSUPERIMPOSE=!1,e.BUMPAFFECTSREFLECTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.rebuild(),e}return t}(br),VY=function(n){j(t,n);function t(e,i,r){r===void 0&&(r=new Be(512,512));var o=n.call(this,e,i)||this;return o.renderTargetSize=r,o.diffuseColor=new me(1,1,1),o.specularColor=new me(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new Be(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new me(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new me(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._renderTargets=new vr(16),o._mesh=null,o._reflectionTransform=te.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(i,r),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&this._refractionRTT.refreshRate===0)},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,i,r){if(this.isFrozen&&i.effect&&i.effect._wasPreviouslyReady)return!0;i._materialDefines||(i._materialDefines=new BY);var o=i._materialDefines,a=this.getScene();if(this._isReadyForSubMesh(i))return!0;var s=a.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,a.texturesEnabled)){if(this.bumpTexture&&ke.BumpTextureEnabled)if(this.bumpTexture.isReady())o._needUVs=!0,o.BUMP=!0;else return!1;ke.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if(ne.PrepareDefinesForFrameBoundValues(a,s,o,!!r),ne.PrepareDefinesForMisc(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),o._areMiscDirty&&(this._fresnelSeparate&&(o.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(o.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(o.BUMPAFFECTSREFLECTION=!0)),o._needNormals=ne.PrepareDefinesForLights(a,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=this.reflectionTexture!=null&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=this.refractionTexture!=null&&!this.refractionTexture.gammaSpace}if(ne.PrepareDefinesForAttributes(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var l=0;l<this._waitingRenderList.length;l++)this.addToRenderList(a.getNodeByID(this._waitingRenderList[l]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),a.resetCachedMaterial();var u=new Er;o.FOG&&u.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&u.addFallback(0,"LOGARITHMICDEPTH"),ne.HandleFallbacksForShadows(o,u,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&u.addCPUSkinningFallback(0,e);var f=[I.PositionKind];o.NORMAL&&f.push(I.NormalKind),o.UV1&&f.push(I.UVKind),o.UV2&&f.push(I.UV2Kind),o.VERTEXCOLOR&&f.push(I.ColorKind),ne.PrepareAttributesForBones(f,e,o,u),ne.PrepareAttributesForInstances(f,o);var c="water",h=o.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],_=["normalSampler","refractionSampler","reflectionSampler"],g=new Array;Wi&&(Wi.PrepareUniforms(p,o),Wi.PrepareSamplers(_,o)),ne.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),i.setEffect(a.getEngine().createEffect(c,{attributes:f,uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:h,fallbacks:u,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},s),o)}return!i.effect||!i.effect.isReady()?!1:(o._renderId=a.getRenderId(),i.effect._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,i,r){var o=this.getScene(),a=r._materialDefines;if(a){var s=r.effect;if(!(!s||!this._mesh)){this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),ne.BindBonesParameters(i,this._activeEffect),this._mustRebind(o,s)&&(this.bumpTexture&&ke.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),ne.BindClipPlane(this._activeEffect,o),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),ne.BindEyePosition(s,o)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*i.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),o.lightsEnabled&&!this.disableLighting&&ne.BindLights(o,i,this._activeEffect,a,this.maxSimultaneousLights),o.fogEnabled&&i.applyFog&&o.fogMode!==Ke.FOGMODE_NONE&&this._activeEffect.setMatrix("view",o.getViewMatrix()),ne.BindFogParameters(o,i,this._activeEffect),ne.BindLogDepth(a,this._activeEffect,o),ke.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var l=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(o.getProjectionMatrix()),u=o.getEngine().getDeltaTime();u!==this._lastDeltaTime&&(this._lastDeltaTime=u,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",l),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(i,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,i){var r=this;this._refractionRTT=new $i(name+"_refraction",{width:i.x,height:i.y},e,!1,!0),this._refractionRTT.wrapU=vo.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=vo.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new $i(name+"_reflection",{width:i.x,height:i.y},e,!1,!0),this._reflectionRTT.wrapU=vo.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=vo.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s,l=te.Zero();this._refractionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Bo.FromPositionAndNormal(new b(0,u+.05,0),new b(0,1,0))}},this._refractionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),r.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Bo.FromPositionAndNormal(new b(0,u-.05,0),new b(0,-1,0)),te.ReflectionToRef(e.clipPlane,l)}s=e.getViewMatrix(),l.multiplyToRef(s,r._reflectionTransform),e.setTransformMatrix(r._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=b.TransformCoordinates(e.activeCamera.position,l)},this._reflectionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),e.clipPlane=a,e.setTransformMatrix(s,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._bumpTexture&&e.push(this._bumpTexture),e},t.prototype.hasTexture=function(e){return!!(n.prototype.hasTexture.call(this,e)||this._bumpTexture===e)},t.prototype.dispose=function(e){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);i!=-1&&this.getScene().customRenderTargets.splice(i,1),i=-1,i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT),i!=-1&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),n.prototype.dispose.call(this,e)},t.prototype.clone=function(e){var i=this;return Fe.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=Fe.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)e.renderList.push(this._refractionRTT.renderList[i].id);return e},t.prototype.getClassName=function(){return"WaterMaterial"},t.Parse=function(e,i,r){var o=Fe.Parse(function(){return new t(e.name,i)},e,i,r);return o._waitingRenderList=e.renderList,o},t.CreateDefaultMesh=function(e,i){var r=oe.CreateGround(e,512,512,32,i,!1);return r},A([at("bumpTexture")],t.prototype,"_bumpTexture",void 0),A([ye("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),A([Ft()],t.prototype,"diffuseColor",void 0),A([Ft()],t.prototype,"specularColor",void 0),A([w()],t.prototype,"specularPower",void 0),A([w("disableLighting")],t.prototype,"_disableLighting",void 0),A([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),A([w("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),A([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),A([w()],t.prototype,"windForce",void 0),A([rb()],t.prototype,"windDirection",void 0),A([w()],t.prototype,"waveHeight",void 0),A([w()],t.prototype,"bumpHeight",void 0),A([w("bumpSuperimpose")],t.prototype,"_bumpSuperimpose",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpSuperimpose",void 0),A([w("fresnelSeparate")],t.prototype,"_fresnelSeparate",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"fresnelSeparate",void 0),A([w("bumpAffectsReflection")],t.prototype,"_bumpAffectsReflection",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpAffectsReflection",void 0),A([Ft()],t.prototype,"waterColor",void 0),A([w()],t.prototype,"colorBlendFactor",void 0),A([Ft()],t.prototype,"waterColor2",void 0),A([w()],t.prototype,"colorBlendFactor2",void 0),A([w()],t.prototype,"waveLength",void 0),A([w()],t.prototype,"waveSpeed",void 0),A([w()],t.prototype,"waveCount",void 0),A([w()],t.prototype,"disableClipPlane",void 0),A([w()],t.prototype,"useLogarithmicDepth",null),t}(Ir);Pe.RegisteredTypes["BABYLON.WaterMaterial"]=VY;function UY(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)}const kY=["data:EnvironmentBRDFTexture0","GlowLayerBlurRTT","GlowLayerBlurRTT2","HighlightLayerMainRTT"];function zY(n,t,e){async function i(u,f){return Te.CreateScreenshotUsingRenderTargetAsync(n,e,{width:u,height:f},void 0,void 0,!0)}async function r(u){e.inertialRadiusOffset=e.inertialRadiusOffset+u}async function o(u){const{x:f,y:c,z:h}=u;e.target.x=f||0,e.target.y=c||0,e.target.z=h||0}async function a(u){const{alpha:f,beta:c,radius:h}=u;f&&(e.alpha=e.alpha+f),c&&(e.beta=e.beta+c),h&&(e.radius=e.radius+h)}async function s(){const u=t.meshes.filter(p=>!p.name.toLowerCase().includes("collider")).reduce((p,_)=>p+Math.floor(_.getTotalIndices()/3),0),f=t.materials.length,c=t.meshes.length,h=t.textures.filter(p=>p.name&&!kY.includes(p.name)).length;return{triangles:u,materials:f,meshes:c,textures:h,bodies:c,entities:1}}async function l(){}return{getScreenshot:i,getMetrics:s,panCamera:o,changeZoom:r,changeCameraPosition:a,cleanup:l}}var GY={};const vI=GY.REACT_APP_DEBUG;vI&&require("@babylonjs/inspector");function WY(n){const t=n.getChildren().filter(e=>e.id!=="__root__");if(t.length>0){const e=t[0];let i=e.getBoundingInfo(),r=i.boundingBox.minimumWorld.add(e.position),o=i.boundingBox.maximumWorld.add(e.position);for(let a=1;a<t.length;a++){const s=t[a];i=s.getBoundingInfo();const l=i.boundingBox.minimumWorld.add(s.position),u=i.boundingBox.maximumWorld.add(s.position);r=b.Minimize(r,l),o=b.Maximize(o,u)}n.setBoundingInfo(new cr(r,o))}}let Nl;async function HY(n,t){Nl&&Nl.dispose(),Nl=new xe(n,!0,{preserveDrawingBuffer:!0,stencil:!0,antialias:!0});const e=new Ke(Nl);if(e.autoClear=!0,e.clearColor=t.background.transparent?new it(0,0,0,0):dy(t.background.color).toColor4(),e.ambientColor=new me(1,1,1),e.preventDefaultOnPointerDown=!1,t.showSceneBoundaries){const s=vv.CreateGround("ground",{width:6,height:6},e),l=vv.CreateGround("ground",{width:6,height:6},e);l.rotate(Oi.Z,Math.PI),l.position.y=-.05;const u=new gI("groundMaterial",e);u.mainColor=new me(1,1,1),u.lineColor=new me(0,0,0),u.majorUnitFrequency=0,s.material=u,l.material=u;const f=vv.CreateCylinder("boundaries",{diameter:2,height:3}),c=new Mt("boundariesMaterial",e);c.alpha=.3,c.diffuseColor=new me(1,45/255,85/255),f.material=c,f.position.y=1.51}if(t.showThumbnailBoundaries){const s=xb.CreateFullscreenUI("UI"),l=new no;l.width=.5,l.height=1,l.color="#736E7D",l.thickness=2,s.addControl(l)}const i=new Js("camera",0,0,0,new b(0,0,0),e);switch(i.position=new b(t.cameraX,t.cameraY,t.cameraZ),i.minZ=.1,t.projection){case Ae.PreviewProjection.PERSPECTIVE:{i.mode=dt.PERSPECTIVE_CAMERA;break}case Ae.PreviewProjection.ORTHOGRAPHIC:{i.mode=dt.ORTHOGRAPHIC_CAMERA,i.orthoTop=1,i.orthoBottom=-1,i.orthoLeft=-1,i.orthoRight=1;break}}t.type===Ae.PreviewType.WEARABLE&&sI(i,t),t.camera===Ae.PreviewCamera.INTERACTIVE&&i.attachControl(n,!0);const r=new b(t.offsetX,t.offsetY,t.offsetZ);if(i.position.addInPlace(r),i.setTarget(r),i.lowerRadiusLimit=i.radius/t.zoom,i.upperRadiusLimit=i.lowerRadiusLimit*t.wheelZoom,i.radius=i.lowerRadiusLimit+(i.upperRadiusLimit-i.lowerRadiusLimit)*t.wheelStart/100,i.wheelPrecision=t.wheelPrecision,t.panning||(i.panningSensibility=0),t.lockBeta&&(i.lowerBetaLimit=i.beta,i.upperBetaLimit=i.beta),t.lockAlpha&&(i.lowerAlphaLimit=i.alpha,i.upperAlphaLimit=i.alpha),t.lockRadius&&(i.lowerRadiusLimit=i.radius,i.upperRadiusLimit=i.radius),t.type===Ae.PreviewType.WEARABLE){const s=new su("directional",new b(0,0,1),e);s.intensity=1;const l=new lu("spot",new b(-2,2,2),new b(2,-2,-2),Math.PI/2,1e3,e);l.intensity=1}const o=new ko("top",new b(0,-1,0),e);o.intensity=1;const a=new ko("bottom",new b(0,1,0),e);if(a.intensity=1,!UY()){const s=new rp("glow",e);s.intensity=2}return Nl.runRenderLoop(()=>{e.render()}),vI&&e.debugLayer.show({showExplorer:!0,embedMode:!0}),[e,zY(Nl,e,i)]}async function jY(n,t,e){const i=t.id,o=uu(t,e).contents.find(a=>a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Yx(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}async function XY(n,t,e){const i=t.id,o=uu(t,e).contents.find(a=>a.key.toLowerCase().endsWith(".png")&&!a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Yx(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}function YY(n,t){return new Promise((e,i)=>{var l;const r=(l=t.contents.find(u=>u.key.toLowerCase().endsWith(".mp3")||u.key.toLowerCase().endsWith("ogg")))==null?void 0:l.url;if(!r)return e(null);const o=new aj("Sound task",r),a=()=>e(new Ql("music",o.data,n,null,{spatialSound:!0})),s=u=>i(u);o.run(n,a,s)})}async function yI(n,t){const e=async(i,r)=>$t.LoadAssetContainerAsync(i,"",n,null,r);try{return await e(t,".glb")}catch{return await e(t,".gltf")}}function KY(n){const t=new oe("parent",n);for(const a of n.meshes)a!==t&&a.setParent(t);WY(t);const i=t.getBoundingInfo().boundingBox.extendSize.length(),r=new b(1/i,1/i,1/i);t.scaling=r;const o=t.getBoundingInfo().boundingBox.center.multiply(r);t.position.subtractInPlace(o)}var qY={};const QY=[Ae.PreviewEmote.IDLE,Ae.PreviewEmote.MONEY,Ae.PreviewEmote.CLAP,Ae.PreviewEmote.WALK,Ae.PreviewEmote.RUN,Ae.PreviewEmote.JUMP];let pd;function $Y(n){return QY.includes(n)}function ZY(n){let t=qY.PUBLIC_URL||"";t.endsWith("/")||(t+="/");const e=`./emotes/${n}.glb`;return t.startsWith("http")?new URL(e,t).href:e}async function bI(n,t){const e=await yI(n,t);if(e.animationGroups.length===0)throw new Error(`No animation groups found for emote with url=${t}`);return e}async function JY(n,t,e){const i=Pb(t,e.bodyShape),r=i.contents.find(o=>o.key===i.mainFile);if(!r)throw new Error(`Could not find a valid content in representation for emote=${t.id} and bodyShape=${e.bodyShape}`);return bI(n,r.url)}function e6(n,t,e){const i=Pb(t,e.bodyShape);return YY(n,i)}async function t6(n,t,e){let i,r=!!e.emote&&$Y(e.emote),o=null;if(e.item&&Fo(e.item))try{i=await JY(n,e.item,e),r=e.item.emoteDataADR74.loop,o=await e6(n,e.item,e)}catch{console.warn(`Could not load emote=${e.item.id}`)}if(!i&&e.emote){const l=ZY(e.emote);i=await bI(n,l)}i&&i.animationGroups.length>1&&(i.addAllToScene(),n.stopAllAnimations());const a=new ob("emote",n);function s(){if(e.camera!==Ae.PreviewCamera.STATIC){const l=n.cameras[0];sI(l,e)}}try{for(const u of t){const f=new Map,c=[...u.container.transformNodes,...u.container.meshes];for(const h of c){const p=h.name.replace(/\.\d+$/,""),_=f.get(p)||[];_.push(h),f.set(p,_)}if(i&&i.animationGroups.length>0)for(const h of i.animationGroups)for(const p of h.targetedAnimations){const _=p.animation.clone(),g=p.target,v=p.animation.getKeys();if(_.setKeys([...v]),i.animationGroups.length===1||h.name.toLowerCase().includes("avatar")||g.name.startsWith("Avatar_")){const T=g.name.replace(/\.\d+$/,""),S=f.get(T)||[];if(S.length>0)for(const C of S){const O=_.clone();O.setKeys([...v]),a.addTargetedAnimation(O,C)}else console.warn("No matching bone found for",g.name)}else a.addTargetedAnimation(_,g)}}a.onAnimationGroupEndObservable.addOnce(s);const l=i6(a,r,o);return e.camera===Ae.PreviewCamera.STATIC&&l.stop(),l}catch(l){console.warn(`Could not play emote=${e.emote}`,l)}}function i6(n,t,e){xe.audioEngine.useCustomUnlockedButton=!0,xe.audioEngine.setGlobalVolume(0);let i,r=!1;async function o(){return Math.max(n.to,0)}async function a(){return n.isPlaying}async function s(){return!!e}async function l(E){r=!0;const T=await a();T&&n.pause(),n.stop(),n.start(!1,1,E,E,!1),i=E,r=!0,T&&u()}async function u(){await a()||(i?(n.start(t,1,i,await o(),!1),e&&(e.stop(),e._startOffset=i,e.play()),i=0):(n.play(t),e==null||e.play()))}async function f(){await a()&&(n.pause(),e==null||e.pause())}async function c(){n.goToFrame(0),n.stop(),e==null||e.stop()}async function h(){e&&(xe.audioEngine.unlock(),xe.audioEngine.setGlobalVolume(1),n.isPlaying&&!e.isPlaying&&e.play(void 0,n.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame))}async function p(){e&&xe.audioEngine.setGlobalVolume(0)}const _=tb(),g=()=>(pd&&clearInterval(pd),window.setInterval(async()=>{var E;if(await a()&&n.animatables[0].masterFrame>0)return _.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAYING,{length:(E=n.animatables[0])==null?void 0:E.masterFrame})},10)),v=()=>{clearInterval(pd),r||_.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n.to})};return n.onAnimationGroupPlayObservable.add(()=>(pd=g(),_.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAY))),n.onAnimationGroupPauseObservable.add(()=>{_.emit(Ae.PreviewEmoteEventType.ANIMATION_PAUSE)}),n.onAnimationGroupLoopObservable.add(()=>(e==null||e.stop(),e==null||e.play(),r&&(c(),u(),r=!1),_.emit(Ae.PreviewEmoteEventType.ANIMATION_LOOP))),n.onAnimationGroupEndObservable.add(()=>(v(),t||(r=!1),_.emit(Ae.PreviewEmoteEventType.ANIMATION_END))),{getLength:o,isPlaying:a,goTo:l,play:u,pause:f,stop:c,enableSound:h,disableSound:p,hasSound:s,events:_}}function r6(n,t,e){return async i=>{const r=t.find(Wj(i));return r?Promise.all([XY(n,r,e),jY(n,r,e)]):[null,null]}}async function n6(n,t,e){const i=r6(n,t,e),[r,o,a]=await Promise.all([i(Ae.WearableCategory.EYES),i(Ae.WearableCategory.EYEBROWS),i(Ae.WearableCategory.MOUTH)]);return{eyes:r,eyebrows:o,mouth:a}}async function o6(n,t,e,i,r,o){for(const a of t.container.meshes){if(a.name.toLowerCase().endsWith("mask_eyes")){const[s,l]=e;s?Wv(n,"eyes",a,s,o.eyes,l,"#ffffff"):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_eyebrows")){const[s,l]=i;s?Wv(n,"eyebrows",a,s,o.hair,l,o.hair):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_mouth")){const[s,l]=r;s?Wv(n,"mouth",a,s,o.skin,l,o.skin):a.setEnabled(!1)}}}function Wv(n,t,e,i,r,o,a){const s=new Mt(`${t}_standard_material`,n);s.alphaMode=Pi.PBRMATERIAL_ALPHABLEND,s.backFaceCulling=!0,s.specularColor=me.Black(),i.hasAlpha=!0,s.sideOrientation=Ys.CW,s.diffuseTexture=i,s.diffuseColor=o?me.Black():dy(a),o&&(s.emissiveTexture=o,s.diffuseColor=dy(r)),e.material=s}function a6(n,t,e=Ae.BodyShape.MALE){const i={};for(const r of n)try{const o=uu(r,e);for(const a of o.contents)i[a.key]=a.url}catch{console.warn(`Skipping generation of mappings for wearable="${r.id}" since it lacks a representation for bodyShape="${e}"`);continue}if(t){const r=Pb(t,e);for(const o of r.contents)i[o.key]=o.url}return i}function s6(n){const t=is(n.item)?[n.item,...n.wearables]:n.wearables,e=Fo(n.item)?n.item:void 0,i=a6(t,e,n.bodyShape);$t.OnPluginActivatedObservable.add(r=>{if(r.name==="gltf"){const o=r;o.preprocessUrlAsync=async a=>{const l=a.split("/").pop();if(!l)return a;const f=Object.keys(i).find(c=>c.endsWith(l));return i[f]||a}}})}const l6=`float angleY = 3.14 / 2.0;
|
|
16066
|
+
`;ce.ShadersStore[NY]=FY;var BY=function(n){j(t,n);function t(){var e=n.call(this)||this;return e.BUMP=!1,e.REFLECTION=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SPECULARTERM=!1,e.LOGARITHMICDEPTH=!1,e.FRESNELSEPARATE=!1,e.BUMPSUPERIMPOSE=!1,e.BUMPAFFECTSREFLECTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.rebuild(),e}return t}(br),VY=function(n){j(t,n);function t(e,i,r){r===void 0&&(r=new Be(512,512));var o=n.call(this,e,i)||this;return o.renderTargetSize=r,o.diffuseColor=new me(1,1,1),o.specularColor=new me(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new Be(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new me(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new me(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._renderTargets=new vr(16),o._mesh=null,o._reflectionTransform=te.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(i,r),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&this._refractionRTT.refreshRate===0)},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,i,r){if(this.isFrozen&&i.effect&&i.effect._wasPreviouslyReady)return!0;i._materialDefines||(i._materialDefines=new BY);var o=i._materialDefines,a=this.getScene();if(this._isReadyForSubMesh(i))return!0;var s=a.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,a.texturesEnabled)){if(this.bumpTexture&&ke.BumpTextureEnabled)if(this.bumpTexture.isReady())o._needUVs=!0,o.BUMP=!0;else return!1;ke.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if(ne.PrepareDefinesForFrameBoundValues(a,s,o,!!r),ne.PrepareDefinesForMisc(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),o._areMiscDirty&&(this._fresnelSeparate&&(o.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(o.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(o.BUMPAFFECTSREFLECTION=!0)),o._needNormals=ne.PrepareDefinesForLights(a,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=this.reflectionTexture!=null&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=this.refractionTexture!=null&&!this.refractionTexture.gammaSpace}if(ne.PrepareDefinesForAttributes(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var l=0;l<this._waitingRenderList.length;l++)this.addToRenderList(a.getNodeByID(this._waitingRenderList[l]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),a.resetCachedMaterial();var u=new Er;o.FOG&&u.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&u.addFallback(0,"LOGARITHMICDEPTH"),ne.HandleFallbacksForShadows(o,u,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&u.addCPUSkinningFallback(0,e);var f=[I.PositionKind];o.NORMAL&&f.push(I.NormalKind),o.UV1&&f.push(I.UVKind),o.UV2&&f.push(I.UV2Kind),o.VERTEXCOLOR&&f.push(I.ColorKind),ne.PrepareAttributesForBones(f,e,o,u),ne.PrepareAttributesForInstances(f,o);var c="water",h=o.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],_=["normalSampler","refractionSampler","reflectionSampler"],g=new Array;Wi&&(Wi.PrepareUniforms(p,o),Wi.PrepareSamplers(_,o)),ne.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),i.setEffect(a.getEngine().createEffect(c,{attributes:f,uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:h,fallbacks:u,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},s),o)}return!i.effect||!i.effect.isReady()?!1:(o._renderId=a.getRenderId(),i.effect._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,i,r){var o=this.getScene(),a=r._materialDefines;if(a){var s=r.effect;if(!(!s||!this._mesh)){this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),ne.BindBonesParameters(i,this._activeEffect),this._mustRebind(o,s)&&(this.bumpTexture&&ke.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),ne.BindClipPlane(this._activeEffect,o),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),ne.BindEyePosition(s,o)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*i.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),o.lightsEnabled&&!this.disableLighting&&ne.BindLights(o,i,this._activeEffect,a,this.maxSimultaneousLights),o.fogEnabled&&i.applyFog&&o.fogMode!==Ke.FOGMODE_NONE&&this._activeEffect.setMatrix("view",o.getViewMatrix()),ne.BindFogParameters(o,i,this._activeEffect),ne.BindLogDepth(a,this._activeEffect,o),ke.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var l=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(o.getProjectionMatrix()),u=o.getEngine().getDeltaTime();u!==this._lastDeltaTime&&(this._lastDeltaTime=u,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",l),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(i,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,i){var r=this;this._refractionRTT=new $i(name+"_refraction",{width:i.x,height:i.y},e,!1,!0),this._refractionRTT.wrapU=vo.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=vo.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new $i(name+"_reflection",{width:i.x,height:i.y},e,!1,!0),this._reflectionRTT.wrapU=vo.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=vo.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s,l=te.Zero();this._refractionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Bo.FromPositionAndNormal(new b(0,u+.05,0),new b(0,1,0))}},this._refractionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),r.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Bo.FromPositionAndNormal(new b(0,u-.05,0),new b(0,-1,0)),te.ReflectionToRef(e.clipPlane,l)}s=e.getViewMatrix(),l.multiplyToRef(s,r._reflectionTransform),e.setTransformMatrix(r._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=b.TransformCoordinates(e.activeCamera.position,l)},this._reflectionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),e.clipPlane=a,e.setTransformMatrix(s,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._bumpTexture&&e.push(this._bumpTexture),e},t.prototype.hasTexture=function(e){return!!(n.prototype.hasTexture.call(this,e)||this._bumpTexture===e)},t.prototype.dispose=function(e){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);i!=-1&&this.getScene().customRenderTargets.splice(i,1),i=-1,i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT),i!=-1&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),n.prototype.dispose.call(this,e)},t.prototype.clone=function(e){var i=this;return Fe.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=Fe.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)e.renderList.push(this._refractionRTT.renderList[i].id);return e},t.prototype.getClassName=function(){return"WaterMaterial"},t.Parse=function(e,i,r){var o=Fe.Parse(function(){return new t(e.name,i)},e,i,r);return o._waitingRenderList=e.renderList,o},t.CreateDefaultMesh=function(e,i){var r=oe.CreateGround(e,512,512,32,i,!1);return r},A([at("bumpTexture")],t.prototype,"_bumpTexture",void 0),A([ye("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),A([Ft()],t.prototype,"diffuseColor",void 0),A([Ft()],t.prototype,"specularColor",void 0),A([w()],t.prototype,"specularPower",void 0),A([w("disableLighting")],t.prototype,"_disableLighting",void 0),A([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),A([w("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),A([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),A([w()],t.prototype,"windForce",void 0),A([rb()],t.prototype,"windDirection",void 0),A([w()],t.prototype,"waveHeight",void 0),A([w()],t.prototype,"bumpHeight",void 0),A([w("bumpSuperimpose")],t.prototype,"_bumpSuperimpose",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpSuperimpose",void 0),A([w("fresnelSeparate")],t.prototype,"_fresnelSeparate",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"fresnelSeparate",void 0),A([w("bumpAffectsReflection")],t.prototype,"_bumpAffectsReflection",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpAffectsReflection",void 0),A([Ft()],t.prototype,"waterColor",void 0),A([w()],t.prototype,"colorBlendFactor",void 0),A([Ft()],t.prototype,"waterColor2",void 0),A([w()],t.prototype,"colorBlendFactor2",void 0),A([w()],t.prototype,"waveLength",void 0),A([w()],t.prototype,"waveSpeed",void 0),A([w()],t.prototype,"waveCount",void 0),A([w()],t.prototype,"disableClipPlane",void 0),A([w()],t.prototype,"useLogarithmicDepth",null),t}(Ir);Pe.RegisteredTypes["BABYLON.WaterMaterial"]=VY;function UY(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)}const kY=["data:EnvironmentBRDFTexture0","GlowLayerBlurRTT","GlowLayerBlurRTT2","HighlightLayerMainRTT"];function zY(n,t,e){async function i(u,f){return Te.CreateScreenshotUsingRenderTargetAsync(n,e,{width:u,height:f},void 0,void 0,!0)}async function r(u){e.inertialRadiusOffset=e.inertialRadiusOffset+u}async function o(u){const{x:f,y:c,z:h}=u;e.target.x=f||0,e.target.y=c||0,e.target.z=h||0}async function a(u){const{alpha:f,beta:c,radius:h}=u;f&&(e.alpha=e.alpha+f),c&&(e.beta=e.beta+c),h&&(e.radius=e.radius+h)}async function s(){const u=t.meshes.filter(p=>!p.name.toLowerCase().includes("collider")).reduce((p,_)=>p+Math.floor(_.getTotalIndices()/3),0),f=t.materials.length,c=t.meshes.length,h=t.textures.filter(p=>p.name&&!kY.includes(p.name)).length;return{triangles:u,materials:f,meshes:c,textures:h,bodies:c,entities:1}}async function l(){}return{getScreenshot:i,getMetrics:s,panCamera:o,changeZoom:r,changeCameraPosition:a,cleanup:l}}var GY={};const vI=GY.REACT_APP_DEBUG;vI&&require("@babylonjs/inspector");function WY(n){const t=n.getChildren().filter(e=>e.id!=="__root__");if(t.length>0){const e=t[0];let i=e.getBoundingInfo(),r=i.boundingBox.minimumWorld.add(e.position),o=i.boundingBox.maximumWorld.add(e.position);for(let a=1;a<t.length;a++){const s=t[a];i=s.getBoundingInfo();const l=i.boundingBox.minimumWorld.add(s.position),u=i.boundingBox.maximumWorld.add(s.position);r=b.Minimize(r,l),o=b.Maximize(o,u)}n.setBoundingInfo(new cr(r,o))}}let Nl;async function HY(n,t){Nl&&Nl.dispose(),Nl=new xe(n,!0,{preserveDrawingBuffer:!0,stencil:!0,antialias:!0});const e=new Ke(Nl);if(e.autoClear=!0,e.clearColor=t.background.transparent?new it(0,0,0,0):dy(t.background.color).toColor4(),e.ambientColor=new me(1,1,1),e.preventDefaultOnPointerDown=!1,t.showSceneBoundaries){const s=vv.CreateGround("ground",{width:6,height:6},e),l=vv.CreateGround("ground",{width:6,height:6},e);l.rotate(Oi.Z,Math.PI),l.position.y=-.05;const u=new gI("groundMaterial",e);u.mainColor=new me(1,1,1),u.lineColor=new me(0,0,0),u.majorUnitFrequency=0,s.material=u,l.material=u;const f=vv.CreateCylinder("boundaries",{diameter:2,height:3}),c=new Mt("boundariesMaterial",e);c.alpha=.3,c.diffuseColor=new me(1,45/255,85/255),f.material=c,f.position.y=1.51}if(t.showThumbnailBoundaries){const s=xb.CreateFullscreenUI("UI"),l=new no;l.width=.5,l.height=1,l.color="#736E7D",l.thickness=2,s.addControl(l)}const i=new Js("camera",0,0,0,new b(0,0,0),e);switch(i.position=new b(t.cameraX,t.cameraY,t.cameraZ),i.minZ=.1,t.projection){case Ae.PreviewProjection.PERSPECTIVE:{i.mode=dt.PERSPECTIVE_CAMERA;break}case Ae.PreviewProjection.ORTHOGRAPHIC:{i.mode=dt.ORTHOGRAPHIC_CAMERA,i.orthoTop=1,i.orthoBottom=-1,i.orthoLeft=-1,i.orthoRight=1;break}}t.type===Ae.PreviewType.WEARABLE&&sI(i,t),t.camera===Ae.PreviewCamera.INTERACTIVE&&i.attachControl(n,!0);const r=new b(t.offsetX,t.offsetY,t.offsetZ);if(i.position.addInPlace(r),i.setTarget(r),i.lowerRadiusLimit=i.radius/t.zoom,i.upperRadiusLimit=i.lowerRadiusLimit*t.wheelZoom,i.radius=i.lowerRadiusLimit+(i.upperRadiusLimit-i.lowerRadiusLimit)*t.wheelStart/100,i.wheelPrecision=t.wheelPrecision,t.panning||(i.panningSensibility=0),t.lockBeta&&(i.lowerBetaLimit=i.beta,i.upperBetaLimit=i.beta),t.lockAlpha&&(i.lowerAlphaLimit=i.alpha,i.upperAlphaLimit=i.alpha),t.lockRadius&&(i.lowerRadiusLimit=i.radius,i.upperRadiusLimit=i.radius),t.type===Ae.PreviewType.WEARABLE){const s=new su("directional",new b(0,0,1),e);s.intensity=1;const l=new lu("spot",new b(-2,2,2),new b(2,-2,-2),Math.PI/2,1e3,e);l.intensity=1}const o=new ko("top",new b(0,-1,0),e);o.intensity=1;const a=new ko("bottom",new b(0,1,0),e);if(a.intensity=1,!UY()){const s=new rp("glow",e);s.intensity=2}return Nl.runRenderLoop(()=>{e.render()}),vI&&e.debugLayer.show({showExplorer:!0,embedMode:!0}),[e,zY(Nl,e,i)]}async function jY(n,t,e){const i=t.id,o=uu(t,e).contents.find(a=>a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Yx(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}async function XY(n,t,e){const i=t.id,o=uu(t,e).contents.find(a=>a.key.toLowerCase().endsWith(".png")&&!a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Yx(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}function YY(n,t){return new Promise((e,i)=>{var l;const r=(l=t.contents.find(u=>u.key.toLowerCase().endsWith(".mp3")||u.key.toLowerCase().endsWith("ogg")))==null?void 0:l.url;if(!r)return e(null);const o=new aj("Sound task",r),a=()=>e(new Ql("music",o.data,n,null,{spatialSound:!0})),s=u=>i(u);o.run(n,a,s)})}async function yI(n,t){const e=async(i,r)=>$t.LoadAssetContainerAsync(i,"",n,null,r);try{return await e(t,".glb")}catch{return await e(t,".gltf")}}function KY(n){const t=new oe("parent",n);for(const a of n.meshes)a!==t&&a.setParent(t);WY(t);const i=t.getBoundingInfo().boundingBox.extendSize.length(),r=new b(1/i,1/i,1/i);t.scaling=r;const o=t.getBoundingInfo().boundingBox.center.multiply(r);t.position.subtractInPlace(o)}var qY={};const QY=[Ae.PreviewEmote.IDLE,Ae.PreviewEmote.MONEY,Ae.PreviewEmote.CLAP,Ae.PreviewEmote.WALK,Ae.PreviewEmote.RUN,Ae.PreviewEmote.JUMP];let pd;function $Y(n){return QY.includes(n)}function ZY(n){let t=qY.VITE_BASE_URL||"";t.endsWith("/")||(t+="/");const e=`./emotes/${n}.glb`;return t.startsWith("http")?new URL(e,t).href:e}async function bI(n,t){const e=await yI(n,t);if(e.animationGroups.length===0)throw new Error(`No animation groups found for emote with url=${t}`);return e}async function JY(n,t,e){const i=Pb(t,e.bodyShape),r=i.contents.find(o=>o.key===i.mainFile);if(!r)throw new Error(`Could not find a valid content in representation for emote=${t.id} and bodyShape=${e.bodyShape}`);return bI(n,r.url)}function e6(n,t,e){const i=Pb(t,e.bodyShape);return YY(n,i)}async function t6(n,t,e){let i,r=!!e.emote&&$Y(e.emote),o=null;if(e.item&&Fo(e.item))try{i=await JY(n,e.item,e),r=e.item.emoteDataADR74.loop,o=await e6(n,e.item,e)}catch{console.warn(`Could not load emote=${e.item.id}`)}if(!i&&e.emote){const l=ZY(e.emote);i=await bI(n,l)}i&&i.animationGroups.length>1&&(i.addAllToScene(),n.stopAllAnimations());const a=new ob("emote",n);function s(){if(e.camera!==Ae.PreviewCamera.STATIC){const l=n.cameras[0];sI(l,e)}}try{for(const u of t){const f=new Map,c=[...u.container.transformNodes,...u.container.meshes];for(const h of c){const p=h.name.replace(/\.\d+$/,""),_=f.get(p)||[];_.push(h),f.set(p,_)}if(i&&i.animationGroups.length>0)for(const h of i.animationGroups)for(const p of h.targetedAnimations){const _=p.animation.clone(),g=p.target,v=p.animation.getKeys();if(_.setKeys([...v]),i.animationGroups.length===1||h.name.toLowerCase().includes("avatar")||g.name.startsWith("Avatar_")){const T=g.name.replace(/\.\d+$/,""),S=f.get(T)||[];if(S.length>0)for(const C of S){const O=_.clone();O.setKeys([...v]),a.addTargetedAnimation(O,C)}else console.warn("No matching bone found for",g.name)}else a.addTargetedAnimation(_,g)}}a.onAnimationGroupEndObservable.addOnce(s);const l=i6(a,r,o);return e.camera===Ae.PreviewCamera.STATIC&&l.stop(),l}catch(l){console.warn(`Could not play emote=${e.emote}`,l)}}function i6(n,t,e){xe.audioEngine.useCustomUnlockedButton=!0,xe.audioEngine.setGlobalVolume(0);let i,r=!1;async function o(){return Math.max(n.to,0)}async function a(){return n.isPlaying}async function s(){return!!e}async function l(E){r=!0;const T=await a();T&&n.pause(),n.stop(),n.start(!1,1,E,E,!1),i=E,r=!0,T&&u()}async function u(){await a()||(i?(n.start(t,1,i,await o(),!1),e&&(e.stop(),e._startOffset=i,e.play()),i=0):(n.play(t),e==null||e.play()))}async function f(){await a()&&(n.pause(),e==null||e.pause())}async function c(){n.goToFrame(0),n.stop(),e==null||e.stop()}async function h(){e&&(xe.audioEngine.unlock(),xe.audioEngine.setGlobalVolume(1),n.isPlaying&&!e.isPlaying&&e.play(void 0,n.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame))}async function p(){e&&xe.audioEngine.setGlobalVolume(0)}const _=tb(),g=()=>(pd&&clearInterval(pd),window.setInterval(async()=>{var E;if(await a()&&n.animatables[0].masterFrame>0)return _.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAYING,{length:(E=n.animatables[0])==null?void 0:E.masterFrame})},10)),v=()=>{clearInterval(pd),r||_.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n.to})};return n.onAnimationGroupPlayObservable.add(()=>(pd=g(),_.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAY))),n.onAnimationGroupPauseObservable.add(()=>{_.emit(Ae.PreviewEmoteEventType.ANIMATION_PAUSE)}),n.onAnimationGroupLoopObservable.add(()=>(e==null||e.stop(),e==null||e.play(),r&&(c(),u(),r=!1),_.emit(Ae.PreviewEmoteEventType.ANIMATION_LOOP))),n.onAnimationGroupEndObservable.add(()=>(v(),t||(r=!1),_.emit(Ae.PreviewEmoteEventType.ANIMATION_END))),{getLength:o,isPlaying:a,goTo:l,play:u,pause:f,stop:c,enableSound:h,disableSound:p,hasSound:s,events:_}}function r6(n,t,e){return async i=>{const r=t.find(Wj(i));return r?Promise.all([XY(n,r,e),jY(n,r,e)]):[null,null]}}async function n6(n,t,e){const i=r6(n,t,e),[r,o,a]=await Promise.all([i(Ae.WearableCategory.EYES),i(Ae.WearableCategory.EYEBROWS),i(Ae.WearableCategory.MOUTH)]);return{eyes:r,eyebrows:o,mouth:a}}async function o6(n,t,e,i,r,o){for(const a of t.container.meshes){if(a.name.toLowerCase().endsWith("mask_eyes")){const[s,l]=e;s?Wv(n,"eyes",a,s,o.eyes,l,"#ffffff"):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_eyebrows")){const[s,l]=i;s?Wv(n,"eyebrows",a,s,o.hair,l,o.hair):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_mouth")){const[s,l]=r;s?Wv(n,"mouth",a,s,o.skin,l,o.skin):a.setEnabled(!1)}}}function Wv(n,t,e,i,r,o,a){const s=new Mt(`${t}_standard_material`,n);s.alphaMode=Pi.PBRMATERIAL_ALPHABLEND,s.backFaceCulling=!0,s.specularColor=me.Black(),i.hasAlpha=!0,s.sideOrientation=Ys.CW,s.diffuseTexture=i,s.diffuseColor=o?me.Black():dy(a),o&&(s.emissiveTexture=o,s.diffuseColor=dy(r)),e.material=s}function a6(n,t,e=Ae.BodyShape.MALE){const i={};for(const r of n)try{const o=uu(r,e);for(const a of o.contents)i[a.key]=a.url}catch{console.warn(`Skipping generation of mappings for wearable="${r.id}" since it lacks a representation for bodyShape="${e}"`);continue}if(t){const r=Pb(t,e);for(const o of r.contents)i[o.key]=o.url}return i}function s6(n){const t=is(n.item)?[n.item,...n.wearables]:n.wearables,e=Fo(n.item)?n.item:void 0,i=a6(t,e,n.bodyShape);$t.OnPluginActivatedObservable.add(r=>{if(r.name==="gltf"){const o=r;o.preprocessUrlAsync=async a=>{const l=a.split("/").pop();if(!l)return a;const f=Object.keys(i).find(c=>c.endsWith(l));return i[f]||a}}})}const l6=`float angleY = 3.14 / 2.0;
|
|
16067
16067
|
|
|
16068
16068
|
mat3 rotateY = mat3(
|
|
16069
16069
|
cos(angleY), 0, sin(angleY),
|
package/index.html
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
<meta name="theme-color" content="#000000" />
|
|
8
8
|
<meta name="description" content="Preview wearables from Decentraland" />
|
|
9
9
|
<link rel="apple-touch-icon" href="/logo192.png" />
|
|
10
|
-
<link rel="manifest" href="/manifest.json" />
|
|
10
|
+
<link rel="manifest" href="https://cdn.decentraland.org/@dcl/wearable-preview/1.28.2-16128120171.commit-95a6700/manifest.json" />
|
|
11
11
|
<title>Decentraland | Wearable Preview</title>
|
|
12
|
-
<script type="module" crossorigin src="/assets/index-
|
|
13
|
-
<link rel="stylesheet" crossorigin href="/assets/index-DrFxbJ99.css">
|
|
12
|
+
<script type="module" crossorigin src="https://cdn.decentraland.org/@dcl/wearable-preview/1.28.2-16128120171.commit-95a6700/assets/index-CpOoRjiJ.js"></script>
|
|
13
|
+
<link rel="stylesheet" crossorigin href="https://cdn.decentraland.org/@dcl/wearable-preview/1.28.2-16128120171.commit-95a6700/assets/index-DrFxbJ99.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dcl/wearable-preview",
|
|
3
|
-
"version": "1.28.2-
|
|
3
|
+
"version": "1.28.2-16128120171.commit-95a6700",
|
|
4
4
|
"description": "Static website for the wearable preview",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -13,6 +13,6 @@
|
|
|
13
13
|
"keywords": [],
|
|
14
14
|
"author": "",
|
|
15
15
|
"license": "Apache-2.0",
|
|
16
|
-
"homepage": "https://cdn.decentraland.org/@dcl/wearable-preview/1.28.2-
|
|
17
|
-
"commit": "
|
|
16
|
+
"homepage": "https://cdn.decentraland.org/@dcl/wearable-preview/1.28.2-16128120171.commit-95a6700",
|
|
17
|
+
"commit": "95a670083eb7336c8f1bb0e95423fa3458e08555"
|
|
18
18
|
}
|
|
@@ -16063,7 +16063,7 @@ vReflectionMapTexCoord.z=worldPos.w;
|
|
|
16063
16063
|
#endif
|
|
16064
16064
|
#include<logDepthVertex>
|
|
16065
16065
|
}
|
|
16066
|
-
`;ce.ShadersStore[NY]=FY;var BY=function(n){j(t,n);function t(){var e=n.call(this)||this;return e.BUMP=!1,e.REFLECTION=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SPECULARTERM=!1,e.LOGARITHMICDEPTH=!1,e.FRESNELSEPARATE=!1,e.BUMPSUPERIMPOSE=!1,e.BUMPAFFECTSREFLECTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.rebuild(),e}return t}(br),VY=function(n){j(t,n);function t(e,i,r){r===void 0&&(r=new Be(512,512));var o=n.call(this,e,i)||this;return o.renderTargetSize=r,o.diffuseColor=new me(1,1,1),o.specularColor=new me(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new Be(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new me(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new me(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._renderTargets=new vr(16),o._mesh=null,o._reflectionTransform=te.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(i,r),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&this._refractionRTT.refreshRate===0)},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,i,r){if(this.isFrozen&&i.effect&&i.effect._wasPreviouslyReady)return!0;i._materialDefines||(i._materialDefines=new BY);var o=i._materialDefines,a=this.getScene();if(this._isReadyForSubMesh(i))return!0;var s=a.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,a.texturesEnabled)){if(this.bumpTexture&&ke.BumpTextureEnabled)if(this.bumpTexture.isReady())o._needUVs=!0,o.BUMP=!0;else return!1;ke.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if(ne.PrepareDefinesForFrameBoundValues(a,s,o,!!r),ne.PrepareDefinesForMisc(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),o._areMiscDirty&&(this._fresnelSeparate&&(o.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(o.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(o.BUMPAFFECTSREFLECTION=!0)),o._needNormals=ne.PrepareDefinesForLights(a,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=this.reflectionTexture!=null&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=this.refractionTexture!=null&&!this.refractionTexture.gammaSpace}if(ne.PrepareDefinesForAttributes(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var l=0;l<this._waitingRenderList.length;l++)this.addToRenderList(a.getNodeByID(this._waitingRenderList[l]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),a.resetCachedMaterial();var u=new Er;o.FOG&&u.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&u.addFallback(0,"LOGARITHMICDEPTH"),ne.HandleFallbacksForShadows(o,u,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&u.addCPUSkinningFallback(0,e);var f=[I.PositionKind];o.NORMAL&&f.push(I.NormalKind),o.UV1&&f.push(I.UVKind),o.UV2&&f.push(I.UV2Kind),o.VERTEXCOLOR&&f.push(I.ColorKind),ne.PrepareAttributesForBones(f,e,o,u),ne.PrepareAttributesForInstances(f,o);var c="water",h=o.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],_=["normalSampler","refractionSampler","reflectionSampler"],g=new Array;Wi&&(Wi.PrepareUniforms(p,o),Wi.PrepareSamplers(_,o)),ne.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),i.setEffect(a.getEngine().createEffect(c,{attributes:f,uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:h,fallbacks:u,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},s),o)}return!i.effect||!i.effect.isReady()?!1:(o._renderId=a.getRenderId(),i.effect._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,i,r){var o=this.getScene(),a=r._materialDefines;if(a){var s=r.effect;if(!(!s||!this._mesh)){this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),ne.BindBonesParameters(i,this._activeEffect),this._mustRebind(o,s)&&(this.bumpTexture&&ke.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),ne.BindClipPlane(this._activeEffect,o),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),ne.BindEyePosition(s,o)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*i.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),o.lightsEnabled&&!this.disableLighting&&ne.BindLights(o,i,this._activeEffect,a,this.maxSimultaneousLights),o.fogEnabled&&i.applyFog&&o.fogMode!==Ke.FOGMODE_NONE&&this._activeEffect.setMatrix("view",o.getViewMatrix()),ne.BindFogParameters(o,i,this._activeEffect),ne.BindLogDepth(a,this._activeEffect,o),ke.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var l=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(o.getProjectionMatrix()),u=o.getEngine().getDeltaTime();u!==this._lastDeltaTime&&(this._lastDeltaTime=u,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",l),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(i,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,i){var r=this;this._refractionRTT=new $i(name+"_refraction",{width:i.x,height:i.y},e,!1,!0),this._refractionRTT.wrapU=vo.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=vo.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new $i(name+"_reflection",{width:i.x,height:i.y},e,!1,!0),this._reflectionRTT.wrapU=vo.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=vo.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s,l=te.Zero();this._refractionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Bo.FromPositionAndNormal(new b(0,u+.05,0),new b(0,1,0))}},this._refractionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),r.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Bo.FromPositionAndNormal(new b(0,u-.05,0),new b(0,-1,0)),te.ReflectionToRef(e.clipPlane,l)}s=e.getViewMatrix(),l.multiplyToRef(s,r._reflectionTransform),e.setTransformMatrix(r._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=b.TransformCoordinates(e.activeCamera.position,l)},this._reflectionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),e.clipPlane=a,e.setTransformMatrix(s,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._bumpTexture&&e.push(this._bumpTexture),e},t.prototype.hasTexture=function(e){return!!(n.prototype.hasTexture.call(this,e)||this._bumpTexture===e)},t.prototype.dispose=function(e){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);i!=-1&&this.getScene().customRenderTargets.splice(i,1),i=-1,i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT),i!=-1&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),n.prototype.dispose.call(this,e)},t.prototype.clone=function(e){var i=this;return Fe.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=Fe.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)e.renderList.push(this._refractionRTT.renderList[i].id);return e},t.prototype.getClassName=function(){return"WaterMaterial"},t.Parse=function(e,i,r){var o=Fe.Parse(function(){return new t(e.name,i)},e,i,r);return o._waitingRenderList=e.renderList,o},t.CreateDefaultMesh=function(e,i){var r=oe.CreateGround(e,512,512,32,i,!1);return r},A([at("bumpTexture")],t.prototype,"_bumpTexture",void 0),A([ye("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),A([Ft()],t.prototype,"diffuseColor",void 0),A([Ft()],t.prototype,"specularColor",void 0),A([w()],t.prototype,"specularPower",void 0),A([w("disableLighting")],t.prototype,"_disableLighting",void 0),A([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),A([w("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),A([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),A([w()],t.prototype,"windForce",void 0),A([rb()],t.prototype,"windDirection",void 0),A([w()],t.prototype,"waveHeight",void 0),A([w()],t.prototype,"bumpHeight",void 0),A([w("bumpSuperimpose")],t.prototype,"_bumpSuperimpose",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpSuperimpose",void 0),A([w("fresnelSeparate")],t.prototype,"_fresnelSeparate",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"fresnelSeparate",void 0),A([w("bumpAffectsReflection")],t.prototype,"_bumpAffectsReflection",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpAffectsReflection",void 0),A([Ft()],t.prototype,"waterColor",void 0),A([w()],t.prototype,"colorBlendFactor",void 0),A([Ft()],t.prototype,"waterColor2",void 0),A([w()],t.prototype,"colorBlendFactor2",void 0),A([w()],t.prototype,"waveLength",void 0),A([w()],t.prototype,"waveSpeed",void 0),A([w()],t.prototype,"waveCount",void 0),A([w()],t.prototype,"disableClipPlane",void 0),A([w()],t.prototype,"useLogarithmicDepth",null),t}(Ir);Pe.RegisteredTypes["BABYLON.WaterMaterial"]=VY;function UY(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)}const kY=["data:EnvironmentBRDFTexture0","GlowLayerBlurRTT","GlowLayerBlurRTT2","HighlightLayerMainRTT"];function zY(n,t,e){async function i(u,f){return Te.CreateScreenshotUsingRenderTargetAsync(n,e,{width:u,height:f},void 0,void 0,!0)}async function r(u){e.inertialRadiusOffset=e.inertialRadiusOffset+u}async function o(u){const{x:f,y:c,z:h}=u;e.target.x=f||0,e.target.y=c||0,e.target.z=h||0}async function a(u){const{alpha:f,beta:c,radius:h}=u;f&&(e.alpha=e.alpha+f),c&&(e.beta=e.beta+c),h&&(e.radius=e.radius+h)}async function s(){const u=t.meshes.filter(p=>!p.name.toLowerCase().includes("collider")).reduce((p,_)=>p+Math.floor(_.getTotalIndices()/3),0),f=t.materials.length,c=t.meshes.length,h=t.textures.filter(p=>p.name&&!kY.includes(p.name)).length;return{triangles:u,materials:f,meshes:c,textures:h,bodies:c,entities:1}}async function l(){}return{getScreenshot:i,getMetrics:s,panCamera:o,changeZoom:r,changeCameraPosition:a,cleanup:l}}var GY={};const vI=GY.REACT_APP_DEBUG;vI&&require("@babylonjs/inspector");function WY(n){const t=n.getChildren().filter(e=>e.id!=="__root__");if(t.length>0){const e=t[0];let i=e.getBoundingInfo(),r=i.boundingBox.minimumWorld.add(e.position),o=i.boundingBox.maximumWorld.add(e.position);for(let a=1;a<t.length;a++){const s=t[a];i=s.getBoundingInfo();const l=i.boundingBox.minimumWorld.add(s.position),u=i.boundingBox.maximumWorld.add(s.position);r=b.Minimize(r,l),o=b.Maximize(o,u)}n.setBoundingInfo(new cr(r,o))}}let Nl;async function HY(n,t){Nl&&Nl.dispose(),Nl=new xe(n,!0,{preserveDrawingBuffer:!0,stencil:!0,antialias:!0});const e=new Ke(Nl);if(e.autoClear=!0,e.clearColor=t.background.transparent?new it(0,0,0,0):dy(t.background.color).toColor4(),e.ambientColor=new me(1,1,1),e.preventDefaultOnPointerDown=!1,t.showSceneBoundaries){const s=vv.CreateGround("ground",{width:6,height:6},e),l=vv.CreateGround("ground",{width:6,height:6},e);l.rotate(Oi.Z,Math.PI),l.position.y=-.05;const u=new gI("groundMaterial",e);u.mainColor=new me(1,1,1),u.lineColor=new me(0,0,0),u.majorUnitFrequency=0,s.material=u,l.material=u;const f=vv.CreateCylinder("boundaries",{diameter:2,height:3}),c=new Mt("boundariesMaterial",e);c.alpha=.3,c.diffuseColor=new me(1,45/255,85/255),f.material=c,f.position.y=1.51}if(t.showThumbnailBoundaries){const s=xb.CreateFullscreenUI("UI"),l=new no;l.width=.5,l.height=1,l.color="#736E7D",l.thickness=2,s.addControl(l)}const i=new Js("camera",0,0,0,new b(0,0,0),e);switch(i.position=new b(t.cameraX,t.cameraY,t.cameraZ),i.minZ=.1,t.projection){case Ae.PreviewProjection.PERSPECTIVE:{i.mode=dt.PERSPECTIVE_CAMERA;break}case Ae.PreviewProjection.ORTHOGRAPHIC:{i.mode=dt.ORTHOGRAPHIC_CAMERA,i.orthoTop=1,i.orthoBottom=-1,i.orthoLeft=-1,i.orthoRight=1;break}}t.type===Ae.PreviewType.WEARABLE&&sI(i,t),t.camera===Ae.PreviewCamera.INTERACTIVE&&i.attachControl(n,!0);const r=new b(t.offsetX,t.offsetY,t.offsetZ);if(i.position.addInPlace(r),i.setTarget(r),i.lowerRadiusLimit=i.radius/t.zoom,i.upperRadiusLimit=i.lowerRadiusLimit*t.wheelZoom,i.radius=i.lowerRadiusLimit+(i.upperRadiusLimit-i.lowerRadiusLimit)*t.wheelStart/100,i.wheelPrecision=t.wheelPrecision,t.panning||(i.panningSensibility=0),t.lockBeta&&(i.lowerBetaLimit=i.beta,i.upperBetaLimit=i.beta),t.lockAlpha&&(i.lowerAlphaLimit=i.alpha,i.upperAlphaLimit=i.alpha),t.lockRadius&&(i.lowerRadiusLimit=i.radius,i.upperRadiusLimit=i.radius),t.type===Ae.PreviewType.WEARABLE){const s=new su("directional",new b(0,0,1),e);s.intensity=1;const l=new lu("spot",new b(-2,2,2),new b(2,-2,-2),Math.PI/2,1e3,e);l.intensity=1}const o=new ko("top",new b(0,-1,0),e);o.intensity=1;const a=new ko("bottom",new b(0,1,0),e);if(a.intensity=1,!UY()){const s=new rp("glow",e);s.intensity=2}return Nl.runRenderLoop(()=>{e.render()}),vI&&e.debugLayer.show({showExplorer:!0,embedMode:!0}),[e,zY(Nl,e,i)]}async function jY(n,t,e){const i=t.id,o=uu(t,e).contents.find(a=>a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Yx(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}async function XY(n,t,e){const i=t.id,o=uu(t,e).contents.find(a=>a.key.toLowerCase().endsWith(".png")&&!a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Yx(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}function YY(n,t){return new Promise((e,i)=>{var l;const r=(l=t.contents.find(u=>u.key.toLowerCase().endsWith(".mp3")||u.key.toLowerCase().endsWith("ogg")))==null?void 0:l.url;if(!r)return e(null);const o=new aj("Sound task",r),a=()=>e(new Ql("music",o.data,n,null,{spatialSound:!0})),s=u=>i(u);o.run(n,a,s)})}async function yI(n,t){const e=async(i,r)=>$t.LoadAssetContainerAsync(i,"",n,null,r);try{return await e(t,".glb")}catch{return await e(t,".gltf")}}function KY(n){const t=new oe("parent",n);for(const a of n.meshes)a!==t&&a.setParent(t);WY(t);const i=t.getBoundingInfo().boundingBox.extendSize.length(),r=new b(1/i,1/i,1/i);t.scaling=r;const o=t.getBoundingInfo().boundingBox.center.multiply(r);t.position.subtractInPlace(o)}var qY={};const QY=[Ae.PreviewEmote.IDLE,Ae.PreviewEmote.MONEY,Ae.PreviewEmote.CLAP,Ae.PreviewEmote.WALK,Ae.PreviewEmote.RUN,Ae.PreviewEmote.JUMP];let pd;function $Y(n){return QY.includes(n)}function ZY(n){let t=qY.PUBLIC_URL||"";t.endsWith("/")||(t+="/");const e=`./emotes/${n}.glb`;return t.startsWith("http")?new URL(e,t).href:e}async function bI(n,t){const e=await yI(n,t);if(e.animationGroups.length===0)throw new Error(`No animation groups found for emote with url=${t}`);return e}async function JY(n,t,e){const i=Pb(t,e.bodyShape),r=i.contents.find(o=>o.key===i.mainFile);if(!r)throw new Error(`Could not find a valid content in representation for emote=${t.id} and bodyShape=${e.bodyShape}`);return bI(n,r.url)}function e6(n,t,e){const i=Pb(t,e.bodyShape);return YY(n,i)}async function t6(n,t,e){let i,r=!!e.emote&&$Y(e.emote),o=null;if(e.item&&Fo(e.item))try{i=await JY(n,e.item,e),r=e.item.emoteDataADR74.loop,o=await e6(n,e.item,e)}catch{console.warn(`Could not load emote=${e.item.id}`)}if(!i&&e.emote){const l=ZY(e.emote);i=await bI(n,l)}i&&i.animationGroups.length>1&&(i.addAllToScene(),n.stopAllAnimations());const a=new ob("emote",n);function s(){if(e.camera!==Ae.PreviewCamera.STATIC){const l=n.cameras[0];sI(l,e)}}try{for(const u of t){const f=new Map,c=[...u.container.transformNodes,...u.container.meshes];for(const h of c){const p=h.name.replace(/\.\d+$/,""),_=f.get(p)||[];_.push(h),f.set(p,_)}if(i&&i.animationGroups.length>0)for(const h of i.animationGroups)for(const p of h.targetedAnimations){const _=p.animation.clone(),g=p.target,v=p.animation.getKeys();if(_.setKeys([...v]),i.animationGroups.length===1||h.name.toLowerCase().includes("avatar")||g.name.startsWith("Avatar_")){const T=g.name.replace(/\.\d+$/,""),S=f.get(T)||[];if(S.length>0)for(const C of S){const O=_.clone();O.setKeys([...v]),a.addTargetedAnimation(O,C)}else console.warn("No matching bone found for",g.name)}else a.addTargetedAnimation(_,g)}}a.onAnimationGroupEndObservable.addOnce(s);const l=i6(a,r,o);return e.camera===Ae.PreviewCamera.STATIC&&l.stop(),l}catch(l){console.warn(`Could not play emote=${e.emote}`,l)}}function i6(n,t,e){xe.audioEngine.useCustomUnlockedButton=!0,xe.audioEngine.setGlobalVolume(0);let i,r=!1;async function o(){return Math.max(n.to,0)}async function a(){return n.isPlaying}async function s(){return!!e}async function l(E){r=!0;const T=await a();T&&n.pause(),n.stop(),n.start(!1,1,E,E,!1),i=E,r=!0,T&&u()}async function u(){await a()||(i?(n.start(t,1,i,await o(),!1),e&&(e.stop(),e._startOffset=i,e.play()),i=0):(n.play(t),e==null||e.play()))}async function f(){await a()&&(n.pause(),e==null||e.pause())}async function c(){n.goToFrame(0),n.stop(),e==null||e.stop()}async function h(){e&&(xe.audioEngine.unlock(),xe.audioEngine.setGlobalVolume(1),n.isPlaying&&!e.isPlaying&&e.play(void 0,n.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame))}async function p(){e&&xe.audioEngine.setGlobalVolume(0)}const _=tb(),g=()=>(pd&&clearInterval(pd),window.setInterval(async()=>{var E;if(await a()&&n.animatables[0].masterFrame>0)return _.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAYING,{length:(E=n.animatables[0])==null?void 0:E.masterFrame})},10)),v=()=>{clearInterval(pd),r||_.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n.to})};return n.onAnimationGroupPlayObservable.add(()=>(pd=g(),_.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAY))),n.onAnimationGroupPauseObservable.add(()=>{_.emit(Ae.PreviewEmoteEventType.ANIMATION_PAUSE)}),n.onAnimationGroupLoopObservable.add(()=>(e==null||e.stop(),e==null||e.play(),r&&(c(),u(),r=!1),_.emit(Ae.PreviewEmoteEventType.ANIMATION_LOOP))),n.onAnimationGroupEndObservable.add(()=>(v(),t||(r=!1),_.emit(Ae.PreviewEmoteEventType.ANIMATION_END))),{getLength:o,isPlaying:a,goTo:l,play:u,pause:f,stop:c,enableSound:h,disableSound:p,hasSound:s,events:_}}function r6(n,t,e){return async i=>{const r=t.find(Wj(i));return r?Promise.all([XY(n,r,e),jY(n,r,e)]):[null,null]}}async function n6(n,t,e){const i=r6(n,t,e),[r,o,a]=await Promise.all([i(Ae.WearableCategory.EYES),i(Ae.WearableCategory.EYEBROWS),i(Ae.WearableCategory.MOUTH)]);return{eyes:r,eyebrows:o,mouth:a}}async function o6(n,t,e,i,r,o){for(const a of t.container.meshes){if(a.name.toLowerCase().endsWith("mask_eyes")){const[s,l]=e;s?Wv(n,"eyes",a,s,o.eyes,l,"#ffffff"):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_eyebrows")){const[s,l]=i;s?Wv(n,"eyebrows",a,s,o.hair,l,o.hair):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_mouth")){const[s,l]=r;s?Wv(n,"mouth",a,s,o.skin,l,o.skin):a.setEnabled(!1)}}}function Wv(n,t,e,i,r,o,a){const s=new Mt(`${t}_standard_material`,n);s.alphaMode=Pi.PBRMATERIAL_ALPHABLEND,s.backFaceCulling=!0,s.specularColor=me.Black(),i.hasAlpha=!0,s.sideOrientation=Ys.CW,s.diffuseTexture=i,s.diffuseColor=o?me.Black():dy(a),o&&(s.emissiveTexture=o,s.diffuseColor=dy(r)),e.material=s}function a6(n,t,e=Ae.BodyShape.MALE){const i={};for(const r of n)try{const o=uu(r,e);for(const a of o.contents)i[a.key]=a.url}catch{console.warn(`Skipping generation of mappings for wearable="${r.id}" since it lacks a representation for bodyShape="${e}"`);continue}if(t){const r=Pb(t,e);for(const o of r.contents)i[o.key]=o.url}return i}function s6(n){const t=is(n.item)?[n.item,...n.wearables]:n.wearables,e=Fo(n.item)?n.item:void 0,i=a6(t,e,n.bodyShape);$t.OnPluginActivatedObservable.add(r=>{if(r.name==="gltf"){const o=r;o.preprocessUrlAsync=async a=>{const l=a.split("/").pop();if(!l)return a;const f=Object.keys(i).find(c=>c.endsWith(l));return i[f]||a}}})}const l6=`float angleY = 3.14 / 2.0;
|
|
16066
|
+
`;ce.ShadersStore[NY]=FY;var BY=function(n){j(t,n);function t(){var e=n.call(this)||this;return e.BUMP=!1,e.REFLECTION=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.CLIPPLANE5=!1,e.CLIPPLANE6=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SPECULARTERM=!1,e.LOGARITHMICDEPTH=!1,e.FRESNELSEPARATE=!1,e.BUMPSUPERIMPOSE=!1,e.BUMPAFFECTSREFLECTION=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.rebuild(),e}return t}(br),VY=function(n){j(t,n);function t(e,i,r){r===void 0&&(r=new Be(512,512));var o=n.call(this,e,i)||this;return o.renderTargetSize=r,o.diffuseColor=new me(1,1,1),o.specularColor=new me(0,0,0),o.specularPower=64,o._disableLighting=!1,o._maxSimultaneousLights=4,o.windForce=6,o.windDirection=new Be(0,1),o.waveHeight=.4,o.bumpHeight=.4,o._bumpSuperimpose=!1,o._fresnelSeparate=!1,o._bumpAffectsReflection=!1,o.waterColor=new me(.1,.1,.6),o.colorBlendFactor=.2,o.waterColor2=new me(.1,.1,.6),o.colorBlendFactor2=.2,o.waveLength=.1,o.waveSpeed=1,o.waveCount=20,o.disableClipPlane=!1,o._renderTargets=new vr(16),o._mesh=null,o._reflectionTransform=te.Zero(),o._lastTime=0,o._lastDeltaTime=0,o._createRenderTargets(i,r),o.getRenderTargetTextures=function(){return o._renderTargets.reset(),o._renderTargets.push(o._reflectionRTT),o._renderTargets.push(o._refractionRTT),o._renderTargets},o._imageProcessingConfiguration=o.getScene().imageProcessingConfiguration,o._imageProcessingConfiguration&&(o._imageProcessingObserver=o._imageProcessingConfiguration.onUpdateParameters.add(function(){o._markAllSubMeshesAsImageProcessingDirty()})),o}return Object.defineProperty(t.prototype,"hasRenderTargetTextures",{get:function(){return!0},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"refractionTexture",{get:function(){return this._refractionRTT},enumerable:!1,configurable:!0}),Object.defineProperty(t.prototype,"reflectionTexture",{get:function(){return this._reflectionRTT},enumerable:!1,configurable:!0}),t.prototype.addToRenderList=function(e){this._refractionRTT&&this._refractionRTT.renderList&&this._refractionRTT.renderList.push(e),this._reflectionRTT&&this._reflectionRTT.renderList&&this._reflectionRTT.renderList.push(e)},t.prototype.enableRenderTargets=function(e){var i=e?1:0;this._refractionRTT&&(this._refractionRTT.refreshRate=i),this._reflectionRTT&&(this._reflectionRTT.refreshRate=i)},t.prototype.getRenderList=function(){return this._refractionRTT?this._refractionRTT.renderList:[]},Object.defineProperty(t.prototype,"renderTargetsEnabled",{get:function(){return!(this._refractionRTT&&this._refractionRTT.refreshRate===0)},enumerable:!1,configurable:!0}),t.prototype.needAlphaBlending=function(){return this.alpha<1},t.prototype.needAlphaTesting=function(){return!1},t.prototype.getAlphaTestTexture=function(){return null},t.prototype.isReadyForSubMesh=function(e,i,r){if(this.isFrozen&&i.effect&&i.effect._wasPreviouslyReady)return!0;i._materialDefines||(i._materialDefines=new BY);var o=i._materialDefines,a=this.getScene();if(this._isReadyForSubMesh(i))return!0;var s=a.getEngine();if(o._areTexturesDirty&&(o._needUVs=!1,a.texturesEnabled)){if(this.bumpTexture&&ke.BumpTextureEnabled)if(this.bumpTexture.isReady())o._needUVs=!0,o.BUMP=!0;else return!1;ke.ReflectionTextureEnabled&&(o.REFLECTION=!0)}if(ne.PrepareDefinesForFrameBoundValues(a,s,o,!!r),ne.PrepareDefinesForMisc(e,a,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),o._areMiscDirty&&(this._fresnelSeparate&&(o.FRESNELSEPARATE=!0),this._bumpSuperimpose&&(o.BUMPSUPERIMPOSE=!0),this._bumpAffectsReflection&&(o.BUMPAFFECTSREFLECTION=!0)),o._needNormals=ne.PrepareDefinesForLights(a,e,o,!0,this._maxSimultaneousLights,this._disableLighting),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o),o.IS_REFLECTION_LINEAR=this.reflectionTexture!=null&&!this.reflectionTexture.gammaSpace,o.IS_REFRACTION_LINEAR=this.refractionTexture!=null&&!this.refractionTexture.gammaSpace}if(ne.PrepareDefinesForAttributes(e,o,!0,!0),this._mesh=e,this._waitingRenderList){for(var l=0;l<this._waitingRenderList.length;l++)this.addToRenderList(a.getNodeByID(this._waitingRenderList[l]));this._waitingRenderList=null}if(o.isDirty){o.markAsProcessed(),a.resetCachedMaterial();var u=new Er;o.FOG&&u.addFallback(1,"FOG"),o.LOGARITHMICDEPTH&&u.addFallback(0,"LOGARITHMICDEPTH"),ne.HandleFallbacksForShadows(o,u,this.maxSimultaneousLights),o.NUM_BONE_INFLUENCERS>0&&u.addCPUSkinningFallback(0,e);var f=[I.PositionKind];o.NORMAL&&f.push(I.NormalKind),o.UV1&&f.push(I.UVKind),o.UV2&&f.push(I.UV2Kind),o.VERTEXCOLOR&&f.push(I.ColorKind),ne.PrepareAttributesForBones(f,e,o,u),ne.PrepareAttributesForInstances(f,o);var c="water",h=o.toString(),p=["world","view","viewProjection","vEyePosition","vLightsType","vDiffuseColor","vSpecularColor","vFogInfos","vFogColor","pointSize","vNormalInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","vClipPlane5","vClipPlane6","normalMatrix","logarithmicDepthConstant","worldReflectionViewProjection","windDirection","waveLength","time","windForce","cameraPosition","bumpHeight","waveHeight","waterColor","waterColor2","colorBlendFactor","colorBlendFactor2","waveSpeed","waveCount"],_=["normalSampler","refractionSampler","reflectionSampler"],g=new Array;Wi&&(Wi.PrepareUniforms(p,o),Wi.PrepareSamplers(_,o)),ne.PrepareUniformsAndSamplersList({uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:o,maxSimultaneousLights:this.maxSimultaneousLights}),i.setEffect(a.getEngine().createEffect(c,{attributes:f,uniformsNames:p,uniformBuffersNames:g,samplers:_,defines:h,fallbacks:u,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},s),o)}return!i.effect||!i.effect.isReady()?!1:(o._renderId=a.getRenderId(),i.effect._wasPreviouslyReady=!0,!0)},t.prototype.bindForSubMesh=function(e,i,r){var o=this.getScene(),a=r._materialDefines;if(a){var s=r.effect;if(!(!s||!this._mesh)){this._activeEffect=s,this.bindOnlyWorldMatrix(e),this._activeEffect.setMatrix("viewProjection",o.getTransformMatrix()),ne.BindBonesParameters(i,this._activeEffect),this._mustRebind(o,s)&&(this.bumpTexture&&ke.BumpTextureEnabled&&(this._activeEffect.setTexture("normalSampler",this.bumpTexture),this._activeEffect.setFloat2("vNormalInfos",this.bumpTexture.coordinatesIndex,this.bumpTexture.level),this._activeEffect.setMatrix("normalMatrix",this.bumpTexture.getTextureMatrix())),ne.BindClipPlane(this._activeEffect,o),this.pointsCloud&&this._activeEffect.setFloat("pointSize",this.pointSize),ne.BindEyePosition(s,o)),this._activeEffect.setColor4("vDiffuseColor",this.diffuseColor,this.alpha*i.visibility),a.SPECULARTERM&&this._activeEffect.setColor4("vSpecularColor",this.specularColor,this.specularPower),o.lightsEnabled&&!this.disableLighting&&ne.BindLights(o,i,this._activeEffect,a,this.maxSimultaneousLights),o.fogEnabled&&i.applyFog&&o.fogMode!==Ke.FOGMODE_NONE&&this._activeEffect.setMatrix("view",o.getViewMatrix()),ne.BindFogParameters(o,i,this._activeEffect),ne.BindLogDepth(a,this._activeEffect,o),ke.ReflectionTextureEnabled&&(this._activeEffect.setTexture("refractionSampler",this._refractionRTT),this._activeEffect.setTexture("reflectionSampler",this._reflectionRTT));var l=this._mesh.getWorldMatrix().multiply(this._reflectionTransform).multiply(o.getProjectionMatrix()),u=o.getEngine().getDeltaTime();u!==this._lastDeltaTime&&(this._lastDeltaTime=u,this._lastTime+=this._lastDeltaTime),this._activeEffect.setMatrix("worldReflectionViewProjection",l),this._activeEffect.setVector2("windDirection",this.windDirection),this._activeEffect.setFloat("waveLength",this.waveLength),this._activeEffect.setFloat("time",this._lastTime/1e5),this._activeEffect.setFloat("windForce",this.windForce),this._activeEffect.setFloat("waveHeight",this.waveHeight),this._activeEffect.setFloat("bumpHeight",this.bumpHeight),this._activeEffect.setColor4("waterColor",this.waterColor,1),this._activeEffect.setFloat("colorBlendFactor",this.colorBlendFactor),this._activeEffect.setColor4("waterColor2",this.waterColor2,1),this._activeEffect.setFloat("colorBlendFactor2",this.colorBlendFactor2),this._activeEffect.setFloat("waveSpeed",this.waveSpeed),this._activeEffect.setFloat("waveCount",this.waveCount),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect),this._afterBind(i,this._activeEffect)}}},t.prototype._createRenderTargets=function(e,i){var r=this;this._refractionRTT=new $i(name+"_refraction",{width:i.x,height:i.y},e,!1,!0),this._refractionRTT.wrapU=vo.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.wrapV=vo.TEXTURE_MIRROR_ADDRESSMODE,this._refractionRTT.ignoreCameraViewport=!0,this._reflectionRTT=new $i(name+"_reflection",{width:i.x,height:i.y},e,!1,!0),this._reflectionRTT.wrapU=vo.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.wrapV=vo.TEXTURE_MIRROR_ADDRESSMODE,this._reflectionRTT.ignoreCameraViewport=!0;var o,a=null,s,l=te.Zero();this._refractionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Bo.FromPositionAndNormal(new b(0,u+.05,0),new b(0,1,0))}},this._refractionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),r.disableClipPlane||(e.clipPlane=a)},this._reflectionRTT.onBeforeRender=function(){if(r._mesh&&(o=r._mesh.isVisible,r._mesh.isVisible=!1),!r.disableClipPlane){a=e.clipPlane;var u=r._mesh?r._mesh.position.y:0;e.clipPlane=Bo.FromPositionAndNormal(new b(0,u-.05,0),new b(0,-1,0)),te.ReflectionToRef(e.clipPlane,l)}s=e.getViewMatrix(),l.multiplyToRef(s,r._reflectionTransform),e.setTransformMatrix(r._reflectionTransform,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!1,e._mirroredCameraPosition=b.TransformCoordinates(e.activeCamera.position,l)},this._reflectionRTT.onAfterRender=function(){r._mesh&&(r._mesh.isVisible=o),e.clipPlane=a,e.setTransformMatrix(s,e.getProjectionMatrix()),e.getEngine().cullBackFaces=!0,e._mirroredCameraPosition=null}},t.prototype.getAnimatables=function(){var e=[];return this.bumpTexture&&this.bumpTexture.animations&&this.bumpTexture.animations.length>0&&e.push(this.bumpTexture),this._reflectionRTT&&this._reflectionRTT.animations&&this._reflectionRTT.animations.length>0&&e.push(this._reflectionRTT),this._refractionRTT&&this._refractionRTT.animations&&this._refractionRTT.animations.length>0&&e.push(this._refractionRTT),e},t.prototype.getActiveTextures=function(){var e=n.prototype.getActiveTextures.call(this);return this._bumpTexture&&e.push(this._bumpTexture),e},t.prototype.hasTexture=function(e){return!!(n.prototype.hasTexture.call(this,e)||this._bumpTexture===e)},t.prototype.dispose=function(e){this.bumpTexture&&this.bumpTexture.dispose();var i=this.getScene().customRenderTargets.indexOf(this._refractionRTT);i!=-1&&this.getScene().customRenderTargets.splice(i,1),i=-1,i=this.getScene().customRenderTargets.indexOf(this._reflectionRTT),i!=-1&&this.getScene().customRenderTargets.splice(i,1),this._reflectionRTT&&this._reflectionRTT.dispose(),this._refractionRTT&&this._refractionRTT.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),n.prototype.dispose.call(this,e)},t.prototype.clone=function(e){var i=this;return Fe.Clone(function(){return new t(e,i.getScene())},this)},t.prototype.serialize=function(){var e=Fe.Serialize(this);if(e.customType="BABYLON.WaterMaterial",e.renderList=[],this._refractionRTT&&this._refractionRTT.renderList)for(var i=0;i<this._refractionRTT.renderList.length;i++)e.renderList.push(this._refractionRTT.renderList[i].id);return e},t.prototype.getClassName=function(){return"WaterMaterial"},t.Parse=function(e,i,r){var o=Fe.Parse(function(){return new t(e.name,i)},e,i,r);return o._waitingRenderList=e.renderList,o},t.CreateDefaultMesh=function(e,i){var r=oe.CreateGround(e,512,512,32,i,!1);return r},A([at("bumpTexture")],t.prototype,"_bumpTexture",void 0),A([ye("_markAllSubMeshesAsTexturesDirty")],t.prototype,"bumpTexture",void 0),A([Ft()],t.prototype,"diffuseColor",void 0),A([Ft()],t.prototype,"specularColor",void 0),A([w()],t.prototype,"specularPower",void 0),A([w("disableLighting")],t.prototype,"_disableLighting",void 0),A([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"disableLighting",void 0),A([w("maxSimultaneousLights")],t.prototype,"_maxSimultaneousLights",void 0),A([ye("_markAllSubMeshesAsLightsDirty")],t.prototype,"maxSimultaneousLights",void 0),A([w()],t.prototype,"windForce",void 0),A([rb()],t.prototype,"windDirection",void 0),A([w()],t.prototype,"waveHeight",void 0),A([w()],t.prototype,"bumpHeight",void 0),A([w("bumpSuperimpose")],t.prototype,"_bumpSuperimpose",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpSuperimpose",void 0),A([w("fresnelSeparate")],t.prototype,"_fresnelSeparate",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"fresnelSeparate",void 0),A([w("bumpAffectsReflection")],t.prototype,"_bumpAffectsReflection",void 0),A([ye("_markAllSubMeshesAsMiscDirty")],t.prototype,"bumpAffectsReflection",void 0),A([Ft()],t.prototype,"waterColor",void 0),A([w()],t.prototype,"colorBlendFactor",void 0),A([Ft()],t.prototype,"waterColor2",void 0),A([w()],t.prototype,"colorBlendFactor2",void 0),A([w()],t.prototype,"waveLength",void 0),A([w()],t.prototype,"waveSpeed",void 0),A([w()],t.prototype,"waveCount",void 0),A([w()],t.prototype,"disableClipPlane",void 0),A([w()],t.prototype,"useLogarithmicDepth",null),t}(Ir);Pe.RegisteredTypes["BABYLON.WaterMaterial"]=VY;function UY(){return["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)}const kY=["data:EnvironmentBRDFTexture0","GlowLayerBlurRTT","GlowLayerBlurRTT2","HighlightLayerMainRTT"];function zY(n,t,e){async function i(u,f){return Te.CreateScreenshotUsingRenderTargetAsync(n,e,{width:u,height:f},void 0,void 0,!0)}async function r(u){e.inertialRadiusOffset=e.inertialRadiusOffset+u}async function o(u){const{x:f,y:c,z:h}=u;e.target.x=f||0,e.target.y=c||0,e.target.z=h||0}async function a(u){const{alpha:f,beta:c,radius:h}=u;f&&(e.alpha=e.alpha+f),c&&(e.beta=e.beta+c),h&&(e.radius=e.radius+h)}async function s(){const u=t.meshes.filter(p=>!p.name.toLowerCase().includes("collider")).reduce((p,_)=>p+Math.floor(_.getTotalIndices()/3),0),f=t.materials.length,c=t.meshes.length,h=t.textures.filter(p=>p.name&&!kY.includes(p.name)).length;return{triangles:u,materials:f,meshes:c,textures:h,bodies:c,entities:1}}async function l(){}return{getScreenshot:i,getMetrics:s,panCamera:o,changeZoom:r,changeCameraPosition:a,cleanup:l}}var GY={};const vI=GY.REACT_APP_DEBUG;vI&&require("@babylonjs/inspector");function WY(n){const t=n.getChildren().filter(e=>e.id!=="__root__");if(t.length>0){const e=t[0];let i=e.getBoundingInfo(),r=i.boundingBox.minimumWorld.add(e.position),o=i.boundingBox.maximumWorld.add(e.position);for(let a=1;a<t.length;a++){const s=t[a];i=s.getBoundingInfo();const l=i.boundingBox.minimumWorld.add(s.position),u=i.boundingBox.maximumWorld.add(s.position);r=b.Minimize(r,l),o=b.Maximize(o,u)}n.setBoundingInfo(new cr(r,o))}}let Nl;async function HY(n,t){Nl&&Nl.dispose(),Nl=new xe(n,!0,{preserveDrawingBuffer:!0,stencil:!0,antialias:!0});const e=new Ke(Nl);if(e.autoClear=!0,e.clearColor=t.background.transparent?new it(0,0,0,0):dy(t.background.color).toColor4(),e.ambientColor=new me(1,1,1),e.preventDefaultOnPointerDown=!1,t.showSceneBoundaries){const s=vv.CreateGround("ground",{width:6,height:6},e),l=vv.CreateGround("ground",{width:6,height:6},e);l.rotate(Oi.Z,Math.PI),l.position.y=-.05;const u=new gI("groundMaterial",e);u.mainColor=new me(1,1,1),u.lineColor=new me(0,0,0),u.majorUnitFrequency=0,s.material=u,l.material=u;const f=vv.CreateCylinder("boundaries",{diameter:2,height:3}),c=new Mt("boundariesMaterial",e);c.alpha=.3,c.diffuseColor=new me(1,45/255,85/255),f.material=c,f.position.y=1.51}if(t.showThumbnailBoundaries){const s=xb.CreateFullscreenUI("UI"),l=new no;l.width=.5,l.height=1,l.color="#736E7D",l.thickness=2,s.addControl(l)}const i=new Js("camera",0,0,0,new b(0,0,0),e);switch(i.position=new b(t.cameraX,t.cameraY,t.cameraZ),i.minZ=.1,t.projection){case Ae.PreviewProjection.PERSPECTIVE:{i.mode=dt.PERSPECTIVE_CAMERA;break}case Ae.PreviewProjection.ORTHOGRAPHIC:{i.mode=dt.ORTHOGRAPHIC_CAMERA,i.orthoTop=1,i.orthoBottom=-1,i.orthoLeft=-1,i.orthoRight=1;break}}t.type===Ae.PreviewType.WEARABLE&&sI(i,t),t.camera===Ae.PreviewCamera.INTERACTIVE&&i.attachControl(n,!0);const r=new b(t.offsetX,t.offsetY,t.offsetZ);if(i.position.addInPlace(r),i.setTarget(r),i.lowerRadiusLimit=i.radius/t.zoom,i.upperRadiusLimit=i.lowerRadiusLimit*t.wheelZoom,i.radius=i.lowerRadiusLimit+(i.upperRadiusLimit-i.lowerRadiusLimit)*t.wheelStart/100,i.wheelPrecision=t.wheelPrecision,t.panning||(i.panningSensibility=0),t.lockBeta&&(i.lowerBetaLimit=i.beta,i.upperBetaLimit=i.beta),t.lockAlpha&&(i.lowerAlphaLimit=i.alpha,i.upperAlphaLimit=i.alpha),t.lockRadius&&(i.lowerRadiusLimit=i.radius,i.upperRadiusLimit=i.radius),t.type===Ae.PreviewType.WEARABLE){const s=new su("directional",new b(0,0,1),e);s.intensity=1;const l=new lu("spot",new b(-2,2,2),new b(2,-2,-2),Math.PI/2,1e3,e);l.intensity=1}const o=new ko("top",new b(0,-1,0),e);o.intensity=1;const a=new ko("bottom",new b(0,1,0),e);if(a.intensity=1,!UY()){const s=new rp("glow",e);s.intensity=2}return Nl.runRenderLoop(()=>{e.render()}),vI&&e.debugLayer.show({showExplorer:!0,embedMode:!0}),[e,zY(Nl,e,i)]}async function jY(n,t,e){const i=t.id,o=uu(t,e).contents.find(a=>a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Yx(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}async function XY(n,t,e){const i=t.id,o=uu(t,e).contents.find(a=>a.key.toLowerCase().endsWith(".png")&&!a.key.toLowerCase().endsWith("_mask.png"));return o?new Promise((a,s)=>{const l=new Yx(i,o.url,!0,!1);l.onError=()=>s(l.errorObject),l.onSuccess=()=>{a(l.texture)},l.run(n,()=>a(l.texture),s)}):null}function YY(n,t){return new Promise((e,i)=>{var l;const r=(l=t.contents.find(u=>u.key.toLowerCase().endsWith(".mp3")||u.key.toLowerCase().endsWith("ogg")))==null?void 0:l.url;if(!r)return e(null);const o=new aj("Sound task",r),a=()=>e(new Ql("music",o.data,n,null,{spatialSound:!0})),s=u=>i(u);o.run(n,a,s)})}async function yI(n,t){const e=async(i,r)=>$t.LoadAssetContainerAsync(i,"",n,null,r);try{return await e(t,".glb")}catch{return await e(t,".gltf")}}function KY(n){const t=new oe("parent",n);for(const a of n.meshes)a!==t&&a.setParent(t);WY(t);const i=t.getBoundingInfo().boundingBox.extendSize.length(),r=new b(1/i,1/i,1/i);t.scaling=r;const o=t.getBoundingInfo().boundingBox.center.multiply(r);t.position.subtractInPlace(o)}var qY={};const QY=[Ae.PreviewEmote.IDLE,Ae.PreviewEmote.MONEY,Ae.PreviewEmote.CLAP,Ae.PreviewEmote.WALK,Ae.PreviewEmote.RUN,Ae.PreviewEmote.JUMP];let pd;function $Y(n){return QY.includes(n)}function ZY(n){let t=qY.VITE_BASE_URL||"";t.endsWith("/")||(t+="/");const e=`./emotes/${n}.glb`;return t.startsWith("http")?new URL(e,t).href:e}async function bI(n,t){const e=await yI(n,t);if(e.animationGroups.length===0)throw new Error(`No animation groups found for emote with url=${t}`);return e}async function JY(n,t,e){const i=Pb(t,e.bodyShape),r=i.contents.find(o=>o.key===i.mainFile);if(!r)throw new Error(`Could not find a valid content in representation for emote=${t.id} and bodyShape=${e.bodyShape}`);return bI(n,r.url)}function e6(n,t,e){const i=Pb(t,e.bodyShape);return YY(n,i)}async function t6(n,t,e){let i,r=!!e.emote&&$Y(e.emote),o=null;if(e.item&&Fo(e.item))try{i=await JY(n,e.item,e),r=e.item.emoteDataADR74.loop,o=await e6(n,e.item,e)}catch{console.warn(`Could not load emote=${e.item.id}`)}if(!i&&e.emote){const l=ZY(e.emote);i=await bI(n,l)}i&&i.animationGroups.length>1&&(i.addAllToScene(),n.stopAllAnimations());const a=new ob("emote",n);function s(){if(e.camera!==Ae.PreviewCamera.STATIC){const l=n.cameras[0];sI(l,e)}}try{for(const u of t){const f=new Map,c=[...u.container.transformNodes,...u.container.meshes];for(const h of c){const p=h.name.replace(/\.\d+$/,""),_=f.get(p)||[];_.push(h),f.set(p,_)}if(i&&i.animationGroups.length>0)for(const h of i.animationGroups)for(const p of h.targetedAnimations){const _=p.animation.clone(),g=p.target,v=p.animation.getKeys();if(_.setKeys([...v]),i.animationGroups.length===1||h.name.toLowerCase().includes("avatar")||g.name.startsWith("Avatar_")){const T=g.name.replace(/\.\d+$/,""),S=f.get(T)||[];if(S.length>0)for(const C of S){const O=_.clone();O.setKeys([...v]),a.addTargetedAnimation(O,C)}else console.warn("No matching bone found for",g.name)}else a.addTargetedAnimation(_,g)}}a.onAnimationGroupEndObservable.addOnce(s);const l=i6(a,r,o);return e.camera===Ae.PreviewCamera.STATIC&&l.stop(),l}catch(l){console.warn(`Could not play emote=${e.emote}`,l)}}function i6(n,t,e){xe.audioEngine.useCustomUnlockedButton=!0,xe.audioEngine.setGlobalVolume(0);let i,r=!1;async function o(){return Math.max(n.to,0)}async function a(){return n.isPlaying}async function s(){return!!e}async function l(E){r=!0;const T=await a();T&&n.pause(),n.stop(),n.start(!1,1,E,E,!1),i=E,r=!0,T&&u()}async function u(){await a()||(i?(n.start(t,1,i,await o(),!1),e&&(e.stop(),e._startOffset=i,e.play()),i=0):(n.play(t),e==null||e.play()))}async function f(){await a()&&(n.pause(),e==null||e.pause())}async function c(){n.goToFrame(0),n.stop(),e==null||e.stop()}async function h(){e&&(xe.audioEngine.unlock(),xe.audioEngine.setGlobalVolume(1),n.isPlaying&&!e.isPlaying&&e.play(void 0,n.targetedAnimations[0].animation.runtimeAnimations[0].currentFrame))}async function p(){e&&xe.audioEngine.setGlobalVolume(0)}const _=tb(),g=()=>(pd&&clearInterval(pd),window.setInterval(async()=>{var E;if(await a()&&n.animatables[0].masterFrame>0)return _.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAYING,{length:(E=n.animatables[0])==null?void 0:E.masterFrame})},10)),v=()=>{clearInterval(pd),r||_.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAYING,{length:n.to})};return n.onAnimationGroupPlayObservable.add(()=>(pd=g(),_.emit(Ae.PreviewEmoteEventType.ANIMATION_PLAY))),n.onAnimationGroupPauseObservable.add(()=>{_.emit(Ae.PreviewEmoteEventType.ANIMATION_PAUSE)}),n.onAnimationGroupLoopObservable.add(()=>(e==null||e.stop(),e==null||e.play(),r&&(c(),u(),r=!1),_.emit(Ae.PreviewEmoteEventType.ANIMATION_LOOP))),n.onAnimationGroupEndObservable.add(()=>(v(),t||(r=!1),_.emit(Ae.PreviewEmoteEventType.ANIMATION_END))),{getLength:o,isPlaying:a,goTo:l,play:u,pause:f,stop:c,enableSound:h,disableSound:p,hasSound:s,events:_}}function r6(n,t,e){return async i=>{const r=t.find(Wj(i));return r?Promise.all([XY(n,r,e),jY(n,r,e)]):[null,null]}}async function n6(n,t,e){const i=r6(n,t,e),[r,o,a]=await Promise.all([i(Ae.WearableCategory.EYES),i(Ae.WearableCategory.EYEBROWS),i(Ae.WearableCategory.MOUTH)]);return{eyes:r,eyebrows:o,mouth:a}}async function o6(n,t,e,i,r,o){for(const a of t.container.meshes){if(a.name.toLowerCase().endsWith("mask_eyes")){const[s,l]=e;s?Wv(n,"eyes",a,s,o.eyes,l,"#ffffff"):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_eyebrows")){const[s,l]=i;s?Wv(n,"eyebrows",a,s,o.hair,l,o.hair):a.setEnabled(!1)}if(a.name.toLowerCase().endsWith("mask_mouth")){const[s,l]=r;s?Wv(n,"mouth",a,s,o.skin,l,o.skin):a.setEnabled(!1)}}}function Wv(n,t,e,i,r,o,a){const s=new Mt(`${t}_standard_material`,n);s.alphaMode=Pi.PBRMATERIAL_ALPHABLEND,s.backFaceCulling=!0,s.specularColor=me.Black(),i.hasAlpha=!0,s.sideOrientation=Ys.CW,s.diffuseTexture=i,s.diffuseColor=o?me.Black():dy(a),o&&(s.emissiveTexture=o,s.diffuseColor=dy(r)),e.material=s}function a6(n,t,e=Ae.BodyShape.MALE){const i={};for(const r of n)try{const o=uu(r,e);for(const a of o.contents)i[a.key]=a.url}catch{console.warn(`Skipping generation of mappings for wearable="${r.id}" since it lacks a representation for bodyShape="${e}"`);continue}if(t){const r=Pb(t,e);for(const o of r.contents)i[o.key]=o.url}return i}function s6(n){const t=is(n.item)?[n.item,...n.wearables]:n.wearables,e=Fo(n.item)?n.item:void 0,i=a6(t,e,n.bodyShape);$t.OnPluginActivatedObservable.add(r=>{if(r.name==="gltf"){const o=r;o.preprocessUrlAsync=async a=>{const l=a.split("/").pop();if(!l)return a;const f=Object.keys(i).find(c=>c.endsWith(l));return i[f]||a}}})}const l6=`float angleY = 3.14 / 2.0;
|
|
16067
16067
|
|
|
16068
16068
|
mat3 rotateY = mat3(
|
|
16069
16069
|
cos(angleY), 0, sin(angleY),
|
package/static-local/index.html
CHANGED
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
<meta name="theme-color" content="#000000" />
|
|
8
8
|
<meta name="description" content="Preview wearables from Decentraland" />
|
|
9
9
|
<link rel="apple-touch-icon" href="/logo192.png" />
|
|
10
|
-
<link rel="manifest" href="
|
|
10
|
+
<link rel="manifest" href="./manifest.json" />
|
|
11
11
|
<title>Decentraland | Wearable Preview</title>
|
|
12
|
-
<script type="module" crossorigin src="
|
|
13
|
-
<link rel="stylesheet" crossorigin href="
|
|
12
|
+
<script type="module" crossorigin src="./assets/index-CpOoRjiJ.js"></script>
|
|
13
|
+
<link rel="stylesheet" crossorigin href="./assets/index-DrFxbJ99.css">
|
|
14
14
|
</head>
|
|
15
15
|
<body>
|
|
16
16
|
<noscript>You need to enable JavaScript to run this app.</noscript>
|