Skip to content

Commit

Permalink
Merge cafcda1 into 8bc3ea5
Browse files Browse the repository at this point in the history
  • Loading branch information
louis-langholtz committed Oct 18, 2020
2 parents 8bc3ea5 + cafcda1 commit 901e0a8
Show file tree
Hide file tree
Showing 263 changed files with 24,903 additions and 19,660 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -297,3 +297,6 @@ __pycache__/
*.btm.cs
*.odx.cs
*.xsd.cs

# Imgui ini file
**/imgui.ini
21 changes: 12 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ os:
# For details on building a C++ project see: https://docs.travis-ci.com/user/languages/cpp/
language: cpp

dist: trusty
# Choices available now are trusty, xenial, or bionic.
# Trusty is "EOL" however. bionic appears to be latest Ubunntu release version.
dist: bionic

# Specifiy which compiler or compilers to test against.
# For details, see https://docs.travis-ci.com/user/languages/cpp/#Choosing-compilers-to-test-against
Expand All @@ -23,9 +25,9 @@ env:

# Specify explicitly which branches to build or not build
# For details see: https://docs.travis-ci.com/user/customizing-the-build/#Building-Specific-Branches
#branches:
# only:
# - master
branches:
only:
- master

# Specify which OS X image to use.
# "xcode8" is supposed to provide a macosx10.11 SK preinstalled.
Expand All @@ -50,23 +52,24 @@ addons:
sources:
- deadsnakes
- ubuntu-toolchain-r-test
- george-edison55-precise-backports
- llvm-toolchain-trusty-5.0
packages:
- build-essential
- cmake
- cmake-data
- clang-5.0
- clang-8
- g++-8
- gcc-8
- xorg-dev
- libx11-dev
- libxmu-dev
- libxi-dev
- libgl1-mesa-dev
- libglu1-mesa-dev
- libosmesa-dev
- lcov
- ggcov
- libglfw3-dev
- libglew2.0

# Seems new way is to call: pip install --user cpp-coveralls
# That works for installing cpp-coveralls, but haven't figured out how to get cpp-coveralls to work.
Expand Down Expand Up @@ -95,7 +98,7 @@ install:
mkdir -p /tmp/usr
make -C lcov-1.14/ PREFIX=/tmp/usr install
fi
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-5.0" CC="clang-5.0"; fi
- if [ "$CXX" = "clang++" ]; then export CXX="clang++-8" CC="clang-8"; fi
- |
echo CXX=$CXX HOME=$HOME TRAVIS_BUILD_DIR=$TRAVIS_BUILD_DIR
cmake --version
Expand All @@ -119,7 +122,7 @@ install:
script:
- |
if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "clang++-5.0" ]]; then
if [[ "$TRAVIS_OS_NAME" == "linux" && "$CXX" == "clang++-8" ]]; then
(pwd && mkdir -p $BUILD_ROOT && cd $BUILD_ROOT && cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH=/tmp/usr -DCMAKE_LIBRARY_PATH=/tmp/usr/lib $PLAYRHO_BUILD_OPTIONS $SOURCE_ROOT && make && cd UnitTests && ./UnitTests --gtest_filter=-Dump.OneBodyWorld )
fi
- |
Expand Down
48 changes: 29 additions & 19 deletions Benchmark/BenchmarkMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,19 @@
#endif // BENCHMARK_GCDISPATCH

#include <PlayRho/Common/Math.hpp>
#include <PlayRho/Common/OptionalValue.hpp>
#include <PlayRho/Common/Intervals.hpp>
#include <PlayRho/Common/OptionalValue.hpp> // for Optional

#include <PlayRho/Dynamics/World.hpp>
#include <PlayRho/Dynamics/WorldMisc.hpp> // for GetAwakeCount
#include <PlayRho/Dynamics/StepConf.hpp>
#include <PlayRho/Dynamics/Contacts/ContactSolver.hpp>
#include <PlayRho/Dynamics/Contacts/VelocityConstraint.hpp>
#include <PlayRho/Dynamics/Joints/RevoluteJoint.hpp>
#include <PlayRho/Dynamics/Joints/Joint.hpp>
#include <PlayRho/Dynamics/Joints/RevoluteJointConf.hpp>

#include <PlayRho/Collision/AABB.hpp>
#include <PlayRho/Collision/DynamicTree.hpp>
#include <PlayRho/Collision/Manifold.hpp>
#include <PlayRho/Collision/WorldManifold.hpp>
#include <PlayRho/Collision/ShapeSeparation.hpp>
Expand Down Expand Up @@ -1942,7 +1949,7 @@ static void DropDisks(benchmark::State& state)
.UseType(playrho::BodyType::Dynamic)
.UseLocation(location)
.UseLinearAcceleration(playrho::d2::EarthlyGravity));
body->CreateFixture(shape);
world.CreateFixture(body, shape);
}

