Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/im-rises/physicalengine
Physical Engine written in C++ with GLFW, Glad, OpenGL 3 and Dear ImGui
https://github.com/im-rises/physicalengine
3d-graphics cmake cpp game game-development game-engine glad glfw glm gui imgui opengl particles-simulation
Last synced: 2 months ago
JSON representation
Physical Engine written in C++ with GLFW, Glad, OpenGL 3 and Dear ImGui
- Host: GitHub
- URL: https://github.com/im-rises/physicalengine
- Owner: Im-Rises
- License: mit
- Created: 2022-09-12T12:21:51.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-03T21:49:22.000Z (4 months ago)
- Last Synced: 2024-10-11T22:55:17.553Z (3 months ago)
- Topics: 3d-graphics, cmake, cpp, game, game-development, game-engine, glad, glfw, glm, gui, imgui, opengl, particles-simulation
- Language: C++
- Homepage: https://im-rises.github.io/physical-engine-webgl/
- Size: 5.53 MB
- Stars: 19
- Watchers: 2
- Forks: 4
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PhysicalEngine
## Description
This is a simple physics engine written in C++ using Glad, GLFW, OpenGl3 and Dear ImGui.
It is implemented using Fixed Framerate and Component Oriented Programming.
## ππ [You can test it online here](https://im-rises.github.io/physical-engine-webgl/) ππ
The source code of the WebGL can be found at the following link:
> **Note**
> The project is made as a educational project to learn more about physics and game engine development.## Features
### Physics features
- [x] Basic object types (Sphere, Cube, Cylinder, Plane)
- [x] Particle and Rigid Body Physics
- [x] Collision Detection
- [x] Forces (Gravity, Drag, Spring, Buoyancy)
- [x] Torque forces (Angular Drag, Angular Spring)
- [x] Different types of constraints### User Interface features
- [x] Camera Controls
- [x] GameObjects Inspector
- [x] Scene Hierarchy### Other features
- [x] Basic ECS (Entity Component System)
- [x] Component Oriented Programming
- [x] Fixed Framerate
- [x] GameObject's speed Graph visualization## Images
![RigidBodyImage](https://user-images.githubusercontent.com/59691442/204342827-5407dc9f-c05e-4a26-b513-b37ce5ab7d14.png)
![screenshot2](https://user-images.githubusercontent.com/59691442/206077820-3edaff06-8d5e-4187-a575-251b4acec8d3.png)
## Quickstart
To download the app, you can click one of the icons below (depending on your operating system). You can also click the
release section of the GitHub page.Depending on you `operating system` you will need to install some libs, they are installed differently depending on your
system, please follow one of the section below `Windows` or `Linux` or `MacOs`.> **Warning**
> Be sure to put the `imgui.ini` file in the same folder as the executable.
> You can find it in the `root` of the project. If you don't do this, the UI will not be displayed correctly.### Windows
For Windows users you don't need to install the libs. You can just download the app and run it.
```bash
.\PhysicalEngine.exe
```> **Warning**
> The project is set up to be built using CMake and vc2019 for Windows. If you want to modify the
> compiler for vc2022 or other you will need to change the CMakeLists.txt .lib linking file accordingly to your vc20**
> version.### Linux
For Linux users, you need to install the GLFW lib, to do so type one of the following commands:
```bash
sudo apt-get install libglfw3
```or if you're a developer and want to compile the app, please install this version of GLFW:
```bash
sudo apt-get install libglfw3-dev
```Then you can start by double-clicking the executable of typing the following command next to it:
```bash
./PhysicalEngine
```### MacOs
For macOS users you will need to install Brew, please follow the instruction in the link below:
Once it is installed, you can type the following command to install GLFW.
```bash
brew install glfw
```Then you can start by double-clicking the executable of typing the following command next to it:
```bash
./PhysicalEngine
```## Controls
### Game controls
To modify the speed value, you can use the ImGui window named `Speed handler`.
| Action | Key |
|------------------------|-----|
| Add speed to the left | β |
| Add speed to the right | β |
| Add speed forwardly | β |
| Add speed rearward | β |### User controls
| Action | Key |
|-------------------------------|---------------------------------------|
| Toggle fullscreen | F11 |
| Camera zoom | Mouse wheel |
| Translate camera to the left | Right Mouse Button + Mouse β movement |
| Translate camera to the right | Right Mouse Button + Mouse β movement |
| Translate camera upwards | Right Mouse Button + Mouse β movement |
| Translate camera downwards | Right Mouse Button + Mouse β movement |
| Exit app | ESC |## Project Architecture
~~~
PhysicalEngine
βββ .github
| βββ labels.yml
| βββ release.yml
β βββ workflows
β β |ββ cmake.yml
β β |ββ codeql.yml
β β |ββ cpp-cmake-publish.yml
β β |ββ cpp-linter.yml
β β |ββ dependency-review.yml
β β |ββ flawfinder.yml
β β |ββ greetings.yml
β β |ββ label.yml
β β |ββ msvc.yml
β β |ββ stale.yml
βββ dependencies
| βββ glad
| βββ glfw
| βββ glm
| βββ imgui
| βββ stb
βββ PhysicalEngine
| βββ Contact (Particles)
β β |ββ *
| βββ Force
β β |ββ *
| βββ Octree
β β |ββ *
| βββ RigidbodyContact
β β |ββ *
| βββ Scene
β β |ββ *
| βββ Shader
β β |ββ *
| βββ Utility
β β |ββ *
| βββ CMakeLists.txt
| βββ Game.cpp
| βββ Game.h
| βββ InputManager.cpp
| βββ InputManager.h
| βββ main.cpp
| βββ PhysicalEngineLauncher.cpp
| βββ PhysicalEngineLauncher.h
βββ test
| βββ TestParticle
β β |ββ *
| βββ CMakeLists.txt
| βββ matrix33Test.cpp
| βββ matrix34Test.cpp
| βββ quaternionTest.cpp
| βββ vector3dTest.cpp
βββ .clang-format
βββ .editorconfig
βββ .gitattributes
βββ .gitignore
βββ CMakelists.txt
βββ CMakePresets.json
βββ CMakeSettings.json
βββ imgui.ini
βββ README.md
~~~## Dependencies
- C++ 14
- CMake
- C++ compiler (MSVC, Mingw, ...)
- Glad
- GLFW (3.3.8)
- OpenGl (3.3)
- Dear ImGui (1.88)
- glm (0.9.8.5)## Compilation
To compile the app, the first thing you need to do is install a C++ compiler:
- Visual Studio (MSVC)
- Mingw
- ...You also need to install Cmake:
Once your environment is set up, depending on your operating system you'll need to install some libs before compiling
the project. Refer to the section below `Windows` or `Linux` or `MacOs`.### Windows
Windows users can directly compile the project by typing the following command at the project root folder:
```bash
cmake .
```> **Note**
> If you're using Visual Studio, you can install CMake directly from the IDE (Visual Studio Installer).
> Then you need to open the Project as a CMake Project, not a Visual Studio Project!### Linux
Linux's users need to install some libs before compiling the project:
First thing to do is to install CMake, type the following command to install it.
```bash
sudo apt-get install cmake
```You also need to install the GLFW lib. Type the following command at the project root.
```bash
sudo apt-get install libglfw3-dev
```You are now able to compile the project. Go to the project root and type the following command:
```bash
cmake .
```### MacOs
For macOS user, you should install brew package manager by following the instructions in the link below:
Then type the following command to install cmake:
```bash
brew install cmake
```and this one to install GLFW
```bash
brew install glfw
```You are now able to compile the project. Go to the project root and type the following command:
```bash
cmake .
```## Oriented Components Architecture
Placeholder
## Run tests
A CMake test is set up to directly test the program. You can find it in the `test`folder and start it by typing the
command below at the project root folder.```bash
ctest
```## Github-Actions
[![CodeQL](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/codeql.yml)
[![CMake](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/cmake.yml/badge.svg?branch=main)](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/cmake.yml)
[![Cpp Cmake Publish](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/cpp-cmake-publish.yml/badge.svg?branch=main)](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/cpp-cmake-publish.yml)
[![flawfinder](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/flawfinder.yml/badge.svg?branch=main)](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/flawfinder.yml)
[![Microsoft C++ Code Analysis](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/msvc.yml/badge.svg?branch=main)](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/msvc.yml)
[![cpp-linter](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/cpp-linter.yml/badge.svg?branch=main)](https://github.com/Im-Rises/PhysicalEngine/actions/workflows/cpp-linter.yml)The project is set with a set of different scripts:
- CodeQL: This script is used to check the code for security issues.
- CMake: This script is used to build the project.
- Cpp Cmake Publish: This script is used to publish the project on GitHub.
- Flawfinder: This script is used to check the code for security issues.
- Microsoft C++ Code Analysis: This script is used to check the code for security issues.
- Cpp Linter: This script is used to check the code for security issues.## Documentations
OpenGL:
OpenGL loading library:
GLFW:
Dear ImGui:
GLAD:
GLM:
STB:
ImPlot:
Learn OpenGL:
Developpez Learn OpenGL (Translated in French):
Sphere OpenGL:
unrealistic.dev (Change CMake working directory):
## Contributors
Quentin MOREL:
- @Im-Rises
-Gabriel REBOUL:
- @spiryti
-ClΓ©mence CLAVEL:
- @clemos38
-[![GitHub contributors](https://contrib.rocks/image?repo=Im-Rises/PhysicalEngine)](https://github.com/Im-Rises/PhysicalEngine/graphs/contributors)