diff --git a/include/particle.h b/include/particle.h index c5a5d83..0e22ff7 100644 --- a/include/particle.h +++ b/include/particle.h @@ -7,7 +7,7 @@ #include #include -#define G_CONSTANT 0.65f +#define G_CONSTANT 1.98f typedef struct { float x, y, z; @@ -169,8 +169,8 @@ void *t_update(void *args) { p.position.y += p.velocity.y * params->time; p.position.z += p.velocity.z * params->time; - if (p.position.y <= 0) { - p.position.y = 0; + if (p.position.y <= 0 + p.radius) { + p.position.y = 0 + p.radius; p.velocity.y *= (-1 * p.dampening); } diff --git a/psystem b/psystem index c4e8b21..d09cbad 100755 Binary files a/psystem and b/psystem differ diff --git a/source/main.cpp b/source/main.cpp index 416ca54..1eb2eae 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -20,13 +20,13 @@ const char FRAGMENT_SHADER_SOURCE[] = "./source/shader/fragment.glsl"; const char VERTEX_SHADER_SOURCE[] = "./source/shader/vertex.glsl"; const char PROGRAM_NAME[] = "Particle Sim"; -const unsigned int THREAD_COUNT = 8; +const unsigned int THREAD_COUNT = 1; const unsigned int SCR_WIDTH = 1920; const unsigned int SCR_HEIGHT = 1080; const char *glsl_version; -const unsigned int PARTICLE_COUNT = 2000; +const unsigned int PARTICLE_COUNT = 3; GLFWwindow *window; unsigned int VBO, VAO; @@ -220,13 +220,9 @@ int main() { if (particles == NULL) { snprintf(errLog, 128, "There was a issue allocating memory for the particle list\n"); } else { - for (unsigned long long i = 0; i < PARTICLE_COUNT; i++) { - float x = ((float)rand() / RAND_MAX) * 2.0f - 1.0f; // Random x between -1 and 1 - float y = ((float)rand() / RAND_MAX) * 2.0f - 1.0f; // Random y between -1 and 1 - float z = ((float)rand() / RAND_MAX) * 2.0f - 1.0f; // Random z between -1 and 1 - - particles[i] = particle_init({x, 2, z}, {1.0f, 0.5f, 0.2f, 1.0f}); - } + particles[0] = particle_init({1.000001f, 1.0f, 0.97f}, {1.0f, 0.0f, 0.0f, 255.0f}); + particles[1] = particle_init({1.0f, 1.2f, 1.0f}, {0.0f, 1.0f, 0.0f, 255.0f}); + particles[2] = particle_init({0.99995f, 1.4f, 1.004f}, {0.0f, 0.0f, 1.0f, 255.0f}); } float current_time;