Skip to content

Commit 287f3e0

Browse files
committed
Fixed MSVC Runtime mismatch
1 parent 7c689f0 commit 287f3e0

File tree

3 files changed

+10
-15
lines changed

3 files changed

+10
-15
lines changed

dependencies/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ set(BUILD_BULLET2_DEMOS OFF CACHE INTERNAL "")
2323
set(BUILD_UNIT_TESTS OFF CACHE INTERNAL "")
2424
set(BUILD_EXTRAS OFF CACHE INTERNAL "")
2525
set(BUILD_PYBULLET OFF CACHE INTERNAL "")
26+
set(USE_MSVC_RUNTIME_LIBRARY_DLL ON CACHE INTERNAL "")
2627
add_subdirectory(bullet)
2728

2829
# entt

igneous/src/core/igneous.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ int Application::run(int argc, char** argv, bgfx::Init init)
8484
gui::update(dt);
8585
bgfx::touch(0);
8686
ImGui::NewFrame();
87+
physics::update(dt);
8788
update(dt);
8889
render();
8990
ImGui::Render();

igneous/src/physics/physics.cpp

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ namespace physics
1515
static btSequentialImpulseConstraintSolver* solver;
1616
static btDiscreteDynamicsWorld* dynamicsWorld;
1717
static btSphereShape sphere(10.0f);
18-
static btTransform transform;
18+
static btTransform identityTransform;
1919

2020
void init()
2121
{
@@ -37,12 +37,16 @@ namespace physics
3737
dynamicsWorld->setGravity(btVector3(0, -10, 0));
3838
dynamicsWorld->debugDrawWorld();
3939

40-
transform.setFromOpenGLMatrix(glm::value_ptr(glm::identity<glm::mat4>()));
40+
identityTransform.setFromOpenGLMatrix(glm::value_ptr(glm::identity<glm::mat4>()));
4141
IG_CORE_INFO("Physics Initialized");
4242
}
4343

44-
btRigidBody* createRigidBody(float mass, const btTransform& startTransform, btCollisionShape* shape, const btVector4& color = btVector4(1, 0, 0, 1))
44+
RigidBodyHandle loadRigidBody(std::string path)
4545
{
46+
btScalar mass = 10.0f;
47+
btCollisionShape* shape = &sphere;
48+
btTransform transform = identityTransform;
49+
4650
assert((!shape || shape->getShapeType() != INVALID_SHAPE_PROXYTYPE));
4751

4852
//rigidbody is dynamic if and only if mass is non zero, otherwise static
@@ -56,7 +60,7 @@ namespace physics
5660

5761
#define USE_MOTIONSTATE 1
5862
#ifdef USE_MOTIONSTATE
59-
btDefaultMotionState * myMotionState = new btDefaultMotionState(startTransform);
63+
btDefaultMotionState * myMotionState = new btDefaultMotionState(transform);
6064

6165
btRigidBody::btRigidBodyConstructionInfo cInfo(mass, myMotionState, shape, localInertia);
6266

@@ -73,24 +77,13 @@ namespace physics
7377
return body;
7478
}
7579

76-
RigidBodyHandle loadRigidBody(std::string path)
77-
{
78-
return createRigidBody(10.0f, transform, &sphere);
79-
}
80-
8180
void update(float dt)
8281
{
8382
dynamicsWorld->stepSimulation(dt);
8483
ecs::registry.view<RigidBodyHandle, Transformation>().each([&](const auto, auto& rigidBody, auto& transformation)
8584
{
8685
btTransform t = rigidBody->getWorldTransform();
8786
t.getOpenGLMatrix(glm::value_ptr(transformation));
88-
/*
89-
btVector3 origin = rigidBody->getWorldTransform().getOrigin();
90-
transformation[3][0] = origin.getX();
91-
transformation[3][1] = origin.getY();
92-
transformation[3][2] = origin.getZ();
93-
*/
9487
});
9588
}
9689

0 commit comments

Comments
 (0)