This is my personal 3D particles simulator that uses OpenGL and C++. It is a project that I started to learn OpenGL but also to learn more about particles simulation using the Verlet integration.
I also started to develop a version in Rust that has the same functionalities as the C++ version. This version might be easier to compile use and run due to the cargo package manager that provides all the dependencies needed for the project.
First install all the included libraries (glew, stb, glm, glfw). (I will try to make this step easier in the future)
This project was developed using g++ and CMake. To compile it, you need to have CMake and g++ installed on your machine.
then you can compile the project using the following commands :
mkdir bin
mkdir build
cd build
cmake -G "MinGW Makefiles" ..
makeThe executable will be in the bin folder.
MSVC version, (make sure to modify the CMakeLists.txt file to use the correct libraries path in this case, because the libraries are different from the one used in the G++ version) :
mkdir bin
mkdir build
cd build
cmake ..
cmake --build .
cmake --build . --target clean # to clean the buildIf you are not using a Windows machine, it is possible that you encounter some problems with the libraries or other stuff. For the moment i am not working on a compatibility version for Linux or MacOS.
There are multiple ways to run the Rust version of the project. The easiest way is to use the cargo package manager.
cd rust
cargo runThis will compile and run the project. However the default version is not using the optimizations flags. Instead you should use the bench profile to run the optimized version.
cd rust
cargo run --profile benchDue to some specific file management to make the release version deployable, you can't use the cargo package manager to run the release version. Instead you have build it first and then go to the target folder to run the executable.
cd rust
cargo build --release
cd target/release
./ParticlesSimulator.exe- Particles simulation using Verlet integration.
- Collision detection and resolution between particles and the environment.
- Molecules composed of multiple particles.
- Drag and drop particles.
ZQSD: Move the camera. (also works withWASD)E: Move the camera up.A: Move the camera down.Left Click: Drag and drop particles.Right Click: Rotate the camera.Mouse Wheel: Zoom in and out.G: Add particles. (number of particles added can be changed in themain.cpp|main.rsfile, default is 10)T: Attract the particles to the origin of the world.P: Pause the simulation.
--world <world_file> | -w <world_file>: Load a world file at the start of the program.
World Files are simple JSON files that describe the starting environment of the simulation.
There are similar files existing for molecules that can describe the structure of a molecule and its properties.
You can see some basic exemples of those files in the data folder.
...
