This commit is contained in:
mileswa1q2 authored and GitHub committed 2023-11-23 20:35:29 +00:00
1 parent 23795bd826
commit 1cf1d1988e
198 files changed
+28801

No files matched your search

@@ -0,0 +1,2 @@
var gdjs;(function(o){const r=s=>s===void 0?100:s<=0?1:s;class h extends o.RuntimeObject{constructor(t,e){super(t,e);this._z=0;this._flippedX=!1;this._flippedY=!1;this._flippedZ=!1;this._rotationX=0;this._rotationY=0;this._width=this._originalWidth=r(e.content.width),this._height=this._originalHeight=r(e.content.height),this._depth=this._originalDepth=r(e.content.depth)}getRendererObject(){return null}get3DRendererObject(){return this.getRenderer().get3DRendererObject()}updateFromObjectData(t,e){return this._setOriginalWidth(r(e.content.width)),this._setOriginalHeight(r(e.content.height)),this._setOriginalDepth(r(e.content.depth)),!0}extraInitializationFromInitialInstance(t){t.customSize&&(this.setWidth(t.width),this.setHeight(t.height)),t.depth!==void 0&&this.setDepth(t.depth)}setX(t){super.setX(t),this.getRenderer().updatePosition()}setY(t){super.setY(t),this.getRenderer().updatePosition()}setZ(t){t!==this._z&&(this._z=t,this.getRenderer().updatePosition())}getZ(){return this._z}getDrawableZ(){return this.getZ()}getCenterZ(){return this.getDepth()/2}getCenterZInScene(){return this.getDrawableZ()+this.getCenterZ()}setCenterZInScene(t){this.setZ(t+this._z-(this.getDrawableZ()+this.getCenterZ()))}setAngle(t){super.setAngle(t),this.getRenderer().updateRotation()}setRotationX(t){this._rotationX=t,this.getRenderer().updateRotation()}setRotationY(t){this._rotationY=t,this.getRenderer().updateRotation()}getRotationX(){return this._rotationX}getRotationY(){return this._rotationY}turnAroundX(t){const e=o.RuntimeObject3D._temporaryVector;e.set(1,0,0);const i=this.getRenderer().get3DRendererObject();i.rotateOnWorldAxis(e,o.toRad(t)),this._rotationX=o.toDegrees(i.rotation.x),this._rotationY=o.toDegrees(i.rotation.y),this.setAngle(o.toDegrees(i.rotation.z))}turnAroundY(t){const e=o.RuntimeObject3D._temporaryVector;e.set(0,1,0);const i=this.getRenderer().get3DRendererObject();i.rotateOnWorldAxis(e,o.toRad(t)),this._rotationX=o.toDegrees(i.rotation.x),this._rotationY=o.toDegrees(i.rotation.y),this.setAngle(o.toDegrees(i.rotation.z))}turnAroundZ(t){const e=o.RuntimeObject3D._temporaryVector;e.set(0,0,1);const i=this.getRenderer().get3DRendererObject();i.rotateOnWorldAxis(e,o.toRad(t)),this._rotationX=o.toDegrees(i.rotation.x),this._rotationY=o.toDegrees(i.rotation.y),this.setAngle(o.toDegrees(i.rotation.z))}getWidth(){return this._width}getHeight(){return this._height}getDepth(){return this._depth}setWidth(t){this._width!==t&&(this._width=t,this.getRenderer().updateSize(),this.invalidateHitboxes())}setHeight(t){this._height!==t&&(this._height=t,this.getRenderer().updateSize(),this.invalidateHitboxes())}setSize(t,e){this.setWidth(t),this.setHeight(e)}setDepth(t){this._depth!==t&&(this._depth=t,this.getRenderer().updateSize())}_getOriginalWidth(){return this._originalWidth}_getOriginalHeight(){return this._originalHeight}_getOriginalDepth(){return this._originalDepth}_setOriginalWidth(t){t<=0&&(t=1);const e=this._originalWidth;this._originalWidth=t,e===this._width&&this.setWidth(t)}_setOriginalHeight(t){t<=0&&(t=1);const e=this._originalHeight;this._originalHeight=t,e===this._height&&this.setHeight(t)}_setOriginalDepth(t){t<=0&&(t=1);const e=this._originalDepth;this._originalDepth=t,e===this._depth&&this.setDepth(t)}setScale(t){this.setScaleX(t),this.setScaleY(t),this.setScaleZ(t)}setScaleX(t){t<0&&(t=0),this.setWidth(this._originalWidth*t)}setScaleY(t){t<0&&(t=0),this.setHeight(this._originalHeight*t)}setScaleZ(t){t<0&&(t=0),this.setDepth(this._originalDepth*t)}getScale(){const t=this.getScaleX(),e=this.getScaleY(),i=this.getScaleZ();return t===e&&t===i?t:Math.pow(t*e*i,1/3)}getScaleX(){return Math.abs(this._width/this._originalWidth)}getScaleY(){return Math.abs(this._height/this._originalHeight)}getScaleZ(){return Math.abs(this._depth/this._originalDepth)}flipX(t){t!==this._flippedX&&(this._flippedX=t,this.getRenderer().updateSize())}flipY(t){t!==this._flippedY&&(this._flippedY=t,this.getRenderer().updateSize())}flipZ(t){t!==this._flippedZ&&(this._flippedZ=t,this.getRenderer().updateSize())}isFlippedX(){return this._flippedX}isFlippedY(){return this._flippedY}isFlippedZ(){return this._flippedZ}hide(t){super.hide(t),this.getRenderer().updateVisibility()}}h._temporaryVector=new THREE.Vector3,o.RuntimeObject3D=h})(gdjs||(gdjs={}));
//# sourceMappingURL=A_RuntimeObject3D.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(e){class o{constructor(t,i,s){this._object=t,this._threeObject3D=s,this._threeObject3D.rotation.order="ZYX",i.getLayer("").getRenderer().add3DRendererObject(this._threeObject3D)}get3DRendererObject(){return this._threeObject3D}updatePosition(){this._threeObject3D.position.set(this._object.x+this._object.getWidth()/2,this._object.y+this._object.getHeight()/2,this._object.getZ()+this._object.getDepth()/2)}updateRotation(){this._threeObject3D.rotation.set(e.toRad(this._object.getRotationX()),e.toRad(this._object.getRotationY()),e.toRad(this._object.angle))}updateSize(){const t=this._object;this._threeObject3D.scale.set(t.isFlippedX()?-t.getWidth():t.getWidth(),t.isFlippedY()?-t.getHeight():t.getHeight(),t.isFlippedZ()?-t.getDepth():t.getDepth()),this.updatePosition()}updateVisibility(){this._threeObject3D.visible=!this._object.isHidden()}}e.RuntimeObject3DRenderer=o})(gdjs||(gdjs={}));
//# sourceMappingURL=A_RuntimeObject3DRenderer.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(e){class a extends e.RuntimeBehavior{constructor(t,o,n){super(t,o,n);this.object=n}updateFromBehaviorData(t,o){return!0}onDeActivate(){}onDestroy(){}doStepPreEvents(t){}doStepPostEvents(t){}setZ(t){this.object.setZ(t)}getZ(){return this.object.getZ()}getCenterZInScene(){return this.object.getCenterZInScene()}setCenterZInScene(t){this.object.setCenterZInScene(t)}setRotationX(t){this.object.setRotationX(t)}setRotationY(t){this.object.setRotationY(t)}getRotationX(){return this.object.getRotationX()}getRotationY(){return this.object.getRotationY()}turnAroundX(t){this.object.turnAroundX(t)}turnAroundY(t){this.object.turnAroundY(t)}turnAroundZ(t){this.object.turnAroundZ(t)}getDepth(){return this.object.getDepth()}setDepth(t){this.object.setDepth(t)}setScaleZ(t){this.object.setScaleZ(t)}getScaleZ(){return this.object.getScaleZ()}flipZ(t){this.object.flipZ(t)}isFlippedZ(){return this.object.isFlippedZ()}}e.Base3DBehavior=a,e.registerBehavior("Scene3D::Base3DBehavior",e.Base3DBehavior)})(gdjs||(gdjs={}));
//# sourceMappingURL=Base3DBehavior.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(c){const i={front:0,back:1,left:2,right:3,top:4,bottom:5};class o extends c.RuntimeObject3D{constructor(t,e){super(t,e);this._materialType=c.Cube3DRuntimeObject.MaterialType.Basic;this._shouldUseTransparentTexture=e.content.enableTextureTransparency||!1,this._facesOrientation=e.content.facesOrientation||"Y",this._visibleFacesBitmask=0,e.content.frontFaceVisible&&(this._visibleFacesBitmask|=1<<i.front),e.content.backFaceVisible&&(this._visibleFacesBitmask|=1<<i.back),e.content.leftFaceVisible&&(this._visibleFacesBitmask|=1<<i.left),e.content.rightFaceVisible&&(this._visibleFacesBitmask|=1<<i.right),e.content.topFaceVisible&&(this._visibleFacesBitmask|=1<<i.top),e.content.bottomFaceVisible&&(this._visibleFacesBitmask|=1<<i.bottom),this._textureRepeatFacesBitmask=0,e.content.frontFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.front),e.content.backFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.back),e.content.leftFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.left),e.content.rightFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.right),e.content.topFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.top),e.content.bottomFaceResourceRepeat&&(this._textureRepeatFacesBitmask|=1<<i.bottom),this._backFaceUpThroughWhichAxisRotation=e.content.backFaceUpThroughWhichAxisRotation||"X",this._faceResourceNames=[e.content.frontFaceResourceName,e.content.backFaceResourceName,e.content.leftFaceResourceName,e.content.rightFaceResourceName,e.content.topFaceResourceName,e.content.bottomFaceResourceName],this._materialType=this._convertMaterialType(e.content.materialType),this._renderer=new c.Cube3DRuntimeObjectRenderer(this,t),this.onCreated()}setFaceVisibility(t,e){const s=i[t];s!==void 0&&e!==this.isFaceAtIndexVisible(s)&&(e?this._visibleFacesBitmask|=1<<s:this._visibleFacesBitmask&=~(1<<s),this._renderer.updateFace(s))}setRepeatTextureOnFace(t,e){const s=i[t];s!==void 0&&e!==this.shouldRepeatTextureOnFaceAtIndex(s)&&(e?this._textureRepeatFacesBitmask|=1<<s:this._textureRepeatFacesBitmask&=~(1<<s),this._renderer.updateFace(s))}isFaceVisible(t){const e=i[t];return e===void 0?!1:this.isFaceAtIndexVisible(e)}isFaceAtIndexVisible(t){return(this._visibleFacesBitmask&1<<t)!=0}shouldRepeatTextureOnFaceAtIndex(t){return(this._textureRepeatFacesBitmask&1<<t)!=0}setFaceResourceName(t,e){const s=i[t];s!==void 0&&this._faceResourceNames[s]!==e&&(this._faceResourceNames[s]=e,this._renderer.updateFace(s))}getFaceAtIndexResourceName(t){return this._faceResourceNames[t]}getRenderer(){return this._renderer}getBackFaceUpThroughWhichAxisRotation(){return this._backFaceUpThroughWhichAxisRotation}setBackFaceUpThroughWhichAxisRotation(t){this._backFaceUpThroughWhichAxisRotation=t,this._renderer.updateFace(i.back)}getFacesOrientation(){return this._facesOrientation}setFacesOrientation(t){this._facesOrientation=t,this._renderer.updateFace(i.left),this._renderer.updateFace(i.right),this._renderer.updateFace(i.top)}updateFromObjectData(t,e){return super.updateFromObjectData(t,e),t.content.frontFaceVisible!==e.content.frontFaceVisible&&this.setFaceVisibility("front",e.content.frontFaceVisible),t.content.backFaceVisible!==e.content.backFaceVisible&&this.setFaceVisibility("back",e.content.backFaceVisible),t.content.leftFaceVisible!==e.content.leftFaceVisible&&this.setFaceVisibility("left",e.content.leftFaceVisible),t.content.rightFaceVisible!==e.content.rightFaceVisible&&this.setFaceVisibility("right",e.content.rightFaceVisible),t.content.topFaceVisible!==e.content.topFaceVisible&&this.setFaceVisibility("top",e.content.topFaceVisible),t.content.bottomFaceVisible!==e.content.bottomFaceVisible&&this.setFaceVisibility("bottom",e.content.bottomFaceVisible),t.content.frontFaceResourceName!==e.content.frontFaceResourceName&&this.setFaceResourceName("front",e.content.frontFaceResourceName),t.content.backFaceResourceName!==e.content.backFaceResourceName&&this.setFaceResourceName("back",e.content.backFaceResourceName),t.content.leftFaceResourceName!==e.content.leftFaceResourceName&&this.setFaceResourceName("left",e.content.leftFaceResourceName),t.content.rightFaceResourceName!==e.content.rightFaceResourceName&&this.setFaceResourceName("right",e.content.rightFaceResourceName),t.content.topFaceResourceName!==e.content.topFaceResourceName&&this.setFaceResourceName("top",e.content.topFaceResourceName),t.content.bottomFaceResourceName!==e.content.bottomFaceResourceName&&this.setFaceResourceName("bottom",e.content.bottomFaceResourceName),t.content.frontFaceResourceRepeat!==e.content.frontFaceResourceRepeat&&this.setRepeatTextureOnFace("front",e.content.frontFaceResourceRepeat),t.content.backFaceResourceRepeat!==e.content.backFaceResourceRepeat&&this.setRepeatTextureOnFace("back",e.content.backFaceResourceRepeat),t.content.leftFaceResourceRepeat!==e.content.leftFaceResourceRepeat&&this.setRepeatTextureOnFace("left",e.content.leftFaceResourceRepeat),t.content.rightFaceResourceRepeat!==e.content.rightFLine truncated
//# sourceMappingURL=Cube3DRuntimeObject.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(M){const b={3:0,2:1,5:2,4:3,0:4,1:5},r={0:3,1:2,2:5,3:4,4:0,5:1},h={0:[0,0],1:[1,0],2:[0,1],3:[1,1]},_={0:[0,1],1:[0,0],2:[1,1],3:[1,0]};let g;const T=()=>(g||(g=new THREE.MeshBasicMaterial({transparent:!0,opacity:0,alphaTest:1})),g),n=(c,t)=>c.isFaceAtIndexVisible(t)?c.getInstanceContainer().getGame().getImageManager().getThreeMaterial(c.getFaceAtIndexResourceName(t),{useTransparentTexture:c.shouldUseTransparentTexture(),forceBasicMaterial:c._materialType===M.Cube3DRuntimeObject.MaterialType.Basic}):T();class f extends M.RuntimeObject3DRenderer{constructor(t,i){const l=new THREE.BoxGeometry(1,1,1),m=[n(t,r[0]),n(t,r[1]),n(t,r[2]),n(t,r[3]),n(t,r[4]),n(t,r[5])],x=new THREE.Mesh(l,m);super(t,i,x);this._boxMesh=x,this._cube3DRuntimeObject=t,this.updateSize(),this.updatePosition(),this.updateRotation()}updateFace(t){const i=b[t];i!==void 0&&(this._boxMesh.material[i]=n(this._cube3DRuntimeObject,t),this._cube3DRuntimeObject.isFaceAtIndexVisible(t)&&this.updateTextureUvMapping(t))}updateSize(){super.updateSize(),this.updateTextureUvMapping()}updateTextureUvMapping(t){const i=this._boxMesh.geometry.getAttribute("position"),l=this._boxMesh.geometry.getAttribute("uv"),m=t===void 0?0:b[t]*4,x=t===void 0?23:b[t]*4+3;for(let e=m;e<=x;e++){const R=Math.floor(e/4),o=this._boxMesh.material[R];if(!o||!o.map)continue;const u=this._cube3DRuntimeObject.shouldRepeatTextureOnFaceAtIndex(r[R]),d=this._cube3DRuntimeObject.getFacesOrientation()==="Y";let a,s;switch(R){case 0:u?d?(a=-(this._boxMesh.scale.z/o.map.source.data.width)*(i.getZ(e)-.5),s=-(this._boxMesh.scale.y/o.map.source.data.height)*(i.getY(e)+.5)):(a=-(this._boxMesh.scale.y/o.map.source.data.width)*(i.getY(e)-.5),s=this._boxMesh.scale.z/o.map.source.data.height*(i.getZ(e)-.5)):d?[a,s]=h[e%4]:[a,s]=_[e%4];break;case 1:u?d?(a=this._boxMesh.scale.z/o.map.source.data.width*(i.getZ(e)+.5),s=-(this._boxMesh.scale.y/o.map.source.data.height)*(i.getY(e)+.5)):(a=this._boxMesh.scale.y/o.map.source.data.width*(i.getY(e)+.5),s=this._boxMesh.scale.z/o.map.source.data.height*(i.getZ(e)-.5)):d?[a,s]=h[e%4]:([a,s]=_[e%4],a=-a,s=-s);break;case 2:u?(a=this._boxMesh.scale.x/o.map.source.data.width*(i.getX(e)+.5),s=this._boxMesh.scale.z/o.map.source.data.height*(i.getZ(e)-.5)):[a,s]=h[e%4];break;case 3:u?d?(a=this._boxMesh.scale.x/o.map.source.data.width*(i.getX(e)+.5),s=-(this._boxMesh.scale.z/o.map.source.data.height)*(i.getZ(e)+.5)):(a=-(this._boxMesh.scale.x/o.map.source.data.width)*(i.getX(e)-.5),s=this._boxMesh.scale.z/o.map.source.data.height*(i.getZ(e)-.5)):([a,s]=h[e%4],d||(a=-a,s=-s));break;case 4:u?(a=this._boxMesh.scale.x/o.map.source.data.width*(i.getX(e)+.5),s=-(this._boxMesh.scale.y/o.map.source.data.height)*(i.getY(e)+.5)):[a,s]=h[e%4];break;case 5:const p=this._cube3DRuntimeObject.getBackFaceUpThroughWhichAxisRotation()==="X";u?(a=(p?1:-1)*(this._boxMesh.scale.x/o.map.source.data.width)*(i.getX(e)+(p?1:-1)*.5),s=(p?1:-1)*(this._boxMesh.scale.y/o.map.source.data.height)*(i.getY(e)+(p?-1:1)*.5)):([a,s]=h[e%4],p&&(a=-a,s=-s));break;default:[a,s]=h[e%4]}l.setXY(e,a,s)}l.needsUpdate=!0}_updateMaterials(){for(let t=0;t<6;t++)this.updateFace(t)}}M.Cube3DRuntimeObjectRenderer=f})(gdjs||(gdjs={}));
//# sourceMappingURL=Cube3DRuntimeObjectPixiRenderer.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(i){i.PixiFiltersTools.registerFilterCreator("Scene3D::DirectionalLight",new class{makeFilter(o,r){return typeof THREE=="undefined"?new i.PixiFiltersTools.EmptyFilter:new class{constructor(){this._isEnabled=!1;this.top="Y-";this.elevation=45;this.rotation=0;this.light=new THREE.DirectionalLight,this.light.position.set(1,0,0),this.rotationObject=new THREE.Group,this.rotationObject.add(this.light),this.updateRotation()}isEnabled(t){return this._isEnabled}setEnabled(t,e){return this._isEnabled===e?!0:e?this.applyEffect(t):this.removeEffect(t)}applyEffect(t){const e=t.get3DRendererObject();return e?(e.add(this.rotationObject),this._isEnabled=!0,!0):!1}removeEffect(t){const e=t.get3DRendererObject();return e?(e.remove(this.rotationObject),this._isEnabled=!1,!0):!1}updatePreRender(t){}updateDoubleParameter(t,e){t==="intensity"?this.light.intensity=e:t==="elevation"?(this.elevation=e,this.updateRotation()):t==="rotation"&&(this.rotation=e,this.updateRotation())}updateStringParameter(t,e){t==="color"&&(this.light.color=new THREE.Color(i.PixiFiltersTools.rgbOrHexToHexNumber(e))),t==="top"&&(this.top=e,this.updateRotation())}updateBooleanParameter(t,e){}updateRotation(){this.top==="Z+"?(this.rotationObject.rotation.z=i.toRad(this.rotation),this.rotationObject.rotation.y=-i.toRad(this.elevation)):(this.rotationObject.rotation.y=i.toRad(this.rotation)-90,this.rotationObject.rotation.z=-i.toRad(this.elevation))}}}})})(gdjs||(gdjs={}));
//# sourceMappingURL=DirectionalLight.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(i){i.PixiFiltersTools.registerFilterCreator("Scene3D::HemisphereLight",new class{makeFilter(o,r){return typeof THREE=="undefined"?new i.PixiFiltersTools.EmptyFilter:new class{constructor(){this._isEnabled=!1;this.top="Y-";this.elevation=45;this.rotation=0;this.light=new THREE.HemisphereLight,this.light.position.set(1,0,0),this.rotationObject=new THREE.Group,this.rotationObject.add(this.light),this.updateRotation()}isEnabled(t){return this._isEnabled}setEnabled(t,e){return this._isEnabled===e?!0:e?this.applyEffect(t):this.removeEffect(t)}applyEffect(t){const e=t.get3DRendererObject();return e?(e.add(this.rotationObject),this._isEnabled=!0,!0):!1}removeEffect(t){const e=t.get3DRendererObject();return e?(e.remove(this.rotationObject),this._isEnabled=!1,!0):!1}updatePreRender(t){}updateDoubleParameter(t,e){t==="intensity"?this.light.intensity=e:t==="elevation"?(this.elevation=e,this.updateRotation()):t==="rotation"&&(this.rotation=e,this.updateRotation())}updateStringParameter(t,e){t==="skyColor"&&(this.light.color=new THREE.Color(i.PixiFiltersTools.rgbOrHexToHexNumber(e))),t==="groundColor"&&(this.light.groundColor=new THREE.Color(i.PixiFiltersTools.rgbOrHexToHexNumber(e))),t==="top"&&(this.top=e,this.updateRotation())}updateBooleanParameter(t,e){}updateRotation(){this.top==="Z+"?(this.rotationObject.rotation.z=i.toRad(this.rotation),this.rotationObject.rotation.y=-i.toRad(this.elevation)):(this.rotationObject.rotation.y=i.toRad(this.rotation)-90,this.rotationObject.rotation.z=-i.toRad(this.elevation))}}}})})(gdjs||(gdjs={}));
//# sourceMappingURL=HemisphereLight.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(n){const o=r=>{switch(r){case"ModelOrigin":return null;case"ObjectCenter":return[.5,.5,.5];case"BottomCenterZ":return[.5,.5,0];case"BottomCenterY":return[.5,1,.5];case"TopLeft":return[0,0,0];default:return null}};class s extends n.RuntimeObject3D{constructor(t,e){super(t,e);this._materialType=n.Model3DRuntimeObject.MaterialType.Basic;this._currentAnimationIndex=0;this._animationSpeedScale=1;this._animationPaused=!1;this._modelResourceName=e.content.modelResourceName,this._animations=e.content.animations,this._originPoint=o(e.content.originLocation),this._centerPoint=o(e.content.centerLocation),this._renderer=new n.Model3DRuntimeObjectRenderer(this,t),this._materialType=this._convertMaterialType(e.content.materialType),this._updateModel(e),this._animations.length>0&&this._renderer.playAnimation(this._animations[0].source,this._animations[0].loop),this.onCreated()}updateFromObjectData(t,e){return super.updateFromObjectData(t,e),(t.content.width!==e.content.width||t.content.height!==e.content.height||t.content.depth!==e.content.depth||t.content.rotationX!==e.content.rotationX||t.content.rotationY!==e.content.rotationY||t.content.rotationZ!==e.content.rotationZ||t.content.keepAspectRatio!==e.content.keepAspectRatio)&&this._updateModel(e),t.content.materialType!==e.content.materialType&&(this._materialType=this._convertMaterialType(e.content.materialType),this._updateModel(e)),t.content.originLocation!==e.content.originLocation&&(this._originPoint=o(e.content.originLocation)),t.content.centerLocation!==e.content.centerLocation&&(this._centerPoint=o(e.content.centerLocation)),!0}_updateModel(t){const e=t.content.rotationX||0,a=t.content.rotationY||0,m=t.content.rotationZ||0,i=t.content.keepAspectRatio;this._renderer._updateModel(e,a,m,this._getOriginalWidth(),this._getOriginalHeight(),this._getOriginalDepth(),i)}getRenderer(){return this._renderer}_convertMaterialType(t){return t==="KeepOriginal"?n.Model3DRuntimeObject.MaterialType.KeepOriginal:t==="StandardWithoutMetalness"?n.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness:n.Model3DRuntimeObject.MaterialType.Basic}update(t){const e=this.getElapsedTime()/1e3;this._renderer.updateAnimation(e*this._animationSpeedScale)}getAnimationIndex(){return this._currentAnimationIndex}setAnimationIndex(t){if(t=t|0,t<this._animations.length&&this._currentAnimationIndex!==t&&t>=0){const e=this._animations[t];this._currentAnimationIndex=t,this._renderer.playAnimation(e.source,e.loop),this._animationPaused&&this._renderer.pauseAnimation()}}getAnimationName(){return this._currentAnimationIndex>=this._animations.length?"":this._animations[this._currentAnimationIndex].name}setAnimationName(t){if(!t)return;const e=this._animations.findIndex(a=>a.name===t);e>=0&&this.setAnimationIndex(e)}isCurrentAnimationName(t){return this.getAnimationName()===t}hasAnimationEnded(){return this._renderer.hasAnimationEnded()}isAnimationPaused(){return this._animationPaused}pauseAnimation(){this._animationPaused=!0,this._renderer.pauseAnimation()}resumeAnimation(){this._animationPaused=!1,this._renderer.resumeAnimation()}getAnimationSpeedScale(){return this._animationSpeedScale}setAnimationSpeedScale(t){this._animationSpeedScale=t}getAnimationElapsedTime(){return this._renderer.getAnimationElapsedTime()}setAnimationElapsedTime(t){this._renderer.setAnimationElapsedTime(t)}getAnimationDuration(){return this._renderer.getAnimationDuration(this._animations[this._currentAnimationIndex].source)}getCenterX(){const t=this._renderer.getCenterPoint();return this.getWidth()*t[0]}getCenterY(){const t=this._renderer.getCenterPoint();return this.getHeight()*t[1]}getCenterZ(){const t=this._renderer.getCenterPoint();return this.getDepth()*t[2]}getDrawableX(){const t=this._renderer.getOriginPoint();return this.getX()-this.getWidth()*t[0]}getDrawableY(){const t=this._renderer.getOriginPoint();return this.getY()-this.getHeight()*t[1]}getDrawableZ(){const t=this._renderer.getOriginPoint();return this.getZ()-this.getDepth()*t[2]}}n.Model3DRuntimeObject=s,function(t){let r;(function(i){i[i.Basic=0]="Basic",i[i.StandardWithoutMetalness=1]="StandardWithoutMetalness",i[i.KeepOriginal=2]="KeepOriginal"})(r=t.MaterialType||(t.MaterialType={}))}(s=n.Model3DRuntimeObject||(n.Model3DRuntimeObject={})),n.registerObject("Scene3D::Model3DObject",n.Model3DRuntimeObject)})(gdjs||(gdjs={}));
//# sourceMappingURL=Model3DRuntimeObject.js.map
@@ -0,0 +1,2 @@
var gdjs;(function(o){const E=n=>{n.metalness&&(n.metalness=0)},M=n=>{const t=n;if(!!t.material)if(Array.isArray(t.material))for(let e=0;e<t.material.length;e++)E(t.material[e]);else E(t.material)},T=n=>n.traverse(M),p=n=>{const t=new THREE.MeshBasicMaterial;return n.color&&(t.color=n.color),n.map&&(t.map=n.map),t},f=n=>{const t=n;if(!!t.material)if(Array.isArray(t.material))for(let e=0;e<t.material.length;e++)t.material[e]=p(t.material[e]);else t.material=p(t.material)},D=n=>n.traverse(f);class O extends o.RuntimeObject3DRenderer{constructor(t,e){const a=e.getGame().getModel3DManager().getModel(t._modelResourceName),s=new THREE.Group,l=new THREE.Group;l.rotation.order="ZYX",l.add(s);super(t,e,l);this._model3DRuntimeObject=t,this._threeObject=s,this._originalModel=a,this._modelOriginPoint=[0,0,0],this.updateSize(),this.updatePosition(),this.updateRotation(),this._animationMixer=new THREE.AnimationMixer(s),this._action=null}updateAnimation(t){this._animationMixer.update(t)}updatePosition(){const t=this.getOriginPoint(),e=this.getCenterPoint();this.get3DRendererObject().position.set(this._object.getX()-this._object.getWidth()*(t[0]-e[0]),this._object.getY()-this._object.getHeight()*(t[1]-e[1]),this._object.getZ()-this._object.getDepth()*(t[2]-e[2]))}getOriginPoint(){return this._model3DRuntimeObject._originPoint||this._modelOriginPoint}getCenterPoint(){return this._model3DRuntimeObject._centerPoint||this._modelOriginPoint}_updateDefaultTransformation(t,e,a,s,l,_,u,r){t.rotation.set(o.toRad(e),o.toRad(a),o.toRad(s)),t.updateMatrixWorld(!0);const i=new THREE.Box3().setFromObject(t),m=i.max.x-i.min.x,c=i.max.y-i.min.y,d=i.max.z-i.min.z;this._modelOriginPoint[0]=-i.min.x/m,this._modelOriginPoint[1]=-i.min.y/c,this._modelOriginPoint[2]=-i.min.z/d,this._modelOriginPoint[1]=1-this._modelOriginPoint[1];const h=this._model3DRuntimeObject._centerPoint;h&&t.position.set(-(i.min.x+(i.max.x-i.min.x)*h[0]),-(i.min.y+(i.max.y-i.min.y)*(1-h[1])),-(i.min.z+(i.max.z-i.min.z)*h[2])),t.scale.set(1,1,1),t.rotation.set(o.toRad(e),o.toRad(a),o.toRad(s));const b=1/m,j=1/c,x=1/d,g=new THREE.Matrix4;if(g.makeScale(b,-j,x),t.updateMatrix(),t.applyMatrix4(g),r){const H=l/m,A=_/c,P=u/d,R=Math.min(H,A,P);this._object._setOriginalWidth(R*m),this._object._setOriginalHeight(R*c),this._object._setOriginalDepth(R*d)}}_updateModel(t,e,a,s,l,_,u){const r=new THREE.Group;r.rotation.order="ZYX";const i=THREE_ADDONS.SkeletonUtils.clone(this._originalModel.scene);r.add(i),this._replaceMaterials(r),this._updateDefaultTransformation(r,t,e,a,s,l,_,u),this.get3DRendererObject().remove(this._threeObject),this.get3DRendererObject().add(r),this._threeObject=r,this._animationMixer=new THREE.AnimationMixer(i);const m=this._model3DRuntimeObject.isAnimationPaused();this._model3DRuntimeObject.setAnimationIndex(this._model3DRuntimeObject.getAnimationIndex()),m&&this.pauseAnimation()}_replaceMaterials(t){this._model3DRuntimeObject._materialType===o.Model3DRuntimeObject.MaterialType.StandardWithoutMetalness?T(t):this._model3DRuntimeObject._materialType===o.Model3DRuntimeObject.MaterialType.Basic&&D(t)}getAnimationCount(){return this._originalModel.animations.length}getAnimationName(t){return this._originalModel.animations[t].name}hasAnimationEnded(){return this._action?!this._action.isRunning():!0}animationPaused(){if(!!this._action)return this._action.paused}pauseAnimation(){!this._action||(this._action.paused=!0)}resumeAnimation(){!this._action||(this._action.paused=!1)}playAnimation(t,e){this._animationMixer.stopAllAction();const a=THREE.AnimationClip.findByName(this._originalModel.animations,t);if(!a){console.error(`The GLB file: ${this._model3DRuntimeObject._modelResourceName} doesn't have any animation named: ${t}`);return}this._action=this._animationMixer.clipAction(a),this._action.setLoop(e?THREE.LoopRepeat:THREE.LoopOnce,Number.POSITIVE_INFINITY),this._action.clampWhenFinished=!0,this._action.play(),this._animationMixer.update(0)}getAnimationElapsedTime(){return this._action?this._action.time:0}setAnimationElapsedTime(t){this._action&&(this._action.time=t)}getAnimationDuration(t){const e=THREE.AnimationClip.findByName(this._originalModel.animations,t);return e?e.duration:0}}o.Model3DRuntimeObjectRenderer=O})(gdjs||(gdjs={}));
//# sourceMappingURL=Model3DRuntimeObject3DRenderer.js.map
+2
View File
@@ -0,0 +1,2 @@
var gdjs;(function(l){let R;(function(m){const y=45;let d;(function(g){g.getCameraZ=(t,r,a)=>{const o=t.getLayer(r),e=o.getRenderer().getThreeCamera(),n=e?e.fov:y;return o.getCameraZ(n,a)},g.setCameraZ=(t,r,a,o)=>{const s=t.getLayer(a),n=s.getRenderer().getThreeCamera(),i=n?n.fov:y;s.setCameraZ(r,i,o)},g.getCameraRotationX=(t,r,a)=>{const e=t.getLayer(r).getRenderer().getThreeCamera();return e?l.toDegrees(e.rotation.x):0},g.setCameraRotationX=(t,r,a,o)=>{const n=t.getLayer(a).getRenderer().getThreeCamera();!n||(n.rotation.x=l.toRad(r))},g.getCameraRotationY=(t,r,a)=>{const e=t.getLayer(r).getRenderer().getThreeCamera();return e?l.toDegrees(e.rotation.y):0},g.setCameraRotationY=(t,r,a,o)=>{const n=t.getLayer(a).getRenderer().getThreeCamera();!n||(n.rotation.y=l.toRad(r))},g.turnCameraTowardObject=(t,r,a,o,s)=>{if(!r)return;const e=t.getLayer(a),i=e.getRenderer().getThreeCamera();!i||(s?i.up.set(0,1,0):i.up.set(0,0,1),i.lookAt(r.getCenterXInScene(),-r.getCenterYInScene(),r.getZ?r.getZ():0),e.setCameraRotation(l.toDegrees(-i.rotation.z)))},g.turnCameraTowardPosition=(t,r,a,o,s,e,n)=>{const i=t.getLayer(s),c=i.getRenderer().getThreeCamera();!c||(n?c.up.set(0,1,0):c.up.set(0,0,1),c.lookAt(r,-a,o),i.setCameraRotation(l.toDegrees(-c.rotation.z)))},g.getNearPlane=(t,r,a)=>{const e=t.getLayer(r).getRenderer().getThreeCamera();return e?e.near:0},g.setNearPlane=(t,r,a,o)=>{const e=t.getLayer(a).getRenderer(),n=e.getThreeCamera();!n||(n.near=Math.min(Math.max(r,1e-4),n.far),e.setThreeCameraDirty(!0))},g.getFarPlane=(t,r,a)=>{const e=t.getLayer(r).getRenderer().getThreeCamera();return e?e.far:0},g.setFarPlane=(t,r,a,o)=>{const e=t.getLayer(a).getRenderer(),n=e.getThreeCamera();!n||(n.far=Math.max(r,n.near),e.setThreeCameraDirty(!0))},g.getFov=(t,r,a)=>{const e=t.getLayer(r).getRenderer().getThreeCamera();return e?e.fov:45},g.setFov=(t,r,a,o)=>{const e=t.getLayer(a).getRenderer(),n=e.getThreeCamera();!n||(n.fov=Math.min(Math.max(r,0),180),e.setThreeCameraDirty(!0))}})(d=m.camera||(m.camera={}))})(R=l.scene3d||(l.scene3d={}))})(gdjs||(gdjs={}));
//# sourceMappingURL=Scene3DTools.js.map