const auto stepConf = playrho::StepConf{};
Expand Down Expand Up @@ -2004,10 +2011,11 @@ static void AddPairStressTestPlayRho(benchmark::State& state, int count)
const auto location = playrho::Vec2(Rand(minX, maxX), Rand(minY, maxY)) * playrho::Meter;
// Uses parenthesis here to work around Visual C++'s const propagating of the copy.
const auto body = world.CreateBody(playrho::d2::BodyConf(bd).UseLocation(location));
body->CreateFixture(diskShape);
world.CreateFixture(body, diskShape);
}
}
world.CreateBody(rectBodyConf)->CreateFixture(rectShape);
const auto rectBody = world.CreateBody(rectBodyConf);
world.CreateFixture(rectBody, rectShape);
for (auto i = 0; i < state.range(); ++i)
{
world.Step(stepConf);
Expand Down Expand Up @@ -2102,7 +2110,7 @@ static void DropTilesPlayRho(int count)
for (auto i = 0; i < N; ++i)
{
conf.SetAsBox(a * playrho::Meter, a * playrho::Meter, position, playrho::Angle{0});
ground->CreateFixture(playrho::d2::Shape{conf});
world.CreateFixture(ground, playrho::d2::Shape{conf});
GetX(position) += 2.0f * a * playrho::Meter;
}
GetY(position) -= 2.0f * a * playrho::Meter;
Expand Down Expand Up @@ -2130,7 +2138,7 @@ static void DropTilesPlayRho(int count)
.UseType(playrho::BodyType::Dynamic)
.UseLocation(y)
.UseLinearAcceleration(gravity));
body->CreateFixture(shape);
world.CreateFixture(body, shape);
y += deltaY;
}

Expand Down Expand Up @@ -2265,9 +2273,10 @@ class Tumbler
bool IsWithin(const playrho::d2::AABB& aabb) const;

private:
static playrho::d2::Body* CreateEnclosure(playrho::d2::World& world);
static playrho::d2::RevoluteJoint* CreateRevoluteJoint(playrho::d2::World& world,
playrho::d2::Body* stable, playrho::d2::Body* turn);
static playrho::BodyID CreateEnclosure(playrho::d2::World& world);
static playrho::JointID CreateRevoluteJoint(playrho::d2::World& world,
playrho::BodyID stable,
playrho::BodyID turn);

playrho::d2::World m_world;
playrho::StepConf m_stepConf;
Expand All @@ -2284,26 +2293,27 @@ Tumbler::Tumbler()
CreateRevoluteJoint(m_world, g, b);
}

playrho::d2::Body* Tumbler::CreateEnclosure(playrho::d2::World& world)
playrho::BodyID Tumbler::CreateEnclosure(playrho::d2::World& world)
{
const auto b = world.CreateBody(playrho::d2::BodyConf{}.UseType(playrho::BodyType::Dynamic)
.UseLocation(playrho::Vec2(0, 10) * playrho::Meter)
.UseAllowSleep(false));
playrho::d2::PolygonShapeConf shape;
shape.UseDensity(5 * playrho::KilogramPerSquareMeter);
shape.SetAsBox(0.5f * playrho::Meter, 10.0f * playrho::Meter, playrho::Vec2( 10.0f, 0.0f) * playrho::Meter, playrho::Angle{0});
b->CreateFixture(playrho::d2::Shape{shape});
world.CreateFixture(b, playrho::d2::Shape{shape});
shape.SetAsBox(0.5f * playrho::Meter, 10.0f * playrho::Meter, playrho::Vec2(-10.0f, 0.0f) * playrho::Meter, playrho::Angle{0});
b->CreateFixture(playrho::d2::Shape{shape});
world.CreateFixture(b, playrho::d2::Shape{shape});
shape.SetAsBox(10.0f * playrho::Meter, 0.5f * playrho::Meter, playrho::Vec2(0.0f, 10.0f) * playrho::Meter, playrho::Angle{0});
b->CreateFixture(playrho::d2::Shape{shape});
world.CreateFixture(b, playrho::d2::Shape{shape});
shape.SetAsBox(10.0f * playrho::Meter, 0.5f * playrho::Meter, playrho::Vec2(0.0f, -10.0f) * playrho::Meter, playrho::Angle{0});
b->CreateFixture(playrho::d2::Shape{shape});
world.CreateFixture(b, playrho::d2::Shape{shape});
return b;
}

playrho::d2::RevoluteJoint* Tumbler::CreateRevoluteJoint(playrho::d2::World& world,
playrho::d2::Body* stable, playrho::d2::Body* turn)
playrho::JointID Tumbler::CreateRevoluteJoint(playrho::d2::World& world,
playrho::BodyID stable,
playrho::BodyID turn)
{
playrho::d2::RevoluteJointConf jd;
jd.bodyA = stable;
Expand All @@ -2317,7 +2327,7 @@ playrho::d2::RevoluteJoint* Tumbler::CreateRevoluteJoint(playrho::d2::World& wor

jd.maxMotorTorque = 100000 * playrho::NewtonMeter; // 1e8f;
jd.enableMotor = true;
return static_cast<playrho::d2::RevoluteJoint*>(world.CreateJoint(jd));
return world.CreateJoint(playrho::d2::Joint(jd));
}

void Tumbler::Step()
Expand All @@ -2331,7 +2341,7 @@ void Tumbler::AddSquare()
.UseType(playrho::BodyType::Dynamic)
.UseLocation(playrho::Vec2(0, 10) * playrho::Meter)
.UseLinearAcceleration(playrho::d2::EarthlyGravity));
b->CreateFixture(m_square);
m_world.CreateFixture(b, m_square);
}

bool Tumbler::IsWithin(const playrho::d2::AABB& aabb) const
Expand Down
Loading

0 comments on commit 901e0a8

Please sign in to comment.