use of com.bulletphysics.extras.gimpact.BoxCollision.AABB in project bdx by GoranM.
the class GImpactMeshShape method calcLocalAABB.
@Override
protected void calcLocalAABB() {
Stack stack = Stack.enter();
AABB tmpAABB = stack.allocAABB();
localAABB.invalidate();
int i = mesh_parts.size();
while ((i--) != 0) {
mesh_parts.getQuick(i).updateBound();
localAABB.merge(mesh_parts.getQuick(i).getLocalBox(tmpAABB));
}
stack.leave();
}
use of com.bulletphysics.extras.gimpact.BoxCollision.AABB in project bdx by GoranM.
the class Stack method alloc.
public AABB alloc(AABB box) {
AABB aabb = allocAABB();
aabb.set(box);
return aabb;
}
use of com.bulletphysics.extras.gimpact.BoxCollision.AABB in project bdx by GoranM.
the class GImpactBvh method boxQueryTrans.
/**
* Returns the indices of the primitives in the primitive_manager field.
*/
public boolean boxQueryTrans(AABB box, Transform transform, IntArrayList collided_results) {
Stack stack = Stack.enter();
AABB transbox = stack.alloc(box);
transbox.appy_transform(transform);
boolean result = boxQuery(transbox, collided_results);
stack.leave();
return result;
}
use of com.bulletphysics.extras.gimpact.BoxCollision.AABB in project bdx by GoranM.
the class GImpactBvh method boxQuery.
/**
* Returns the indices of the primitives in the primitive_manager field.
*/
public boolean boxQuery(AABB box, IntArrayList collided_results) {
int curIndex = 0;
int numNodes = getNodeCount();
Stack stack = Stack.enter();
AABB bound = stack.allocAABB();
while (curIndex < numNodes) {
getNodeBound(curIndex, bound);
// catch bugs in tree data
boolean aabbOverlap = bound.has_collision(box);
boolean isleafnode = isLeafNode(curIndex);
if (isleafnode && aabbOverlap) {
collided_results.add(getNodeData(curIndex));
}
if (aabbOverlap || isleafnode) {
// next subnode
curIndex++;
} else {
// skip node
curIndex += getEscapeNodeIndex(curIndex);
}
}
if (collided_results.size() > 0) {
stack.leave();
return true;
}
stack.leave();
return false;
}
use of com.bulletphysics.extras.gimpact.BoxCollision.AABB in project bdx by GoranM.
the class GImpactBvh method rayQuery.
/**
* Returns the indices of the primitives in the primitive_manager field.
*/
public boolean rayQuery(Vector3f ray_dir, Vector3f ray_origin, IntArrayList collided_results) {
int curIndex = 0;
int numNodes = getNodeCount();
Stack stack = Stack.enter();
AABB bound = stack.allocAABB();
while (curIndex < numNodes) {
getNodeBound(curIndex, bound);
// catch bugs in tree data
boolean aabbOverlap = bound.collide_ray(ray_origin, ray_dir);
boolean isleafnode = isLeafNode(curIndex);
if (isleafnode && aabbOverlap) {
collided_results.add(getNodeData(curIndex));
}
if (aabbOverlap || isleafnode) {
// next subnode
curIndex++;
} else {
// skip node
curIndex += getEscapeNodeIndex(curIndex);
}
}
if (collided_results.size() > 0) {
stack.leave();
return true;
}
stack.leave();
return false;
}
Aggregations