3 lines
4.2 KiB
JavaScript
3 lines
4.2 KiB
JavaScript
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
|