Merge pull request #1 from ColinGilbert/master
Propagate static_cast improvements to dev
This commit is contained in:
commit
7e85e1e1c5
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -20,4 +20,8 @@
|
|||
.Trashes
|
||||
Icon?
|
||||
ehthumbs.db
|
||||
Thumbs.db
|
||||
Thumbs.db
|
||||
|
||||
# vim swap files
|
||||
#####################
|
||||
*.*sw*
|
||||
|
|
22
.travis.yml
Normal file
22
.travis.yml
Normal file
|
@ -0,0 +1,22 @@
|
|||
language: cpp
|
||||
os:
|
||||
- linux
|
||||
- osx
|
||||
compiler:
|
||||
- gcc
|
||||
- clang
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
- develop
|
||||
script:
|
||||
- mkdir build_directory
|
||||
- cd build_directory
|
||||
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug —DDOUBLE_PRECISION_ENABLED=True -DCOMPILE_TESTS=True ../
|
||||
- make && make test
|
||||
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Debug —DDOUBLE_PRECISION_ENABLED=False -DCOMPILE_TESTS=True ../
|
||||
- make && make test
|
||||
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release —DDOUBLE_PRECISION_ENABLED=True -DCOMPILE_TESTS=True ../
|
||||
- make && make test
|
||||
- cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release —DDOUBLE_PRECISION_ENABLED=False -DCOMPILE_TESTS=True ../
|
||||
- make && make test
|
|
@ -15,6 +15,8 @@ SET(LIBRARY_OUTPUT_PATH "lib")
|
|||
# Where to build the executables
|
||||
SET(OUR_EXECUTABLE_OUTPUT_PATH "${PROJECT_BINARY_DIR}/bin")
|
||||
|
||||
ENABLE_TESTING()
|
||||
|
||||
# Options
|
||||
OPTION(COMPILE_EXAMPLES "Select this if you want to build the examples" OFF)
|
||||
OPTION(COMPILE_TESTS "Select this if you want to build the tests" OFF)
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
[![Travis Build Status](https://travis-ci.org/DanielChappuis/reactphysics3d.svg?branch=master)](https://travis-ci.org/DanielChappuis/reactphysics3d)
|
||||
|
||||
|
||||
## ReactPhysics3D
|
||||
|
||||
ReactPhysics3D is an open source C++ physics engine library that can be used in 3D simulations and games.
|
||||
|
@ -37,7 +40,7 @@ You can find the User Manual and the Doxygen API Documentation [here](http://www
|
|||
|
||||
## Branches
|
||||
|
||||
The "master" branch always contains the last released version of the library. This is the most stable version. On the other side,
|
||||
The "master" branch always contains the last released version of the library and some possible bug fixes. This is the most stable version. On the other side,
|
||||
the "develop" branch is used for development. This branch is frequently updated and can be quite unstable. Therefore, if you want to use the library in
|
||||
your application, it is recommended to checkout the "master" branch.
|
||||
|
||||
|
|
|
@ -120,7 +120,7 @@ inline rp3d::CollisionBody* Box::getCollisionBody() {
|
|||
|
||||
// Return a pointer to the rigid body of the box
|
||||
inline rp3d::RigidBody* Box::getRigidBody() {
|
||||
return dynamic_cast<rp3d::RigidBody*>(mRigidBody);
|
||||
return static_cast<rp3d::RigidBody*>(mRigidBody);
|
||||
}
|
||||
|
||||
// Set the color of the box
|
||||
|
|
|
@ -88,7 +88,7 @@ inline rp3d::CollisionBody* Capsule::getCollisionBody() {
|
|||
|
||||
// Return a pointer to the rigid body of the box
|
||||
inline rp3d::RigidBody* Capsule::getRigidBody() {
|
||||
return dynamic_cast<rp3d::RigidBody*>(mRigidBody);
|
||||
return static_cast<rp3d::RigidBody*>(mRigidBody);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -87,7 +87,7 @@ inline rp3d::CollisionBody* Cone::getCollisionBody() {
|
|||
|
||||
// Return a pointer to the rigid body of the box
|
||||
inline rp3d::RigidBody* Cone::getRigidBody() {
|
||||
return dynamic_cast<rp3d::RigidBody*>(mRigidBody);
|
||||
return static_cast<rp3d::RigidBody*>(mRigidBody);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -84,7 +84,7 @@ inline rp3d::CollisionBody* Sphere::getCollisionBody() {
|
|||
|
||||
// Return a pointer to the rigid body of the box
|
||||
inline rp3d::RigidBody* Sphere::getRigidBody() {
|
||||
return dynamic_cast<rp3d::RigidBody*>(mRigidBody);
|
||||
return static_cast<rp3d::RigidBody*>(mRigidBody);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -342,7 +342,7 @@ void RigidBody::updateBroadPhaseState() const {
|
|||
|
||||
PROFILE("RigidBody::updateBroadPhaseState()");
|
||||
|
||||
DynamicsWorld& world = dynamic_cast<DynamicsWorld&>(mWorld);
|
||||
DynamicsWorld& world = static_cast<DynamicsWorld&>(mWorld);
|
||||
const Vector3 displacement = world.mTimer.getTimeStep() * mLinearVelocity;
|
||||
|
||||
// For all the proxy collision shapes of the body
|
||||
|
|
|
@ -48,8 +48,8 @@ bool SphereVsSphereAlgorithm::testCollision(ProxyShape* collisionShape1,
|
|||
// Get the sphere collision shapes
|
||||
const CollisionShape* shape1 = collisionShape1->getCollisionShape();
|
||||
const CollisionShape* shape2 = collisionShape2->getCollisionShape();
|
||||
const SphereShape* sphereShape1 = dynamic_cast<const SphereShape*>(shape1);
|
||||
const SphereShape* sphereShape2 = dynamic_cast<const SphereShape*>(shape2);
|
||||
const SphereShape* sphereShape1 = static_cast<const SphereShape*>(shape1);
|
||||
const SphereShape* sphereShape2 = static_cast<const SphereShape*>(shape2);
|
||||
|
||||
// Get the local-space to world-space transforms
|
||||
const Transform transform1 = collisionShape1->getBody()->getTransform() *
|
||||
|
|
|
@ -165,7 +165,7 @@ inline Vector3 BoxShape::getLocalSupportPointWithoutMargin(const Vector3& direct
|
|||
|
||||
// Test equality between two box shapes
|
||||
inline bool BoxShape::isEqualTo(const CollisionShape& otherCollisionShape) const {
|
||||
const BoxShape& otherShape = dynamic_cast<const BoxShape&>(otherCollisionShape);
|
||||
const BoxShape& otherShape = static_cast<const BoxShape&>(otherCollisionShape);
|
||||
return (mExtent == otherShape.mExtent);
|
||||
}
|
||||
|
||||
|
|
|
@ -162,7 +162,7 @@ inline void CapsuleShape::getLocalBounds(Vector3& min, Vector3& max) const {
|
|||
|
||||
// Test equality between two capsule shapes
|
||||
inline bool CapsuleShape::isEqualTo(const CollisionShape& otherCollisionShape) const {
|
||||
const CapsuleShape& otherShape = dynamic_cast<const CapsuleShape&>(otherCollisionShape);
|
||||
const CapsuleShape& otherShape = static_cast<const CapsuleShape&>(otherCollisionShape);
|
||||
return (mRadius == otherShape.mRadius && mHalfHeight == otherShape.mHalfHeight);
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ inline void ConeShape::computeLocalInertiaTensor(Matrix3x3& tensor, decimal mass
|
|||
|
||||
// Test equality between two cone shapes
|
||||
inline bool ConeShape::isEqualTo(const CollisionShape& otherCollisionShape) const {
|
||||
const ConeShape& otherShape = dynamic_cast<const ConeShape&>(otherCollisionShape);
|
||||
const ConeShape& otherShape = static_cast<const ConeShape&>(otherCollisionShape);
|
||||
return (mRadius == otherShape.mRadius && mHalfHeight == otherShape.mHalfHeight);
|
||||
}
|
||||
|
||||
|
|
|
@ -211,7 +211,7 @@ void ConvexMeshShape::recalculateBounds() {
|
|||
|
||||
// Test equality between two cone shapes
|
||||
bool ConvexMeshShape::isEqualTo(const CollisionShape& otherCollisionShape) const {
|
||||
const ConvexMeshShape& otherShape = dynamic_cast<const ConvexMeshShape&>(otherCollisionShape);
|
||||
const ConvexMeshShape& otherShape = static_cast<const ConvexMeshShape&>(otherCollisionShape);
|
||||
|
||||
assert(mNbVertices == mVertices.size());
|
||||
|
||||
|
|
|
@ -224,12 +224,12 @@ inline void ConvexMeshShape::addEdge(uint v1, uint v2) {
|
|||
|
||||
// If the entry for vertex v1 does not exist in the adjacency list
|
||||
if (mEdgesAdjacencyList.count(v1) == 0) {
|
||||
mEdgesAdjacencyList.insert(std::make_pair<uint, std::set<uint> >(v1, std::set<uint>()));
|
||||
mEdgesAdjacencyList.insert(std::make_pair(v1, std::set<uint>()));
|
||||
}
|
||||
|
||||
// If the entry for vertex v2 does not exist in the adjacency list
|
||||
if (mEdgesAdjacencyList.count(v2) == 0) {
|
||||
mEdgesAdjacencyList.insert(std::make_pair<uint, std::set<uint> >(v2, std::set<uint>()));
|
||||
mEdgesAdjacencyList.insert(std::make_pair(v2, std::set<uint>()));
|
||||
}
|
||||
|
||||
// Add the edge in the adjacency list
|
||||
|
|
|
@ -175,7 +175,7 @@ inline void CylinderShape::computeLocalInertiaTensor(Matrix3x3& tensor, decimal
|
|||
|
||||
// Test equality between two cylinder shapes
|
||||
inline bool CylinderShape::isEqualTo(const CollisionShape& otherCollisionShape) const {
|
||||
const CylinderShape& otherShape = dynamic_cast<const CylinderShape&>(otherCollisionShape);
|
||||
const CylinderShape& otherShape = static_cast<const CylinderShape&>(otherCollisionShape);
|
||||
return (mRadius == otherShape.mRadius && mHalfHeight == otherShape.mHalfHeight);
|
||||
}
|
||||
|
||||
|
|
|
@ -197,7 +197,7 @@ inline void SphereShape::computeAABB(AABB& aabb, const Transform& transform) {
|
|||
|
||||
// Test equality between two sphere shapes
|
||||
inline bool SphereShape::isEqualTo(const CollisionShape& otherCollisionShape) const {
|
||||
const SphereShape& otherShape = dynamic_cast<const SphereShape&>(otherCollisionShape);
|
||||
const SphereShape& otherShape = static_cast<const SphereShape&>(otherCollisionShape);
|
||||
return (mRadius == otherShape.mRadius);
|
||||
}
|
||||
|
||||
|
|
|
@ -83,8 +83,8 @@ void ContactSolver::initializeForIsland(decimal dt, Island* island) {
|
|||
assert(externalManifold->getNbContactPoints() > 0);
|
||||
|
||||
// Get the two bodies of the contact
|
||||
RigidBody* body1 = dynamic_cast<RigidBody*>(externalManifold->getContactPoint(0)->getBody1());
|
||||
RigidBody* body2 = dynamic_cast<RigidBody*>(externalManifold->getContactPoint(0)->getBody2());
|
||||
RigidBody* body1 = static_cast<RigidBody*>(externalManifold->getContactPoint(0)->getBody1());
|
||||
RigidBody* body2 = static_cast<RigidBody*>(externalManifold->getContactPoint(0)->getBody2());
|
||||
assert(body1 != NULL);
|
||||
assert(body2 != NULL);
|
||||
|
||||
|
|
|
@ -288,8 +288,7 @@ void DynamicsWorld::initVelocityArrays() {
|
|||
for (it = mRigidBodies.begin(); it != mRigidBodies.end(); ++it) {
|
||||
|
||||
// Add the body into the map
|
||||
mMapBodyToConstrainedVelocityIndex.insert(std::make_pair<RigidBody*,
|
||||
uint>(*it, indexBody));
|
||||
mMapBodyToConstrainedVelocityIndex.insert(std::make_pair(*it, indexBody));
|
||||
indexBody++;
|
||||
}
|
||||
}
|
||||
|
@ -530,7 +529,7 @@ Joint* DynamicsWorld::createJoint(const JointInfo& jointInfo) {
|
|||
case BALLSOCKETJOINT:
|
||||
{
|
||||
void* allocatedMemory = mMemoryAllocator.allocate(sizeof(BallAndSocketJoint));
|
||||
const BallAndSocketJointInfo& info = dynamic_cast<const BallAndSocketJointInfo&>(
|
||||
const BallAndSocketJointInfo& info = static_cast<const BallAndSocketJointInfo&>(
|
||||
jointInfo);
|
||||
newJoint = new (allocatedMemory) BallAndSocketJoint(info);
|
||||
break;
|
||||
|
@ -540,7 +539,7 @@ Joint* DynamicsWorld::createJoint(const JointInfo& jointInfo) {
|
|||
case SLIDERJOINT:
|
||||
{
|
||||
void* allocatedMemory = mMemoryAllocator.allocate(sizeof(SliderJoint));
|
||||
const SliderJointInfo& info = dynamic_cast<const SliderJointInfo&>(jointInfo);
|
||||
const SliderJointInfo& info = static_cast<const SliderJointInfo&>(jointInfo);
|
||||
newJoint = new (allocatedMemory) SliderJoint(info);
|
||||
break;
|
||||
}
|
||||
|
@ -549,7 +548,7 @@ Joint* DynamicsWorld::createJoint(const JointInfo& jointInfo) {
|
|||
case HINGEJOINT:
|
||||
{
|
||||
void* allocatedMemory = mMemoryAllocator.allocate(sizeof(HingeJoint));
|
||||
const HingeJointInfo& info = dynamic_cast<const HingeJointInfo&>(jointInfo);
|
||||
const HingeJointInfo& info = static_cast<const HingeJointInfo&>(jointInfo);
|
||||
newJoint = new (allocatedMemory) HingeJoint(info);
|
||||
break;
|
||||
}
|
||||
|
@ -558,7 +557,7 @@ Joint* DynamicsWorld::createJoint(const JointInfo& jointInfo) {
|
|||
case FIXEDJOINT:
|
||||
{
|
||||
void* allocatedMemory = mMemoryAllocator.allocate(sizeof(FixedJoint));
|
||||
const FixedJointInfo& info = dynamic_cast<const FixedJointInfo&>(jointInfo);
|
||||
const FixedJointInfo& info = static_cast<const FixedJointInfo&>(jointInfo);
|
||||
newJoint = new (allocatedMemory) FixedJoint(info);
|
||||
break;
|
||||
}
|
||||
|
@ -747,8 +746,8 @@ void DynamicsWorld::computeIslands() {
|
|||
contactManifold->mIsAlreadyInIsland = true;
|
||||
|
||||
// Get the other body of the contact manifold
|
||||
RigidBody* body1 = dynamic_cast<RigidBody*>(contactManifold->getBody1());
|
||||
RigidBody* body2 = dynamic_cast<RigidBody*>(contactManifold->getBody2());
|
||||
RigidBody* body1 = static_cast<RigidBody*>(contactManifold->getBody1());
|
||||
RigidBody* body2 = static_cast<RigidBody*>(contactManifold->getBody2());
|
||||
RigidBody* otherBody = (body1->getID() == bodyToVisit->getID()) ? body2 : body1;
|
||||
|
||||
// Check if the other body has already been added to the island
|
||||
|
@ -775,8 +774,8 @@ void DynamicsWorld::computeIslands() {
|
|||
joint->mIsAlreadyInIsland = true;
|
||||
|
||||
// Get the other body of the contact manifold
|
||||
RigidBody* body1 = dynamic_cast<RigidBody*>(joint->getBody1());
|
||||
RigidBody* body2 = dynamic_cast<RigidBody*>(joint->getBody2());
|
||||
RigidBody* body1 = static_cast<RigidBody*>(joint->getBody1());
|
||||
RigidBody* body2 = static_cast<RigidBody*>(joint->getBody2());
|
||||
RigidBody* otherBody = (body1->getID() == bodyToVisit->getID()) ? body2 : body1;
|
||||
|
||||
// Check if the other body has already been added to the island
|
||||
|
|
|
@ -18,3 +18,5 @@ file (
|
|||
ADD_EXECUTABLE(tests ${TESTS_SOURCE_FILES})
|
||||
|
||||
TARGET_LINK_LIBRARIES(tests reactphysics3d)
|
||||
|
||||
ADD_TEST(Test tests)
|
||||
|
|
Loading…
Reference in New Issue
Block a user