本文整理汇总了Java中com.bulletphysics.collision.narrowphase.PersistentManifold类的典型用法代码示例。如果您正苦于以下问题:Java PersistentManifold类的具体用法?Java PersistentManifold怎么用?Java PersistentManifold使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
PersistentManifold类属于com.bulletphysics.collision.narrowphase包,在下文中一共展示了PersistentManifold类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: releaseManifold
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
@Override
public void releaseManifold(PersistentManifold manifold) {
//gNumManifold--;
//printf("releaseManifold: gNumManifold %d\n",gNumManifold);
clearManifold(manifold);
// TODO: optimize
int findIndex = manifold.index1a;
assert (findIndex < manifoldsPtr.size());
Collections.swap(manifoldsPtr, findIndex, manifoldsPtr.size()-1);
manifoldsPtr.getQuick(findIndex).index1a = findIndex;
manifoldsPtr.removeQuick(manifoldsPtr.size()-1);
manifoldsPool.release(manifold);
/*
manifold->~btPersistentManifold();
if (m_persistentManifoldPoolAllocator->validPtr(manifold))
{
m_persistentManifoldPoolAllocator->freeMemory(manifold);
} else
{
btAlignedFree(manifold);
}
*/
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:27,代码来源:CollisionDispatcher.java
示例2: findAlgorithm
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
@Override
public CollisionAlgorithm findAlgorithm(CollisionObject body0, CollisionObject body1, PersistentManifold sharedManifold) {
CollisionAlgorithmConstructionInfo ci = tmpCI;
ci.dispatcher1 = this;
ci.manifold = sharedManifold;
CollisionAlgorithmCreateFunc createFunc = doubleDispatch[body0.getCollisionShape().getShapeType().ordinal()][body1.getCollisionShape().getShapeType().ordinal()];
CollisionAlgorithm algo = createFunc.createCollisionAlgorithm(ci, body0, body1);
if (algo instanceof EmptyAlgorithm) {
System.out.println(" NO COLLISION ALGO: " + body0.getUserPointer() + " " + body1.getUserPointer());
System.out.println(" NO COLLISION ALGO: " + body0.getCollisionShape().getShapeType() + " " + body1.getCollisionShape().getShapeType());
} else {
// System.out.println("COLLISION ALGO: " + body0.getUserPointer() + " " + body1.getUserPointer());
// System.out.println("COLLISION ALGO: " + body0.getCollisionShape().getShapeType() + " " + body1.getCollisionShape().getShapeType());
// System.out.println("algo = " + algo);
}
algo.internalSetCreateFunc(createFunc);
return algo;
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:20,代码来源:CollisionDispatcher.java
示例3: releaseManifold
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
@Override
public void releaseManifold(PersistentManifold manifold) {
gNumManifold--;
//printf("releaseManifold: gNumManifold %d\n",gNumManifold);
clearManifold(manifold);
// TODO: optimize
int findIndex = manifold.index1a;
assert (findIndex < manifoldsPtr.size());
Collections.swap(manifoldsPtr, findIndex, manifoldsPtr.size()-1);
manifoldsPtr.get(findIndex).index1a = findIndex;
manifoldsPtr.remove(manifoldsPtr.size()-1);
manifoldsPool.release(manifold);
/*
manifold->~btPersistentManifold();
if (m_persistentManifoldPoolAllocator->validPtr(manifold))
{
m_persistentManifoldPoolAllocator->freeMemory(manifold);
} else
{
btAlignedFree(manifold);
}
*/
}
开发者ID:unktomi,项目名称:form-follows-function,代码行数:27,代码来源:CollisionDispatcher.java
示例4: update
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
public static void update() {
world.stepSimulation(Time.getDeltaSeconds());
for (PersistentManifold pm : world.getDispatcher().getInternalManifoldPointer()) {
GameObject objectA = (GameObject)((CollisionObject)pm.getBody0()).getUserPointer();
GameObject objectB = (GameObject)((CollisionObject)pm.getBody1()).getUserPointer();
if (objectA != null && objectB != null) {
for (int contactId = 0; contactId < pm.getNumContacts(); contactId++) {
ManifoldPoint mp = pm.getContactPoint(contactId);
if (mp.getDistance() < 0.0f) {
objectA.onCollision(mp,objectB);
}
}
}
}
}
开发者ID:Axodoss,项目名称:Wicken,代码行数:18,代码来源:PhysicsSystem.java
示例5: init
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
public void init (PersistentManifold mf, CollisionAlgorithmConstructionInfo ci, CollisionObject col0, CollisionObject col1,
boolean isSwapped) {
super.init(ci);
this.ownManifold = false;
this.manifoldPtr = mf;
this.isSwapped = isSwapped;
CollisionObject convexObj = isSwapped ? col1 : col0;
CollisionObject planeObj = isSwapped ? col0 : col1;
if (manifoldPtr == null && dispatcher.needsCollision(convexObj, planeObj)) {
manifoldPtr = dispatcher.getNewManifold(convexObj, planeObj);
ownManifold = true;
}
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:16,代码来源:ConvexPlaneCollisionAlgorithm.java
示例6: init
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
public void init (PersistentManifold mf, CollisionAlgorithmConstructionInfo ci, CollisionObject body0, CollisionObject body1,
SimplexSolverInterface simplexSolver, ConvexPenetrationDepthSolver pdSolver) {
super.init(ci);
gjkPairDetector.init(null, null, simplexSolver, pdSolver);
this.manifoldPtr = mf;
this.ownManifold = false;
this.lowLevelOfDetail = false;
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:9,代码来源:ConvexConvexAlgorithm.java
示例7: getAllContactManifolds
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
@Override
public void getAllContactManifolds (ObjectArrayList<PersistentManifold> manifoldArray) {
// should we use ownManifold to avoid adding duplicates?
if (manifoldPtr != null && ownManifold) {
manifoldArray.add(manifoldPtr);
}
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:8,代码来源:ConvexConvexAlgorithm.java
示例8: getIslandId
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
private static int getIslandId(PersistentManifold lhs) {
int islandId;
CollisionObject rcolObj0 = (CollisionObject) lhs.getBody0();
CollisionObject rcolObj1 = (CollisionObject) lhs.getBody1();
islandId = rcolObj0.getIslandTag() >= 0? rcolObj0.getIslandTag() : rcolObj1.getIslandTag();
return islandId;
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:8,代码来源:SimulationIslandManager.java
示例9: init
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
public void init (PersistentManifold mf, CollisionAlgorithmConstructionInfo ci, CollisionObject col0, CollisionObject col1) {
super.init(ci);
manifoldPtr = mf;
if (manifoldPtr == null) {
manifoldPtr = dispatcher.getNewManifold(col0, col1);
ownManifold = true;
}
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:10,代码来源:SphereSphereCollisionAlgorithm.java
示例10: findAlgorithm
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
@Override
public CollisionAlgorithm findAlgorithm(CollisionObject body0, CollisionObject body1, PersistentManifold sharedManifold) {
CollisionAlgorithmConstructionInfo ci = tmpCI;
ci.dispatcher1 = this;
ci.manifold = sharedManifold;
CollisionAlgorithmCreateFunc createFunc = doubleDispatch[body0.getCollisionShape().getShapeType().ordinal()][body1.getCollisionShape().getShapeType().ordinal()];
CollisionAlgorithm algo = createFunc.createCollisionAlgorithm(ci, body0, body1);
algo.internalSetCreateFunc(createFunc);
return algo;
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:12,代码来源:CollisionDispatcher.java
示例11: getNewManifold
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
@Override
public PersistentManifold getNewManifold(Object b0, Object b1) {
//gNumManifold++;
//btAssert(gNumManifold < 65535);
CollisionObject body0 = (CollisionObject)b0;
CollisionObject body1 = (CollisionObject)b1;
/*
void* mem = 0;
if (m_persistentManifoldPoolAllocator->getFreeCount())
{
mem = m_persistentManifoldPoolAllocator->allocate(sizeof(btPersistentManifold));
} else
{
mem = btAlignedAlloc(sizeof(btPersistentManifold),16);
}
btPersistentManifold* manifold = new(mem) btPersistentManifold (body0,body1,0);
manifold->m_index1a = m_manifoldsPtr.size();
m_manifoldsPtr.push_back(manifold);
*/
PersistentManifold manifold = manifoldsPool.get();
manifold.init(body0,body1,0);
manifold.index1a = manifoldsPtr.size();
manifoldsPtr.add(manifold);
return manifold;
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:34,代码来源:CollisionDispatcher.java
示例12: processIsland
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
public void processIsland (ObjectArrayList<CollisionObject> bodies, int numBodies,
ObjectArrayList<PersistentManifold> manifolds, int manifolds_offset, int numManifolds, int islandId) {
if (islandId < 0) {
// we don't split islands, so all constraints/contact manifolds/bodies are passed into the solver regardless the
// island id
solver.solveGroup(bodies, numBodies, manifolds, manifolds_offset, numManifolds, sortedConstraints, 0, numConstraints,
solverInfo, debugDrawer/* ,m_stackAlloc */, dispatcher);
} else {
// also add all non-contact constraints/joints for this island
// ObjectArrayList<TypedConstraint> startConstraint = null;
int startConstraint_idx = -1;
int numCurConstraints = 0;
int i;
// find the first constraint for this island
for (i = 0; i < numConstraints; i++) {
if (getConstraintIslandId(sortedConstraints.getQuick(i)) == islandId) {
// startConstraint = &m_sortedConstraints[i];
// startConstraint = sortedConstraints.subList(i, sortedConstraints.size());
startConstraint_idx = i;
break;
}
}
// count the number of constraints in this island
for (; i < numConstraints; i++) {
if (getConstraintIslandId(sortedConstraints.getQuick(i)) == islandId) {
numCurConstraints++;
}
}
// only call solveGroup if there is some work: avoid virtual function call, its overhead can be excessive
if ((numManifolds + numCurConstraints) > 0) {
solver.solveGroup(bodies, numBodies, manifolds, manifolds_offset, numManifolds, sortedConstraints,
startConstraint_idx, numCurConstraints, solverInfo, debugDrawer/* ,m_stackAlloc */, dispatcher);
}
}
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:38,代码来源:DiscreteDynamicsWorld.java
示例13: needsCollision
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
@Override
public boolean needsCollision (BroadphaseProxy proxy0) {
// don't collide with itself
if (proxy0.clientObject == me) {
return false;
}
// don't do CCD when the collision filters are not matching
if (!super.needsCollision(proxy0)) {
return false;
}
CollisionObject otherObj = (CollisionObject)proxy0.clientObject;
// call needsResponse, see http://code.google.com/p/bullet/issues/detail?id=179
if (dispatcher.needsResponse(me, otherObj)) {
// don't do CCD when there are already contact points (touching contact/penetration)
ObjectArrayList<PersistentManifold> manifoldArray = new ObjectArrayList<PersistentManifold>();
BroadphasePair collisionPair = pairCache.findPair(me.getBroadphaseHandle(), proxy0);
if (collisionPair != null) {
if (collisionPair.algorithm != null) {
// manifoldArray.resize(0);
collisionPair.algorithm.getAllContactManifolds(manifoldArray);
for (int j = 0; j < manifoldArray.size(); j++) {
PersistentManifold manifold = manifoldArray.getQuick(j);
if (manifold.getNumContacts() > 0) {
return false;
}
}
}
}
}
return true;
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:35,代码来源:DiscreteDynamicsWorld.java
示例14: stepSimulation
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
/**
* maxSubSteps/fixedTimeStep for interpolation is currently ignored for SimpleDynamicsWorld, use DiscreteDynamicsWorld instead.
*/
@Override
public int stepSimulation(float timeStep, int maxSubSteps, float fixedTimeStep) {
// apply gravity, predict motion
predictUnconstraintMotion(timeStep);
DispatcherInfo dispatchInfo = getDispatchInfo();
dispatchInfo.timeStep = timeStep;
dispatchInfo.stepCount = 0;
dispatchInfo.debugDraw = getDebugDrawer();
// perform collision detection
performDiscreteCollisionDetection();
// solve contact constraints
int numManifolds = dispatcher1.getNumManifolds();
if (numManifolds != 0)
{
ObjectArrayList<PersistentManifold> manifoldPtr = ((CollisionDispatcher)dispatcher1).getInternalManifoldPointer();
ContactSolverInfo infoGlobal = new ContactSolverInfo();
infoGlobal.timeStep = timeStep;
constraintSolver.prepareSolve(0,numManifolds);
constraintSolver.solveGroup(null,0,manifoldPtr, 0, numManifolds, null,0,0,infoGlobal,debugDrawer/*, m_stackAlloc*/,dispatcher1);
constraintSolver.allSolved(infoGlobal,debugDrawer/*, m_stackAlloc*/);
}
// integrate transforms
integrateTransforms(timeStep);
updateAabbs();
synchronizeMotionStates();
clearForces();
return 1;
}
开发者ID:vbousquet,项目名称:libgdx-jbullet,代码行数:41,代码来源:SimpleDynamicsWorld.java
示例15: init
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
public void init(PersistentManifold mf, CollisionAlgorithmConstructionInfo ci, CollisionObject col0, CollisionObject col1, boolean isSwapped) {
super.init(ci);
this.ownManifold = false;
this.manifoldPtr = mf;
this.isSwapped = isSwapped;
CollisionObject convexObj = isSwapped ? col1 : col0;
CollisionObject planeObj = isSwapped ? col0 : col1;
if (manifoldPtr == null && dispatcher.needsCollision(convexObj, planeObj)) {
manifoldPtr = dispatcher.getNewManifold(convexObj, planeObj);
ownManifold = true;
}
}
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:15,代码来源:ConvexPlaneCollisionAlgorithm.java
示例16: init
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
public void init(PersistentManifold mf, CollisionAlgorithmConstructionInfo ci, CollisionObject body0, CollisionObject body1, SimplexSolverInterface simplexSolver, ConvexPenetrationDepthSolver pdSolver) {
super.init(ci);
gjkPairDetector.init(null, null, simplexSolver, pdSolver);
this.manifoldPtr = mf;
this.ownManifold = false;
this.lowLevelOfDetail = false;
}
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:8,代码来源:ConvexConvexAlgorithm.java
示例17: getAllContactManifolds
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
@Override
public void getAllContactManifolds(ObjectArrayList<PersistentManifold> manifoldArray) {
// should we use ownManifold to avoid adding duplicates?
if (manifoldPtr != null && ownManifold) {
manifoldArray.add(manifoldPtr);
}
}
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:8,代码来源:ConvexConvexAlgorithm.java
示例18: init
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
public void init(PersistentManifold mf, CollisionAlgorithmConstructionInfo ci, CollisionObject col0, CollisionObject col1) {
super.init(ci);
manifoldPtr = mf;
if (manifoldPtr == null) {
manifoldPtr = dispatcher.getNewManifold(col0, col1);
ownManifold = true;
}
}
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:10,代码来源:SphereSphereCollisionAlgorithm.java
示例19: processIsland
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
public void processIsland(ObjectArrayList<CollisionObject> bodies, int numBodies, ObjectArrayList<PersistentManifold> manifolds, int manifolds_offset, int numManifolds, int islandId) {
if (islandId < 0) {
// we don't split islands, so all constraints/contact manifolds/bodies are passed into the solver regardless the island id
solver.solveGroup(bodies, numBodies, manifolds, manifolds_offset, numManifolds, sortedConstraints, 0, numConstraints, solverInfo, debugDrawer/*,m_stackAlloc*/, dispatcher);
}
else {
// also add all non-contact constraints/joints for this island
//ObjectArrayList<TypedConstraint> startConstraint = null;
int startConstraint_idx = -1;
int numCurConstraints = 0;
int i;
// find the first constraint for this island
for (i = 0; i < numConstraints; i++) {
if (getConstraintIslandId(sortedConstraints.getQuick(i)) == islandId) {
//startConstraint = &m_sortedConstraints[i];
//startConstraint = sortedConstraints.subList(i, sortedConstraints.size());
startConstraint_idx = i;
break;
}
}
// count the number of constraints in this island
for (; i < numConstraints; i++) {
if (getConstraintIslandId(sortedConstraints.getQuick(i)) == islandId) {
numCurConstraints++;
}
}
// only call solveGroup if there is some work: avoid virtual function call, its overhead can be excessive
if ((numManifolds + numCurConstraints) > 0) {
solver.solveGroup(bodies, numBodies, manifolds, manifolds_offset, numManifolds, sortedConstraints, startConstraint_idx, numCurConstraints, solverInfo, debugDrawer/*,m_stackAlloc*/, dispatcher);
}
}
}
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:35,代码来源:DiscreteDynamicsWorld.java
示例20: needsCollision
import com.bulletphysics.collision.narrowphase.PersistentManifold; //导入依赖的package包/类
@Override
public boolean needsCollision(BroadphaseProxy proxy0) {
// don't collide with itself
if (proxy0.clientObject == me) {
return false;
}
// don't do CCD when the collision filters are not matching
if (!super.needsCollision(proxy0)) {
return false;
}
CollisionObject otherObj = (CollisionObject)proxy0.clientObject;
// call needsResponse, see http://code.google.com/p/bullet/issues/detail?id=179
if (dispatcher.needsResponse(me, otherObj)) {
// don't do CCD when there are already contact points (touching contact/penetration)
ObjectArrayList<PersistentManifold> manifoldArray = new ObjectArrayList<PersistentManifold>();
BroadphasePair collisionPair = pairCache.findPair(me.getBroadphaseHandle(), proxy0);
if (collisionPair != null) {
if (collisionPair.algorithm != null) {
//manifoldArray.resize(0);
collisionPair.algorithm.getAllContactManifolds(manifoldArray);
for (int j=0; j<manifoldArray.size(); j++) {
PersistentManifold manifold = manifoldArray.getQuick(j);
if (manifold.getNumContacts() > 0) {
return false;
}
}
}
}
}
return true;
}
开发者ID:warlockcodes,项目名称:Null-Engine,代码行数:35,代码来源:DiscreteDynamicsWorld.java
注:本文中的com.bulletphysics.collision.narrowphase.PersistentManifold类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论