From: Brendan Hansen Date: Fri, 23 Oct 2020 20:13:39 +0000 (-0500) Subject: many more bodies X-Git-Url: https://git.brendanfh.com/?a=commitdiff_plain;h=901d36cad6e783904a57ea75ea5c1a3af8c144bc;p=csc718.git many more bodies --- diff --git a/src/sim.cpp b/src/sim.cpp index 244442b..c0fb768 100644 --- a/src/sim.cpp +++ b/src/sim.cpp @@ -278,12 +278,10 @@ main(i32 argc, char* argv[]) mat4_ortho(&ortho_mat, 0, 800, 0, 800, 0.0f, 100.0f); GLuint ortho_mat_loc = glGetUniformLocation(program, "u_proj"); - logprint(LOG_LEVEL_INFO, "Projection loc: %d", ortho_mat_loc); glUniformMatrix4fv(ortho_mat_loc, 1, false, (f32 *) ortho_mat); GLuint planet_colors_loc = glGetUniformLocation(program, "u_planet_colors"); - logprint(LOG_LEVEL_INFO, "Planet color loc: %d", planet_colors_loc); - GLfloat planet_colors[16] = { + persist GLfloat planet_colors[16] = { 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f, 1.0f, @@ -294,16 +292,15 @@ main(i32 argc, char* argv[]) auto state = alloc(); // NOTE(Brendan): Need to initialize the array since it does not get constructed because I refuse to use the 'new' keyword. alloc uses malloc under the hood and cannot initialize the result. state->bodies.init(); - state->bodies.ensure_capacity(128); + state->bodies.ensure_capacity(1024); - foreach (i, 0, 128) + foreach (i, 0, 1024) { Body tmp_body; tmp_body.pos = V2f{ randf(0, 800), randf(0, 800) }; tmp_body.vel = V2f{ randf(-50.0f, 50.0f), randf(-50.0f, 50.0f) }; - tmp_body.mass = randf(5.0f, 25.0f); + tmp_body.mass = randf(2.0f, 10.0f); tmp_body.color_idx = rand() % 4; - logprint(LOG_LEVEL_INFO, "Body color idx: %d", tmp_body.color_idx); state->bodies.push(tmp_body); }