GithubHelp home page GithubHelp logo

thephysicsguys / physics3d Goto Github PK

View Code? Open in Web Editor NEW
296.0 18.0 33.0 78.13 MB

A 3D physics engine

License: MIT License

C++ 95.96% GLSL 2.92% C 0.38% CMake 0.55% Shell 0.14% Batchfile 0.05%
physics simulation 3d-physics-engine glew engine cpp shader glfw opengl rendering-3d-graphics

physics3d's Introduction

Physics3D

Ubuntu CI Badge MSVC CI Badge

A 3D physics engine, written in C++

Many Shapes Different Shapes Editor

Project structure

The Physics3D project consists of 7 projects, each with its own role:

  • The Physics3D project contains the physics engine can be compiled separately.
  • The graphics project contains all the logic to interact with OpenGL, visual debugging and gui code.
  • The engine project contains general concepts that can be applied in multiple environments like a layer systems and an event system.
  • The util project contains code that can be used in all project, like logging, utilities and resource management.
  • The application project contains an executable example application for visualizing, debugging and testing the physics engine. This project depends on the engine, graphics and physics project. Every project, including the physics project depends on util.
  • The tests project contains an executable with unit test for the physics engine.
  • The benchmarks project contains an executable with benchmarks to evaluate the physics engine's performance.
  • examples contains minimal examples on how to use the library. These include a bare bones graphics implementation.

Dependencies

Application & engine & graphics

  • GLFW Verified working with GLFW 3.2.1
  • GLEW Verified with GLEW 2.1.0
  • stb_image Verified with stb_image.h v2.22
  • FreeType Verified with FreeType v2.9.0
  • Dear ImGui Verified with ImGui v1.77. Make sure to grab the files from the experimental docking branch.
  • some OpenGL functionality may not be available on virtual machines, enabling 3D acceleration might solve this

Setup Guide

CMake

If you suddenly can't build the project anymore after pulling, perhaps one of the dependencies has changed. Try running install/clean.sh (Unix) or install/clean.bat (Windows) and rerun the setup script in the steps below.

If you still have build problems, please create an issue as we want setting up to be as easy as possible.

Platform independent using vcpkg

  1. Clone the repository
  2. If you do not have cmake already: download it from cmake.org/download/
  3. Run install/setup.sh (Unix) or install/setup.bat (Windows) from the Physics3D directory, this will install the necessary dependencies using vcpkg and create the build folders. It will also run cmake for debug and release. The dependencies can be installed on their own with install/setupDependencies.sh (Unix) or install/setupDependencies.bat (Windows) The build directories can be generated on their own with install/setupBuild.sh (Unix) or install/setupBuild.bat (Windows)
  4. Make the build from the build directory cd build with cmake --build .. To speed up the build, multithreaded building can be enabled by addding --parallel or -- -j 5 to the end of the build command.
  5. To run the application, you must also run it from the build directory: cd build Debug\.\application. Tests and benchmarks can be run from anywhere.

Ubuntu specific using apt-get

If you are using Ubuntu, we recommend using this installation method instead, as setting up using vcpkg can take a very long time. This method should get you a working version of the engine starting from a clean Ubuntu 18.04.

  1. Clone the repository
  2. Run install/setupUbuntu.sh from the Physics3D directory, this will install the necessary dependencies and create the build folders. It will also run cmake for debug and release. The dependencies can be installed on their own with install/setupDependenciesUbuntu.sh The build directories can be generated on their own with install/setupBuildUbuntu.sh
  3. Make the build from the build directory cd build with cmake --build .. To speed up the build, multithreaded building can be enabled by addding --parallel or -- -j 5 to the end of the build command.
  4. To run the application, you must also run it from the build directory: ./application. Tests and benchmarks can be run from anywhere.

Visual Studio

  1. Clone the repository
  2. The physics project on its own does not depend on any libraries, so if you wish to only build it then you may skip step 3.
  3. Download the dependencies, the Visual Studio configuration expects the libraries to be stored in Physics3D/lib/, includes should be stored in Physics3D/include/, with Physics3D/ the root folder of the git project. Your project structure should look like this:
    Physics3D/
    | - include/
    | | - freetype/
    | | | - (freetype headers)
    | | - GL
    | | | - (glew headers)
    | | - GLFW/
    | | | - (glfw3 headers)
    | | - imgui/
    | | | - imconfig.h
    | | | - imgui.h & .cpp
    | | | - imgui_draw.h
    | | | - imgui_internal.h
    | | | - imgui_widgets.cpp
    | | | - imgui_rectpack.h
    | | | - imgui_textedit.h
    | | | - imgui_truetype.h
    | | | - imgui_impl_glfw.h & .cpp
    | | | - imgui_impl_opengl3.h & .cpp
    | | - stb_image.h
    | | - ft2build.h
    | - lib/
    | | - freetype.lib
    | | - glew32.lib
    | | - glew32s.lib
    | | - glfw3.lib
    | - (Project and other files)
  4. The configuration should already be configured in the provided project and solution files
  5. You are done!

Authors

This list is inconclusive as new contributors are always welcome!

License

This project is licensed under the MIT License - see the LICENSE.md file for details

physics3d's People

Contributors

majidabdelilah avatar olympus112 avatar owl66 avatar vontum avatar wulcat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

physics3d's Issues

Visual Studio Project Build Fail

Installed packages from vcpkg like glfw.h are not referenced in Visual Studio Project. Hence the build is failing using current .sln.

To reproduce-

  1. Clone the project
  2. Run installation setups from the Readme.md
  3. Run command./vcpkg integrate install
  4. Reopen project sln in Visual Studio 2019
  5. Build x86 Debug

Few errors for missing headers

  • Error C1083 Cannot open include file: 'core.h': No such file or directory application Physics3D\application\picker\ray.cpp
  • Error (active) E1696 cannot open source file "GLFW/glfw3.h" graphics Physics3D\include\imgui\imgui_impl_glfw.cpp

Please support MSYS2 MINGW64

Currently the project depends on vcpkg, the dependencies instead of being fetched by vcpkg could be fetched using cmake.

Build fail on Zorin OS [`explicit specialization in non-namespace scope`]

Describe the bug
I'm trying to build the application demo on Zorin. After executing the setup shell script, I tried to build using make -j, but I get these errors related to the ECS:

In file included from /home/mm/Desktop/Physics3D/benchmarks/ecsBenchmark.cpp:2:
/home/mm/Desktop/Physics3D/benchmarks/../engine/ecs/registry.h:207:13: error: explicit specialization in non-namespace scope ‘struct P3D::Engine::Registry<Entity>::only<Component>’
  207 |   template <>
      |             ^

Any ideas how to fix this?

To Reproduce
Steps to reproduce the behavior:

  1. git clone recursive
  2. follow build instructions here
  3. enter build folder and run make -j
  4. Error

Expected behavior
Expected to build

Screenshots

Additional context
GCC v 9.3.0

can't launch application.exe

in the file tickerthread.h line 19 there is something wrong when launching from Visual Studio
it's killing me, launching the exe either debug/release x64 from folder nothing happens .

link to the error
https://imgur.com/u4yH7Cz

so any help, or should I abandon, struggling.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.