This project is a particle system made in C++ using OpenGL and GLFW.
The UI is made using ImGui and allows you to modify some parameters of the particle system and the camera view.
This project has been ported to WebGL
using Emscripten
. You can find the source
code here. The webgl version can be tested at the link below.
ππyou can try the webgl build online by clicking here ππ
Note
This project was made as a learning exercise to learn some OpenGL features.
- Particle system
- ImGui UI
- Camera movement
- Pausing the simulation
- Different settings for the particle system
- Different settings for the camera
Click on the images to watch the video.
- C++ 14
- C++ compiler (MSVC, Mingw, ...)
- CMake
- Glad
- GLFW (3.3.8)
- OpenGl (3.3)
- Dear ImGui (1.88)
- glm (0.9.8.5)
- stb (2.28)
- Description
- Features
- Images and Videos
- Dependencies
- Table of Contents
- Project Architecture
- Quickstart
- Controls
- Compilation
- GitHub-Actions
- Documentation
- Contributors
Click to expand
ParticleSystem
βββ .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
βββ ParticleSystem
| βββ Shader
β β |ββ *
| βββ Texture
β β |ββ *
| βββ Scene
β β |ββ *
| βββ CMakeLists.txt
| βββ InputManager.cpp
| βββ InputManager.h
| βββ main.cpp
| βββ ParticleSystemLauncher.cpp
| βββ ParticleSystemLauncher.h
βββ .clang-format
βββ .clang-tidy
βββ .editorconfig
βββ .gitattributes
βββ .gitignore
βββ CMakelists.txt
βββ CMakePresets.json
βββ CMakeSettings.json
βββ imgui.ini
βββ README.md
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
.
For the compilation, follow the section Compilation
.
The controls are described in the section Controls
.
Warning Be sure to put the
imgui.ini
file in the same folder as the executable. You can find it in theroot
of the project. If you don't do this, the UI will not be displayed correctly.
For Windows users you don't need to install the libs. You can just download the app and run it.
.\ParticleSystem.exe
For Linux users, you need to install the GLFW lib, to do so type one of the following commands:
sudo apt-get install libglfw3
or if you're a developer and want to compile the app, please install this version of GLFW:
sudo apt-get install libglfw3-dev
Then you can start by double-clicking the executable of typing the following command next to it:
./ParticleSystem
For macOS users you will need to install Brew, please follow the instruction in the link below:
https://brew.sh
Once it is installed, you can type the following command to install GLFW.
brew install glfw
Then you can start by double-clicking the executable of typing the following command next to it:
./ParticleSystem
The speed and some parameters can be modified directly in the ImGui windows.
Action | Key |
---|---|
Translate camera | (WASD) or (β β β β) |
Pause/Resume | P |
Move up/down camera | (Space/Shift) or (Page up/down) |
Rotate camera | Right Mouse Button + Mouse movement |
Exit app | Escape |
Note You can the inputs by changing their attribution in the
InputManager.cpp
file, if so you'll need to compile the project.
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:
https://cmake.org
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 users can directly compile the project by typing the following command at the project root folder:
cmake -B . -DCMAKE_BUILD_TYPE=<Debug/Release>
then
cmake --build . --config <Debug/Release>
You need to replace <Debug/Release>
by the build type you want to use.
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!
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'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.
sudo apt-get install cmake
You also need to install the GLFW lib. Type the following command at the project root.
sudo apt-get install libglfw3-dev
You are now able to compile the project. Go to the project root and type the following command:
cmake -B . -DCMAKE_BUILD_TYPE=Release
For macOS user, you should install brew package manager by following the instructions in the link below:
https://brew.sh
Then type the following command to install cmake:
brew install cmake
and this one to install GLFW
brew install glfw
You are now able to compile the project. Go to the project root and type the following command:
cmake -B . -DCMAKE_BUILD_TYPE=Release
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.
glfw:
https://www.glfw.org/docs/latest/
glm:
https://glm.g-truc.net/0.9.9/index.html
glad:
https://glad.dav1d.de/
stb (stb_image):
https://github.com/nothings/stb/blob/master/stb_image.h
Dear imgui:
https://github.com/ocornut/imgui
OpenGL:
https://www.opengl.org/
learnopengl (OpenGL tutorial):
https://learnopengl.com/In-Practice/2D-Game/Particles
opengl-tutorial (OpenGL tutorial):
http://www.opengl-tutorial.org/intermediate-tutorials/billboards-particles/particles-instancing/
3dgep:
https://www.3dgep.com/simulating-particle-effects-using-opengl/
levelup (Particle Generation):
https://levelup.gitconnected.com/how-to-create-instanced-particles-in-opengl-24cb089911e2
unrealistic.dev (Change CMake working directory):
https://unrealistic.dev/posts/setting-debug-parameters-with-cmake-tools-for-visual-studio
Quentin MOREL:
- @Im-Rises
- https://github.com/Im-Rises