xrfragment/dist/aframe-blink-controls.min.js

2 lines
18 KiB
JavaScript

(()=>{if(AFRAME.registerGeometry("prism",{schema:{depth:{default:1,min:0},height:{default:1,min:0},width:{default:1,min:0}},init:function(t){const i=new THREE.Shape;i.moveTo(t.width/2,0),i.lineTo(0,t.height),i.lineTo(-t.width/2,0),i.lineTo(t.width/2,0);const e={steps:2,depth:t.depth,bevelEnabled:!1};this.geometry=new THREE.ExtrudeGeometry(i,e)}}),"undefined"==typeof AFRAME)throw new Error("Component attempted to register before AFRAME was available.");AFRAME.registerComponent("blink-controls",{schema:{button:{default:"",oneOf:["trackpad","trigger","grip","menu","thumbstick"]},startEvents:{type:"array",default:[]},endEvents:{type:"array",default:[]},cancelEvents:{type:"array",default:[]},collisionEntities:{default:""},hitEntity:{type:"selector"},cameraRig:{type:"selector",default:"#player"},teleportOrigin:{type:"selector",default:"#camera"},hitCylinderColor:{type:"color",default:"#4d93fd"},hitCylinderRadius:{default:.25,min:0},hitCylinderHeight:{default:.3,min:0},interval:{default:0},curveNumberPoints:{default:60,min:2},curveLineWidth:{default:.025},curveHitColor:{type:"color",default:"#4d93fd"},curveMissColor:{type:"color",default:"#ff0000"},curveShootingSpeed:{default:10,min:0},defaultPlaneSize:{default:100},landingNormal:{type:"vec3",default:{x:0,y:1,z:0}},landingMaxAngle:{default:"45",min:0,max:360},drawIncrementally:{default:!0},incrementalDrawMs:{default:300},missOpacity:{default:.8},hitOpacity:{default:.8},snapTurn:{default:!0},rotateOnTeleport:{default:!0}},init:function(){const t=this.data,i=this.el;let e;this.active=!1,this.obj=i.object3D,this.controllerPosition=new THREE.Vector3,this.hitEntityQuaternion=new THREE.Quaternion,this.teleportOriginQuaternion=new THREE.Quaternion,this.hitPoint=new THREE.Vector3,this.collisionObjectNormalMatrix=new THREE.Matrix3,this.collisionWorldNormal=new THREE.Vector3,this.rigWorldPosition=new THREE.Vector3,this.newRigWorldPosition=new THREE.Vector3,this.teleportEventDetail={oldPosition:this.rigWorldPosition,newPosition:this.newRigWorldPosition,hitPoint:this.hitPoint,rotationQuaternion:this.hitEntityQuaternion},this.hit=!1,this.prevCheckTime=void 0,this.referenceNormal=new THREE.Vector3,this.curveMissColor=new THREE.Color,this.curveHitColor=new THREE.Color,this.raycaster=new THREE.Raycaster,this.defaultPlane=this.createDefaultPlane(this.data.defaultPlaneSize),this.defaultCollisionMeshes=[this.defaultPlane];const n=this.teleportEntity=document.createElement("a-entity");if(n.classList.add("teleportRay"),n.setAttribute("visible",!1),i.sceneEl.appendChild(this.teleportEntity),this.onButtonDown=this.onButtonDown.bind(this),this.onButtonUp=this.onButtonUp.bind(this),this.cancel=this.cancel.bind(this),this.handleThumbstickAxis=this.handleThumbstickAxis.bind(this),this.teleportOrigin=this.data.teleportOrigin,this.cameraRig=this.data.cameraRig,this.snapturnRotation=THREE.MathUtils.degToRad(45),this.canSnapturn=!0,this.addedEvents=[],this.data.startEvents.length&&this.data.endEvents.length){for(e=0;e<this.data.startEvents.length;e++)this.addedEvents.push([this.data.startEvents[e],this.onButtonDown]),i.addEventListener(this.data.startEvents[e],this.onButtonDown);for(e=0;e<this.data.endEvents.length;e++)this.addedEvents.push([this.data.endEvents[e],this.onButtonUp]),i.addEventListener(this.data.endEvents[e],this.onButtonUp)}else t.button?(this.addedEvents.push([t.button+"down",this.onButtonDown]),this.addedEvents.push([t.button+"up",this.onButtonUp]),i.addEventListener(t.button+"down",this.onButtonDown),i.addEventListener(t.button+"up",this.onButtonUp)):this.thumbstickAxisActivation=!0;for(e=0;e<this.data.cancelEvents.length;e++)this.addedEvents.push([this.data.cancelEvents[e],this.cancel]),i.addEventListener(this.data.cancelEvents[e],this.cancel);this.addedEvents.push(["thumbstickmoved",this.handleThumbstickAxis]),i.addEventListener("thumbstickmoved",this.handleThumbstickAxis),this.queryCollisionEntities()},handleSnapturn:function(t,i){i<.5&&(this.canSnapturn=!0),this.canSnapturn&&i>.95&&(Math.abs(t-Math.PI/2)<.6?(this.cameraRig.object3D.rotateY(+this.snapturnRotation),this.canSnapturn=!1):Math.abs(t-1.5*Math.PI)<.6&&(this.cameraRig.object3D.rotateY(-this.snapturnRotation),this.canSnapturn=!1))},handleThumbstickAxis:function(t){if(void 0!==t.detail.x&&void 0!==t.detail.y){const i=Math.atan2(t.detail.x,t.detail.y)+Math.PI,e=Math.sqrt(t.detail.x**2+t.detail.y**2);this.active?(e>.95&&(this.obj.getWorldPosition(this.controllerPosition),this.controllerPosition.setComponent(1,this.hitEntity.object3D.position.y),this.hitEntity.object3D.visible=!1,this.hitEntity.object3D.lookAt(this.controllerPosition),this.hitEntity.object3D.rotateY(i),this.hitEntity.object3D.visible=!0,this.hitEntity.object3D.getWorldQuaternion(this.hitEntityQuaternion)),0===Math.abs(t.detail.x)&&0===Math.abs(t.detail.y)&&this.onButtonUp()):this.thumbstickAxisActivation&&e>.95&&(i<.5||i>5.78)?this.onButtonDown():this.data.snapTurn&&this.handleSnapturn(i,e)}},update:function(t){const i=this.data,e=AFRAME.utils.diff(i,t);this.referenceNormal.copy(i.landingNormal),this.curveMissColor.set(i.curveMissColor),this.curveHitColor.set(i.curveHitColor),(!this.line||"curveLineWidth"in e||"curveNumberPoints"in e||"type"in e)&&(this.line=this.createLine(i),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.numActivePoints=i.curveNumberPoints,this.teleportEntity.setObject3D("mesh",this.line.mesh)),i.hitEntity?this.hitEntity=i.hitEntity:(!this.hitEntity||"hitCylinderColor"in e||"hitCylinderHeight"in e||"hitCylinderRadius"in e)&&(this.hitEntity&&this.hitEntity.parentNode.removeChild(this.hitEntity),this.hitEntity=this.createHitEntity(i),this.el.sceneEl.appendChild(this.hitEntity)),this.hitEntity.setAttribute("visible",!1),i.hitEntity||this.hitEntity.lastElementChild.setAttribute("visible",i.rotateOnTeleport),"collisionEntities"in e&&this.queryCollisionEntities()},remove:function(){const t=this.el,i=this.hitEntity,e=this.teleportEntity;i&&i.parentNode.removeChild(i),e&&e.parentNode.removeChild(e),t.sceneEl.removeEventListener("child-attached",this.childAttachHandler),t.sceneEl.removeEventListener("child-detached",this.childDetachHandler);for(const[i,e]of this.addedEvents)t.removeEventListener(i,e)},tick:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3(0,-9.8,0),n=new THREE.Vector3,s=new THREE.Vector3,o=new THREE.Quaternion,r=new THREE.Vector3,a=new THREE.Vector3,h=new THREE.Vector3,l=new THREE.Vector3,c=new THREE.Vector3;let d=0;return function(u,E){if(!this.active)return;if(this.data.drawIncrementally&&this.redrawLine&&(this.redrawLine=!1,d=0),d+=E,this.numActivePoints=this.data.curveNumberPoints*d/this.data.incrementalDrawMs,this.numActivePoints>this.data.curveNumberPoints&&(this.numActivePoints=this.data.curveNumberPoints),this.prevCheckTime&&u-this.prevCheckTime<this.data.interval)return;this.prevCheckTime=u;this.obj.matrixWorld.decompose(r,o,a);const p=h.set(0,0,-1).applyQuaternion(o).normalize();this.line.setDirection(c.copy(p)),this.obj.getWorldPosition(t),s.copy(t),this.teleportEntity.setAttribute("visible",!0),d<this.data.incrementalDrawMs?this.line.material.color.set(this.curveHitColor):this.line.material.color.set(this.curveMissColor),this.line.material.opacity=this.data.missOpacity,this.line.material.transparent=this.data.missOpacity<1,this.hitEntity.setAttribute("visible",!1),this.hit=!1,i.copy(p).multiplyScalar(this.data.curveShootingSpeed),this.lastDrawnIndex=0;const A=this.data.drawIncrementally?this.numActivePoints:this.line.numPoints;for(let o=0;o<A+1;o++){let r;r=o===Math.floor(A+1)?A/(this.line.numPoints-1):o/(this.line.numPoints-1);const a=this.parabolicCurveMaxRoot(t,i,e);r*=Math.max(1,1.5*a),this.parabolicCurve(t,i,e,r,n);const h=l.copy(n).sub(s).normalize();if(this.raycaster.far=h.length(),this.raycaster.set(s,h),this.lastDrawnPoint=n,this.lastDrawnIndex=o,this.checkMeshCollisions(o,s,n))break;s.copy(n)}for(let t=this.lastDrawnIndex+1;t<this.line.numPoints;t++)this.line.setPoint(t,this.lastDrawnPoint,this.lastDrawnPoint)}}(),queryCollisionEntities:function(){const t=this.data,i=this.el;if(!t.collisionEntities)return void(this.collisionEntities=[]);const e=[].slice.call(i.sceneEl.querySelectorAll(t.collisionEntities));this.collisionEntities=e,this.childAttachHandler=function(i){i.detail.el.matches(t.collisionEntities)&&e.push(i.detail.el)},i.sceneEl.addEventListener("child-attached",this.childAttachHandler),this.childDetachHandler=function(i){if(!i.detail.el.matches(t.collisionEntities))return;const n=e.indexOf(i.detail.el);-1!==n&&e.splice(n,1)},i.sceneEl.addEventListener("child-detached",this.childDetachHandler)},onButtonDown:function(){this.active=!0,this.redrawLine=!0},onButtonUp:function(){const t=new THREE.Vector3,i=[new THREE.Vector3,new THREE.Vector3],e=new THREE.Vector3;return function(n){if(!this.active)return;if(this.active=!1,this.hitEntity.setAttribute("visible",!1),this.teleportEntity.setAttribute("visible",!1),!this.hit)return;const s=this.data.cameraRig||this.el.sceneEl.camera.el;if(s.object3D.getWorldPosition(this.rigWorldPosition),this.newRigWorldPosition.copy(this.hitPoint),t.copy(this.newRigWorldPosition),s.object3D.parent&&s.object3D.parent.worldToLocal(t),s.setAttribute("position",t),this.data.rotateOnTeleport&&(this.teleportOriginQuaternion.setFromEuler(new THREE.Euler(0,this.teleportOrigin.object3D.rotation.y,0)),this.teleportOriginQuaternion.invert(),this.teleportOriginQuaternion.multiply(this.hitEntityQuaternion),this.cameraRig.object3D.setRotationFromQuaternion(this.teleportOriginQuaternion)),!this.data.cameraRig){const t=document.querySelectorAll("a-entity[tracked-controls]");for(let n=0;n<t.length;n++)t[n].object3D.getWorldPosition(e),i[n].copy(this.newRigWorldPosition).sub(this.rigWorldPosition).add(e),t[n].setAttribute("position",i[n])}this.el.emit("teleported",this.teleportEventDetail)}}(),cancel:function(){this.active=!1,this.hitEntity.setAttribute("visible",!1),this.teleportEntity.setAttribute("visible",!1)},checkMeshCollisions:function(t,i,e){let n;this.data.collisionEntities?(n=this.collisionEntities.map((function(t){return t.getObject3D("mesh")})).filter((function(t){return t})),n=n.length?n:this.defaultCollisionMeshes):n=this.defaultCollisionMeshes;const s=this.raycaster.intersectObjects(n,!0);if(s.length>0&&!this.hit&&this.isValidNormalsAngle(s[0].face.normal,s[0].object)){const e=s[0].point;this.line.material.color.set(this.curveHitColor),this.line.material.opacity=this.data.hitOpacity,this.line.material.transparent=this.data.hitOpacity<1,this.hitEntity.setAttribute("position",e),this.hitEntity.setAttribute("visible",!0),this.hit=!0,this.hitPoint.copy(s[0].point);for(let e=t;e<this.line.numPoints;e++)this.line.setPoint(e,i,this.hitPoint);return!0}return this.line.setPoint(t,i,e),!1},isValidNormalsAngle:function(t,i){this.collisionObjectNormalMatrix.getNormalMatrix(i.matrixWorld),this.collisionWorldNormal.copy(t).applyMatrix3(this.collisionObjectNormalMatrix).normalize();const e=this.referenceNormal.angleTo(this.collisionWorldNormal);return THREE.MathUtils.RAD2DEG*e<=this.data.landingMaxAngle},parabolicCurveScalar:function(t,i,e,n){return t+i*n+.5*e*n*n},parabolicCurve:function(t,i,e,n,s){return s.x=this.parabolicCurveScalar(t.x,i.x,e.x,n),s.y=this.parabolicCurveScalar(t.y,i.y,e.y,n),s.z=this.parabolicCurveScalar(t.z,i.z,e.z,n),s},parabolicCurveMaxRoot:function(t,i,e){return(-i.y-Math.sqrt(i.y**2-.5*e.y*4*t.y))/(1*e.y)},createLine:function(t){const i="line"===t.type?2:t.curveNumberPoints;return new AFRAME.utils.RayCurve(i,t.curveLineWidth)},createHitEntity:function(t){const i=document.createElement("a-entity");i.className="hitEntity";const e=document.createElement("a-entity");e.setAttribute("geometry",{primitive:"torus",radius:t.hitCylinderRadius,radiusTubular:.01}),e.setAttribute("rotation",{x:90,y:0,z:0}),e.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,side:"double",depthTest:!1}),i.appendChild(e);const n=document.createElement("a-entity");n.setAttribute("position",{x:0,y:t.hitCylinderHeight/2,z:0}),n.setAttribute("geometry",{primitive:"cylinder",segmentsHeight:1,radius:t.hitCylinderRadius,height:t.hitCylinderHeight,openEnded:!0}),n.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,opacity:.5,side:"double",src:this.cylinderTexture,transparent:!0,depthTest:!1}),i.appendChild(n);const s=document.createElement("a-entity");return s.setAttribute("position",{x:0,y:.05,z:-1.5*t.hitCylinderRadius}),s.setAttribute("rotation",{x:90,y:180,z:0}),s.setAttribute("geometry",{primitive:"prism",height:.2,width:.2,depth:.05}),s.setAttribute("material",{shader:"flat",color:t.hitCylinderColor,side:"double",transparent:!0,opacity:.6,depthTest:!1}),i.appendChild(s),i},createDefaultPlane:function(t){const i=new THREE.PlaneGeometry(100,100);i.rotateX(-Math.PI/2);const e=new THREE.MeshBasicMaterial({color:16776960});return new THREE.Mesh(i,e)},cylinderTexture:"url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAQCAYAAADXnxW3AAAACXBIWXMAAAsTAAALEwEAmpwYAAAKT2lDQ1BQaG90b3Nob3AgSUNDIHByb2ZpbGUAAHjanVNnVFPpFj333vRCS4iAlEtvUhUIIFJCi4AUkSYqIQkQSoghodkVUcERRUUEG8igiAOOjoCMFVEsDIoK2AfkIaKOg6OIisr74Xuja9a89+bN/rXXPues852zzwfACAyWSDNRNYAMqUIeEeCDx8TG4eQuQIEKJHAAEAizZCFz/SMBAPh+PDwrIsAHvgABeNMLCADATZvAMByH/w/qQplcAYCEAcB0kThLCIAUAEB6jkKmAEBGAYCdmCZTAKAEAGDLY2LjAFAtAGAnf+bTAICd+Jl7AQBblCEVAaCRACATZYhEAGg7AKzPVopFAFgwABRmS8Q5ANgtADBJV2ZIALC3AMDOEAuyAAgMADBRiIUpAAR7AGDIIyN4AISZABRG8lc88SuuEOcqAAB4mbI8uSQ5RYFbCC1xB1dXLh4ozkkXKxQ2YQJhmkAuwnmZGTKBNA/g88wAAKCRFRHgg/P9eM4Ors7ONo62Dl8t6r8G/yJiYuP+5c+rcEAAAOF0ftH+LC+zGoA7BoBt/qIl7gRoXgugdfeLZr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ZK2pYZLVy0dWOa9rGo5sjxxedsK4xUFK4ZWBqw8uIq2Km3VT6vtV5eufr0mek1rgV7ByoLBtQFr6wtVCuWFfevc1+1dT1gvWd+1YfqGnRs+FYmKrhTbF5cVf9go3HjlG4dvyr+Z3JS0qavEuWTPZtJm6ebeLZ5bDpaql+aXDm4N2dq0Dd9WtO319kXbL5fNKNu7g7ZDuaO/PLi8ZafJzs07P1SkVPRU+lQ27tLdtWHX+G7R7ht7vPY07NXbW7z3/T7JvttVAVVN1WbVZftJ+7P3P66Jqun4lvttXa1ObXHtxwPSA/0HIw6217nU1R3SPVRSj9Yr60cOxx++/p3vdy0NNg1VjZzG4iNwRHnk6fcJ3/ceDTradox7rOEH0x92HWcdL2pCmvKaRptTmvtbYlu6T8w+0dbq3nr8R9sfD5w0PFl5SvNUyWna6YLTk2fyz4ydlZ19fi753GDborZ752PO32oPb++6EHTh0kX/i+c7vDvOXPK4dPKy2+UTV7hXmq86X23qdOo8/pPTT8e7nLuarrlca7nuer21e2b36RueN87d9L158Rb/1tWeOT3dvfN6b/fF9/XfFt1+cif9zsu72Xcn7q28T7xf9EDtQdlD3YfVP1v+3Njv3H9qwHeg89HcR/cGhYPP/pH1jw9DBY+Zj8uGDYbrnjg+OTniP3L96fynQ89kzyaeF/6i/suuFxYvfvjV69fO0ZjRoZfyl5O/bXyl/erA6xmv28bCxh6+yXgzMV70VvvtwXfcdx3vo98PT+R8IH8o/2j5sfVT0Kf7kxmTk/8EA5jz/GMzLdsAAAAgY0hSTQAAeiUAAICDAAD5/wAAgOkAAHUwAADqYAAAOpgAABdvkl/FRgAAADJJREFUeNpEx7ENgDAAAzArK0JA6f8X9oewlcWStU1wBGdwB08wgjeYm79jc2nbYH0DAC/+CORJxO5fAAAAAElFTkSuQmCC)"}),AFRAME.utils.RayCurve=function(t,i){this.geometry=new THREE.BufferGeometry,this.vertices=new Float32Array(3*t*6),this.uvs=new Float32Array(2*t*6),this.width=i,this.geometry.setAttribute("position",new THREE.BufferAttribute(this.vertices,3).setUsage(THREE.DynamicDrawUsage)),this.material=new THREE.MeshBasicMaterial({side:THREE.DoubleSide,color:16711680}),this.mesh=new THREE.Mesh(this.geometry,this.material),this.mesh.frustumCulled=!1,this.mesh.vertices=this.vertices,this.direction=new THREE.Vector3,this.numPoints=t},AFRAME.utils.RayCurve.prototype={setDirection:function(t){const i=new THREE.Vector3(0,1,0);this.direction.copy(t).cross(i).normalize().multiplyScalar(this.width/2)},setWidth:function(t){this.width=t},setPoint:function(){const t=new THREE.Vector3,i=new THREE.Vector3,e=new THREE.Vector3,n=new THREE.Vector3;return function(s,o,r){t.copy(o).add(this.direction),i.copy(o).sub(this.direction),e.copy(r).add(this.direction),n.copy(r).sub(this.direction);let a=18*s;this.vertices[a++]=t.x,this.vertices[a++]=t.y,this.vertices[a++]=t.z,this.vertices[a++]=i.x,this.vertices[a++]=i.y,this.vertices[a++]=i.z,this.vertices[a++]=e.x,this.vertices[a++]=e.y,this.vertices[a++]=e.z,this.vertices[a++]=e.x,this.vertices[a++]=e.y,this.vertices[a++]=e.z,this.vertices[a++]=i.x,this.vertices[a++]=i.y,this.vertices[a++]=i.z,this.vertices[a++]=n.x,this.vertices[a++]=n.y,this.vertices[a++]=n.z,this.geometry.attributes.position.needsUpdate=!0}}()}})();
//# sourceMappingURL=aframe-blink-controls.min.js.map