Add pairwise collision test:

void	btCollisionWorld::contactPairTest(btCollisionObject* colObjA, btCollisionObject* colObjB, ContactResultCallback& resultCallback)

cmake: improve feedback for Maya Plugin handling if the Maya base path is not detected
This commit is contained in:
erwin.coumans 2010-02-11 09:18:49 +00:00
parent 5907f81774
commit 7a175fb65e
3 changed files with 87 additions and 55 deletions

View File

@ -15,70 +15,78 @@ FIND_PATH(MAYA_BASE_DIR include/maya/MFn.h PATH
/usr/autodesk/maya
"C:/Program Files/Autodesk/Maya2008"
"C:/Program Files/Autodesk/Maya2009"
"C:/Program Files/Autodesk/Maya8.5")
"C:/Program Files/Autodesk/Maya8.5"
"C:/Program Files (x86)/Autodesk/Maya2010"
)
SET(MAYA_INC_DIR ${MAYA_BASE_DIR}/include)
SET(MAYA_LIB_DIR ${MAYA_BASE_DIR}/lib)
IF (MAYA_BASE_DIR)
message ("Maya found at location " ${MAYA_BASE_DIR})
INCLUDE_DIRECTORIES(${MAYA_INC_DIR} ${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Extras/MayaPlugin )
LINK_DIRECTORIES(${MAYA_LIB_DIR})
SET(MAYA_INC_DIR ${MAYA_BASE_DIR}/include)
SET(MAYA_LIB_DIR ${MAYA_BASE_DIR}/lib)
ADD_DEFINITIONS(-D_BOOL)
ADD_DEFINITIONS(-DREQUIRE_IOSTREAM)
INCLUDE_DIRECTORIES(${MAYA_INC_DIR} ${BULLET_PHYSICS_SOURCE_DIR}/src ${BULLET_PHYSICS_SOURCE_DIR}/Extras/MayaPlugin )
LINK_DIRECTORIES(${MAYA_LIB_DIR})
SET(TARGET_H
box_shape.h bt_sphere_shape.h dSolverNode.h rigid_body_impl.h
box_shape_impl.h collision_shape.h mathUtils.h rigidBodyNode.h
bt_box_shape.h collision_shape_impl.h mayaUtils.h solver.h
bt_collision_shape.h collisionShapeNode.h mesh_shape.h solver_impl.h
bt_convex_hull_shape.h convex_hull_shape.h mesh_shape_impl.h sphere_shape.h
bt_mesh_shape.h convex_hull_shape_impl.h plane_shape.h sphere_shape_impl.h
bt_plane_shape.h dRigidBodyArrayCmd.h plane_shape_impl.h
bt_rigid_body.h dRigidBodyCmd.h rigidBodyArrayNode.h
bt_solver.h dSolverCmd.h rigid_body.h pdbIO.h
shared_ptr.h drawUtils.h
)
ADD_DEFINITIONS(-D_BOOL)
ADD_DEFINITIONS(-DREQUIRE_IOSTREAM)
SET(TARGET_SRC
pluginMain.cpp bulletExport.cpp rigidBodyNode.cpp rigidBodyArrayNode.cpp collisionShapeNode.cpp
solver.cpp bt_solver.cpp dSolverNode.cpp dSolverCmd.cpp dRigidBodyCmd.cpp dRigidBodyArrayCmd.cpp
pdbIO.cpp drawUtils.cpp constraint/dHingeConstraintCmd.cpp constraint/dSliderConstraintCmd.cpp
constraint/hingeConstraintNode.cpp constraint/sixdofConstraintNode.cpp constraint/dNailConstraintCmd.cpp
constraint/dsixdofConstraintCmd.cpp constraint/nailConstraintNode.cpp constraint/sliderConstraintNode.cpp
)
SET(TARGET_H
box_shape.h bt_sphere_shape.h dSolverNode.h rigid_body_impl.h
box_shape_impl.h collision_shape.h mathUtils.h rigidBodyNode.h
bt_box_shape.h collision_shape_impl.h mayaUtils.h solver.h
bt_collision_shape.h collisionShapeNode.h mesh_shape.h solver_impl.h
bt_convex_hull_shape.h convex_hull_shape.h mesh_shape_impl.h sphere_shape.h
bt_mesh_shape.h convex_hull_shape_impl.h plane_shape.h sphere_shape_impl.h
bt_plane_shape.h dRigidBodyArrayCmd.h plane_shape_impl.h
bt_rigid_body.h dRigidBodyCmd.h rigidBodyArrayNode.h
bt_solver.h dSolverCmd.h rigid_body.h pdbIO.h
shared_ptr.h drawUtils.h
)
ADD_LIBRARY(BulletMayaPlugin SHARED ${TARGET_H} ${TARGET_SRC})
SET(TARGET_SRC
pluginMain.cpp bulletExport.cpp rigidBodyNode.cpp rigidBodyArrayNode.cpp collisionShapeNode.cpp
solver.cpp bt_solver.cpp dSolverNode.cpp dSolverCmd.cpp dRigidBodyCmd.cpp dRigidBodyArrayCmd.cpp
pdbIO.cpp drawUtils.cpp constraint/dHingeConstraintCmd.cpp constraint/dSliderConstraintCmd.cpp
constraint/hingeConstraintNode.cpp constraint/sixdofConstraintNode.cpp constraint/dNailConstraintCmd.cpp
constraint/dsixdofConstraintCmd.cpp constraint/nailConstraintNode.cpp constraint/sliderConstraintNode.cpp
)
ADD_LIBRARY(BulletMayaPlugin SHARED ${TARGET_H} ${TARGET_SRC})
IF (WIN32)
SET(MAYA_LIBS OpenMaya Foundation OpenMayaAnim OpenMayaFX OpenMayaUI)
IF (CMAKE_CL_64)
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /MACHINE:X64")
ELSE (CMAKE_CL_64)
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /MACHINE:X86")
ENDIF (CMAKE_CL_64)
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES SUFFIX ".mll")
IF (WIN32)
SET(MAYA_LIBS OpenMaya Foundation OpenMayaAnim OpenMayaFX OpenMayaUI)
IF (CMAKE_CL_64)
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /MACHINE:X64")
ELSE (CMAKE_CL_64)
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES LINK_FLAGS "/SUBSYSTEM:WINDOWS /MACHINE:X86")
ENDIF (CMAKE_CL_64)
SET_TARGET_PROPERTIES(BulletMayaPlugin PROPERTIES SUFFIX ".mll")
LINK_DIRECTORIES(${MAYA_LIB_DIR})
TARGET_LINK_LIBRARIES(BulletMayaPlugin BulletDynamics BulletCollision LinearMath ${MAYA_LIBS} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
SET(CMAKE_SHARED_LINKER_FLAGS "/export:initializePlugin /export:uninitializePlugin")
ELSE (WIN32)
SET(MAYA_LIBS OpenMayalib Foundation OpenMayaAnim OpenMayaFX OpenMayaUI)
LINK_DIRECTORIES(${MAYA_LIB_DIR})
TARGET_LINK_LIBRARIES(BulletMayaPlugin BulletDynamics BulletCollision LinearMath ${MAYA_LIBS} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
ENDIF(WIN32)
LINK_DIRECTORIES(${MAYA_LIB_DIR})
TARGET_LINK_LIBRARIES(BulletMayaPlugin BulletDynamics BulletCollision LinearMath ${MAYA_LIBS} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
SET(CMAKE_SHARED_LINKER_FLAGS "/export:initializePlugin /export:uninitializePlugin")
ELSE (WIN32)
SET(MAYA_LIBS OpenMayalib Foundation OpenMayaAnim OpenMayaFX OpenMayaUI)
LINK_DIRECTORIES(${MAYA_LIB_DIR})
TARGET_LINK_LIBRARIES(BulletMayaPlugin BulletDynamics BulletCollision LinearMath ${MAYA_LIBS} ${OPENGL_gl_LIBRARY} ${OPENGL_glu_LIBRARY})
ENDIF(WIN32)
#OPTION(BUILD_STANDALONE "Build a standalone exporter program")
#
#IF (BUILD_STANDALONE)
# IF (WIN32)
#
# ELSE (WIN32)
# SET(MAYA_LIBS OpenMayalib Foundation OpenMayaAnim)
# ADD_EXECUTABLE(me ${TARGET_H} ${TARGET_SRC} standalone.cpp)
# LINK_DIRECTORIES(${MAYA_LIB_DIR})
# TARGET_LINK_LIBRARIES(me ${MAYA_LIBS} pthread m imf)
# ENDIF (WIN32)
#ENDIF (BUILD_STANDALONE)
#OPTION(BUILD_STANDALONE "Build a standalone exporter program")
#
#IF (BUILD_STANDALONE)
# IF (WIN32)
#
# ELSE (WIN32)
# SET(MAYA_LIBS OpenMayalib Foundation OpenMayaAnim)
# ADD_EXECUTABLE(me ${TARGET_H} ${TARGET_SRC} standalone.cpp)
# LINK_DIRECTORIES(${MAYA_LIB_DIR})
# TARGET_LINK_LIBRARIES(me ${MAYA_LIBS} pthread m imf)
# ENDIF (WIN32)
#ENDIF (BUILD_STANDALONE)
ELSE()
MESSAGE("Maya not found, try adding your Maya path in Bullet/Extras/MayaPlugin/CMakeListst.txt under FIND_PATH(MAYA_BASE_DIR ...")
ENDIF()

View File

@ -1017,6 +1017,25 @@ void btCollisionWorld::contactTest( btCollisionObject* colObj, ContactResultCall
}
///contactTest performs a discrete collision test between two collision objects and calls the resultCallback if overlap if detected.
///it reports one or more contact points (including the one with deepest penetration)
void btCollisionWorld::contactPairTest(btCollisionObject* colObjA, btCollisionObject* colObjB, ContactResultCallback& resultCallback)
{
btCollisionAlgorithm* algorithm = getDispatcher()->findAlgorithm(colObjA,colObjB);
if (algorithm)
{
btBridgedManifoldResult contactPointResult(colObjA,colObjB, resultCallback);
//discrete collision detection query
algorithm->processCollision(colObjA,colObjB, getDispatchInfo(),&contactPointResult);
algorithm->~btCollisionAlgorithm();
getDispatcher()->freeCollisionAlgorithm(algorithm);
}
}
class DebugDrawcallback : public btTriangleCallback, public btInternalTriangleIndexCallback
{

View File

@ -403,6 +403,11 @@ public:
///it reports one or more contact points for every overlapping object (including the one with deepest penetration)
void contactTest(btCollisionObject* colObj, ContactResultCallback& resultCallback);
///contactTest performs a discrete collision test between two collision objects and calls the resultCallback if overlap if detected.
///it reports one or more contact points (including the one with deepest penetration)
void contactPairTest(btCollisionObject* colObjA, btCollisionObject* colObjB, ContactResultCallback& resultCallback);
/// rayTestSingle performs a raycast call and calls the resultCallback. It is used internally by rayTest.
/// In a future implementation, we consider moving the ray test as a virtual method in btCollisionShape.
/// This allows more customization.