functionGameLib(){}if("undefined"==typeofGameLib.D3&&(GameLib.D3=function(){}),"undefined"==typeofQ){if("undefined"==typeofrequire)throwconsole.warn("You need the Q promise library for the GameLib.D3"),newError("You need the Q promise library for the GameLib.D3");varQ=require("q")}GameLib.D3.BoneWeight=function(e,t){this.boneIndex=e,this.weight=t},GameLib.D3.Bone=function(e,t,i,n,s,o,a,r,h,c){this.id=e,this.name=i,this.boneId=t,"undefined"==typeofn&&(n=[]),this.childBoneIds=n,"undefined"==typeofs&&(s=null),this.parentBoneId=s,"undefined"==typeofo&&(o=newGameLib.D3.Vector4),this.quaternion=o,"undefined"==typeofa&&(a=newGameLib.D3.Vector3(0,0,0)),this.position=a,"undefined"==typeofr&&(r=newGameLib.D3.Vector3(0,0,0)),this.rotation=r,"undefined"==typeofh&&(h=newGameLib.D3.Vector3(1,1,1)),this.scale=h,"undefined"==typeofc&&(c=newGameLib.D3.Vector3(0,1,0)),this.up=c},GameLib.D3.Broadphase=function(e,t,i,n){this.id=e,"undefined"==typeoft&&(t="broadphase-"+i),this.name=t,"undefined"==typeofi&&(i=GameLib.D3.Broadphase.BROADPHASE_TYPE_NAIVE),this.broadphaseType=i,this.engine=n,this.engine.isNotCannonThrow(),this.instance=this.createInstance()},GameLib.D3.Broadphase.prototype.createInstance=function(){vare=null;if(this.broadphaseType==GameLib.D3.Broadphase.BROADPHASE_TYPE_NAIVE)e=newthis.engine.instance.NaiveBroadphase;elseif(this.broadphaseType==GameLib.D3.Broadphase.BROADPHASE_TYPE_GRID)e=newthis.engine.instance.GridBroadphase;else{if(this.broadphaseType!=GameLib.D3.Broadphase.BROADPHASE_TYPE_SAP)throwconsole.warn("Unsupported broadphase type: "+this.broadphaseType),newError("Unsupported broadphase type: "+this.broadphaseType);e=newthis.engine.instance.SAPBroadphase}returne},GameLib.D3.Broadphase.BROADPHASE_TYPE_NAIVE=1,GameLib.D3.Broadphase.BROADPHASE_TYPE_GRID=2,GameLib.D3.Broadphase.BROADPHASE_TYPE_SAP=3,GameLib.D3.Color=function(e,t,i,n){this.r=e,this.g=t,this.b=i,this.a=n},GameLib.D3.ComponentColorFlash=function(e){this.componentId=e||GameLib.D3.Tools.RandomId(),this.parentEntity=null,GameLib.D3.Utils.Extend(GameLib.D3.ComponentColorFlash,GameLib.D3.ComponentInterface)},GameLib.D3.ComponentColorFlash.prototype.onUpdate=function(e,t){this.parentEntity.mesh.material.color=newTHREE.Color(Math.random(),Math.random(),Math.random())},GameLib.D3.ComponentColorFlash.prototype.onSetParentEntity=function(e,t){t.mesh.material=newTHREE.MeshBasicMaterial},GameLib.D3.ComponentInterface=function(e){this.componentId=e||GameLib.D3.Tools.RandomId(),this.parentEntity=null},GameLib.D3.ComponentInterface.prototype.setParentEntity=function(e,t){this.parentEntity=t,this.onSetParentEntity(e,t)},GameLib.D3.ComponentInterface.prototype.update=function(e,t){this.onUpdate(e,t)},GameLib.D3.ComponentInterface.prototype.lateUpdate=function(e,t){this.onLateUpdate(e,t)},GameLib.D3.ComponentInterface.prototype.register=function(e){this.onRegistered(e)},GameLib.D3.ComponentInterface.prototype.onUpdate=function(e,t){},GameLib.D3.ComponentInterface.prototype.onLateUpdate=function(e,t){},GameLib.D3.ComponentInterface.prototype.onRegistered=function(e){},GameLib.D3.ComponentInterface.prototype.onSetParentEntity=function(e,t){},GameLib.D3.Engine=function(e,t){this.engineType=e,this.instance=t},GameLib.D3.Engine.prototype.isCannon=function(){returnthis.engineType==GameLib.D3.Engine.ENGINE_TYPE_CANNON},GameLib.D3.Engine.prototype.isNotCannonThrow=function(){if(this.engineType!=GameLib.D3.Engine.ENGINE_TYPE_CANNON)throwconsole.warn("Only CANNON supported for this function"),newError("Only CANNON supported for this function")},GameLib.D3.Engine.prototype.isAmmo=function(){returnthis.engineType==GameLib.D3.Engine.ENGINE_TYPE_AMMO},GameLib.D3.Engine.prototype.isGoblin=function(){returnthis.engineType==GameLib.D3.Engine.ENGINE_TYPE_GOBLIN},GameLib.D3.Engine.ENGINE_TYPE_CANNON=1,GameLib.D3.Engine.ENGINE_TYPE_AMMO=2,GameLib.D3.Engine.ENGINE_TYPE_GOBLIN=3,GameLib.D3.Entity=function(e,t){this.meshId=e,"undefined"==typeoft&&(t=[]),this.componentIds=t,this.parentScene=null,this.mesh=null},GameLib.D3.Entity.prototype.update=function(e){for(