Ejemplo n.º 1
0
/*     */   public void setAabb(BroadphaseProxy arg1, Vector3f arg2, Vector3f arg3, Dispatcher arg4)
/*     */   {
/* 201 */     .Stack localStack = .Stack.get();
/*     */     try { localStack.push$javax$vecmath$Vector3f(); DbvtProxy proxy = (DbvtProxy)absproxy;
/* 202 */       DbvtAabbMm aabb = DbvtAabbMm.FromMM(aabbMin, aabbMax, new DbvtAabbMm());
/* 203 */       if (proxy.stage == 2)
/*     */       {
/* 205 */         this.sets[1].remove(proxy.leaf);
/* 206 */         proxy.leaf = this.sets[0].insert(aabb, proxy);
/*     */       }
/* 210 */       else if (DbvtAabbMm.Intersect(proxy.leaf.volume, aabb)) {
/* 211 */         Vector3f delta = localStack.get$javax$vecmath$Vector3f();
/* 212 */         delta.add(aabbMin, aabbMax);
/* 213 */         delta.scale(0.5F);
/* 214 */         delta.sub(proxy.aabb.Center(localStack.get$javax$vecmath$Vector3f()));
/*     */ 
/* 216 */         delta.scale(this.predictedframes);
/* 217 */         this.sets[0].update(proxy.leaf, aabb, delta, 0.05F);
/*     */       }
/*     */       else
/*     */       {
/* 224 */         this.sets[0].update(proxy.leaf, aabb); } 
/*     */ this.stageRoots[proxy.stage] = listremove(proxy, this.stageRoots[proxy.stage]);
/* 229 */       proxy.aabb.set(aabb);
/* 230 */       proxy.stage = this.stageCurrent;
/* 231 */       this.stageRoots[this.stageCurrent] = listappend(proxy, this.stageRoots[this.stageCurrent]);
/*     */       return; } finally { localStack.pop$javax$vecmath$Vector3f(); } throw finally;
/*     */   }
Ejemplo n.º 2
0
/*     */   public BroadphaseProxy createProxy(Vector3f aabbMin, Vector3f aabbMax, BroadphaseNativeType shapeType, Object userPtr, short collisionFilterGroup, short collisionFilterMask, Dispatcher dispatcher, Object multiSapProxy) {
/* 178 */     DbvtProxy proxy = new DbvtProxy(userPtr, collisionFilterGroup, collisionFilterMask);
/* 179 */     DbvtAabbMm.FromMM(aabbMin, aabbMax, proxy.aabb);
/* 180 */     proxy.leaf = this.sets[0].insert(proxy.aabb, proxy);
/* 181 */     proxy.stage = this.stageCurrent;
/* 182 */     proxy.uniqueId = (++this.gid);
/* 183 */     this.stageRoots[this.stageCurrent] = listappend(proxy, this.stageRoots[this.stageCurrent]);
/* 184 */     return proxy;
/*     */   }
Ejemplo n.º 3
0
/*     */   public void collide(Dispatcher dispatcher)
/*     */   {
/*  96 */     this.sets[0].optimizeIncremental(1 + this.sets[0].leaves * this.dupdates / 100);
/*  97 */     this.sets[1].optimizeIncremental(1 + this.sets[1].leaves * this.fupdates / 100);
/*     */ 
/* 100 */     this.stageCurrent = ((this.stageCurrent + 1) % 2);
/* 101 */     DbvtProxy current = this.stageRoots[this.stageCurrent];
/* 102 */     if (current != null) {
/* 103 */       DbvtTreeCollider collider = new DbvtTreeCollider(this);
/*     */       do {
/* 105 */         DbvtProxy next = current.links[1];
/* 106 */         this.stageRoots[current.stage] = listremove(current, this.stageRoots[current.stage]);
/* 107 */         this.stageRoots[2] = listappend(current, this.stageRoots[2]);
/* 108 */         Dbvt.collideTT(this.sets[1].root, current.leaf, collider);
/* 109 */         this.sets[0].remove(current.leaf);
/* 110 */         current.leaf = this.sets[1].insert(current.aabb, current);
/* 111 */         current.stage = 2;
/* 112 */         current = next;
/* 113 */       }while (current != null);
/*     */     }
/*     */ 
/* 118 */     DbvtTreeCollider collider = new DbvtTreeCollider(this);
/*     */ 
/* 121 */     Dbvt.collideTT(this.sets[0].root, this.sets[1].root, collider);
/*     */ 
/* 125 */     Dbvt.collideTT(this.sets[0].root, this.sets[0].root, collider);
/*     */ 
/* 132 */     ObjectArrayList pairs = this.paircache.getOverlappingPairArray();
/* 133 */     if (pairs.size() > 0) {
/* 134 */       int i = 0; for (int ni = pairs.size(); i < ni; i++) {
/* 135 */         BroadphasePair p = (BroadphasePair)pairs.getQuick(i);
/* 136 */         DbvtProxy pa = (DbvtProxy)p.pProxy0;
/* 137 */         DbvtProxy pb = (DbvtProxy)p.pProxy1;
/* 138 */         if (!DbvtAabbMm.Intersect(pa.aabb, pb.aabb))
/*     */         {
/* 140 */           if (pa.hashCode() > pb.hashCode()) {
/* 141 */             DbvtProxy tmp = pa;
/* 142 */             pa = pb;
/* 143 */             pb = tmp;
/*     */           }
/* 145 */           this.paircache.removeOverlappingPair(pa, pb, dispatcher);
/* 146 */           ni--;
/* 147 */           i--;
/*     */         }
/*     */       }
/*     */     }
/*     */ 
/* 152 */     this.pid += 1;
/*     */   }