A particle system demo written in C++ and OpenGL.
The API is documented in include/sparkles.h
.
Here's a sample code:
#include "sparkles.h"
using namespace Sparkles;
// Initialization code
Sparkles::initialize();
// Create a particle system.
int particle_count = 100;
ParticleSystem* particle_system = particle_system_create(particle_count);
// Simulation code
for (int i = 0; i < particle_system->count; i += 1) {
Particle* particle = particle_system->particles[i];
// Spawn and simulate particles as you wish.
}
// Render code
RenderState my_render_state = /*...*/;
Mesh* my_mesh = /*...*/;
particle_system_upload_and_render(particle_system, my_mesh, &my_render_state);
Open the example
folder and run build_win32.bat
to build our particle showcase.
You will to run the script from a developer console with Microsoft Build Tools installed. Check this link for reference.
(Right now, we only support Windows).
In order to see the simulation code, take a look at examples\code\sandbox.cpp
. That's where most of the magic happens.
The following samples are located under examples\samples
.
This project is released under the MIT license. See LICENSE for more information.