Search in sources :

Example 46 with Stack

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();
}
Also used : Vector3f(javax.vecmath.Vector3f) Stack(com.bulletphysics.util.Stack)

Example 47 with Stack

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();
}
Also used : Stack(com.bulletphysics.util.Stack)

Example 48 with Stack

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;
}
Also used : Vector3f(javax.vecmath.Vector3f) Stack(com.bulletphysics.util.Stack)

Example 49 with Stack

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();
}
Also used : Stack(com.bulletphysics.util.Stack)

Example 50 with Stack

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();
}
Also used : Vector3f(javax.vecmath.Vector3f) Stack(com.bulletphysics.util.Stack)

Aggregations

Stack (com.bulletphysics.util.Stack)252 Vector3f (javax.vecmath.Vector3f)197 Transform (com.bulletphysics.linearmath.Transform)65 Matrix3f (javax.vecmath.Matrix3f)23 ManifoldPoint (com.bulletphysics.collision.narrowphase.ManifoldPoint)15 AABB (com.bulletphysics.extras.gimpact.BoxCollision.AABB)15 StaticAlloc (com.bulletphysics.util.StaticAlloc)12 CollisionObject (com.bulletphysics.collision.dispatch.CollisionObject)10 CollisionShape (com.bulletphysics.collision.shapes.CollisionShape)10 TypedConstraint (com.bulletphysics.dynamics.constraintsolver.TypedConstraint)10 Vector4f (javax.vecmath.Vector4f)8 CompoundShape (com.bulletphysics.collision.shapes.CompoundShape)6 ConcaveShape (com.bulletphysics.collision.shapes.ConcaveShape)5 SphereShape (com.bulletphysics.collision.shapes.SphereShape)5 RigidBody (com.bulletphysics.dynamics.RigidBody)5 Quat4f (javax.vecmath.Quat4f)5 ConvexShape (com.bulletphysics.collision.shapes.ConvexShape)4 ObjectArrayList (com.bulletphysics.util.ObjectArrayList)4 PersistentManifold (com.bulletphysics.collision.narrowphase.PersistentManifold)3 VoronoiSimplexSolver (com.bulletphysics.collision.narrowphase.VoronoiSimplexSolver)3