Skip to content

Fixes#2

Open
magistermaks wants to merge 2 commits into
felipemdutra:mainfrom
magistermaks:main
Open

Fixes#2
magistermaks wants to merge 2 commits into
felipemdutra:mainfrom
magistermaks:main

Conversation

@magistermaks

Copy link
Copy Markdown

I found your repo when i was looking for a minimal C++ physics library for my project. In the current state it didn't really work at all so before I could test it I needed to make some changes and decided to try sharing them here. The changes I made:

  • Fixed compile time error caused by std::tuple<int, int, int> having no hash function, switched to glm::ivec3
  • Fixed linking error caused by invalid function signatures in definition vs. declaration.
  • Fixed runtime error caused by not being able to find shaders, i just hardcoded the shader code into the program, imo that is simpler and much less error prone esp. with such simple shaders. Another fix would be to add a CMake task that copies the shaders from ./src into the CMAKE_BUILD_DIR, but that was more work and I wanted to focus on physics.
  • Split the graphics code from the physics code (The CMake linked the physics stuff together with graphics libs so I split that as part of trying to use it as a library). This required some changes around Mesh, now the Mesh class lives in physics/ with a tiny bit of graphics code (see physics/mesh.hpp). I wanted to make the separation better in the future but at least it works right now as-is.
  • Split the CMake graphic libs into a separate pheV3_graphics target
  • Added a "headless" demo that checks if the lib compiles without graphics libs
  • Rewrote the box stacking demo to actually test box stacking.
  • Fixed collisions a bit to correct the position, making box stacking (somewhat) possible
  • Fix demos being dependent on window creation time, making them much more consistent.
  • Temporarily removed broadPhaseFilter from PhysicsWorld::update as it did not work (and I had no need for this optimization in my use-case)
  • While at it, I also renamed some files to all-lowercase.

There where probably some other changes I missed here,
Kind regards.

Fixes many configuration, compile and link errors. Splits the rendering into a separate library so that the physics doesn't depend on graphics components. Added a new headless demo. Broken the style a bit but more refactoring is needed anyway so this is fine for now.
Adds positon correction to collisions, fixes demos being inconsistent due to varying window-creation time. Renames all files to be lower case.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant