use of com.bulletphysics.util.Stack in project bdx by GoranM.
the class ConvexInternalShape method getAabbSlow.
@Override
public void getAabbSlow(Transform trans, Vector3f minAabb, Vector3f maxAabb) {
Stack stack = Stack.enter();
float margin = getMargin();
Vector3f vec = stack.allocVector3f();
Vector3f tmp1 = stack.allocVector3f();
Vector3f tmp2 = stack.allocVector3f();
for (int i = 0; i < 3; i++) {
vec.set(0f, 0f, 0f);
VectorUtil.setCoord(vec, i, 1f);
MatrixUtil.transposeTransform(tmp1, vec, trans.basis);
localGetSupportingVertex(tmp1, tmp2);
trans.transform(tmp2);
VectorUtil.setCoord(maxAabb, i, VectorUtil.getCoord(tmp2, i) + margin);
VectorUtil.setCoord(vec, i, -1f);
MatrixUtil.transposeTransform(tmp1, vec, trans.basis);
localGetSupportingVertex(tmp1, tmp2);
trans.transform(tmp2);
VectorUtil.setCoord(minAabb, i, VectorUtil.getCoord(tmp2, i) - margin);
}
stack.leave();
}
use of com.bulletphysics.util.Stack in project bdx by GoranM.
the class CylinderShape method batchedUnitVectorGetSupportingVertexWithoutMargin.
@Override
public void batchedUnitVectorGetSupportingVertexWithoutMargin(Vector3f[] vectors, Vector3f[] supportVerticesOut, int numVectors) {
Stack stack = Stack.enter();
for (int i = 0; i < numVectors; i++) {
cylinderLocalSupportY(getHalfExtentsWithoutMargin(stack.allocVector3f()), vectors[i], supportVerticesOut[i]);
}
stack.leave();
}
use of com.bulletphysics.util.Stack in project bdx by GoranM.
the class CylinderShapeX method localGetSupportingVertexWithoutMargin.
@Override
public Vector3f localGetSupportingVertexWithoutMargin(Vector3f vec, Vector3f out) {
Stack stack = Stack.enter();
Vector3f result = cylinderLocalSupportX(getHalfExtentsWithoutMargin(stack.allocVector3f()), vec, out);
stack.leave();
return result;
}
use of com.bulletphysics.util.Stack in project bdx by GoranM.
the class CylinderShapeZ method batchedUnitVectorGetSupportingVertexWithoutMargin.
@Override
public void batchedUnitVectorGetSupportingVertexWithoutMargin(Vector3f[] vectors, Vector3f[] supportVerticesOut, int numVectors) {
Stack stack = Stack.enter();
for (int i = 0; i < numVectors; i++) {
cylinderLocalSupportZ(getHalfExtentsWithoutMargin(stack.allocVector3f()), vectors[i], supportVerticesOut[i]);
}
stack.leave();
}
use of com.bulletphysics.util.Stack in project bdx by GoranM.
the class OptimizedBvh method reportRayOverlappingNodex.
public void reportRayOverlappingNodex(NodeOverlapCallback nodeCallback, Vector3f raySource, Vector3f rayTarget) {
boolean fast_path = useQuantization && traversalMode == TraversalMode.STACKLESS;
Stack stack = Stack.enter();
if (fast_path) {
Vector3f tmp = stack.allocVector3f();
tmp.set(0f, 0f, 0f);
walkStacklessQuantizedTreeAgainstRay(nodeCallback, raySource, rayTarget, tmp, tmp, 0, curNodeIndex);
} else {
/* Otherwise fallback to AABB overlap test */
Vector3f aabbMin = stack.alloc(raySource);
Vector3f aabbMax = stack.alloc(raySource);
VectorUtil.setMin(aabbMin, rayTarget);
VectorUtil.setMax(aabbMax, rayTarget);
reportAabbOverlappingNodex(nodeCallback, aabbMin, aabbMax);
}
stack.leave();
}
Aggregations