moving changes to laptop
authorBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 19 Oct 2020 20:04:11 +0000 (15:04 -0500)
committerBrendan Hansen <brendan.f.hansen@gmail.com>
Mon, 19 Oct 2020 20:04:11 +0000 (15:04 -0500)
src/sim.cpp
src/vecmath.cpp

index 769b65d5c8efc75852dc94ce7f6f870a33e1b618..018fba650afc99dc07d647ec0135ae9cc37e4140 100644 (file)
@@ -98,7 +98,8 @@ load_shader(GLenum shader_type, const char* shader_loc)
     
     GLint successful;
     glGetShaderiv(shader, GL_COMPILE_STATUS, &successful);
-    if (successful != GL_TRUE) {
+    if (successful != GL_TRUE)
+    {
         GLsizei log_length = 0;
         GLchar shader_log[1024];
         glGetShaderInfoLog(shader, 1023, &log_length, shader_log);
@@ -126,7 +127,8 @@ create_program(GLuint vertex_shader, GLuint fragment_shader)
     
     GLint successful;
     glGetProgramiv(program, GL_LINK_STATUS, &successful);
-    if (successful != GL_TRUE) {
+    if (successful != GL_TRUE)
+    {
         GLsizei log_length = 0;
         GLchar program_log[1024];
         glGetProgramInfoLog(program, 1023, &log_length, program_log);
@@ -157,7 +159,8 @@ create_circle_mesh()
     glBindVertexArray(vao);
     
     V2f circle_points[CIRCLE_POINT_COUNT] = {};
-    foreach (i, 0, CIRCLE_POINT_COUNT) {
+    foreach (i, 0, CIRCLE_POINT_COUNT)
+    {
         f32 t = (f32) i / (f32) CIRCLE_POINT_COUNT;
         circle_points[i].x = cos(t * 2 * PI) * 40.0f + 400.0f;
         circle_points[i].y = sin(t * 2 * PI) * 40.0f + 200.0f;
@@ -186,6 +189,7 @@ create_circle_mesh()
 
 
 
+
 // NOTE(Brendan): dt is expected to be in units of "per second".
 internal void
 update(f64 dt)
@@ -213,14 +217,16 @@ loop()
     f64 curr_time = last_time;
     f64 delta;
     
-    while (!glfwWindowShouldClose(window)) {
+    while (!glfwWindowShouldClose(window))
+    {
         glfwPollEvents();
         
         curr_time = glfwGetTime();
         delta = curr_time - last_time;
         last_time = curr_time;
         
-        if (delta > 0.0) {
+        if (delta > 0.0)
+        {
             update(delta);
             draw();
         }
index 4d653be1148a468368643e7ce2947b5b0bb2015e..2315d49e607867bf5f0aae68513c97d194d1b724 100644 (file)
@@ -87,13 +87,10 @@ mat4_ortho(mat4 *mat,
 void
 mat4_mul(mat4 a, mat4 b, mat4* out)
 {
-    foreach(row, 0, 4) {
-        foreach(col, 0, 4) {
-            (*out)[row * 4 + col] = 0.0f;
-            
-            foreach(i, 0, 4) {
-                (*out)[row * 4 + col] += a[row * 4 + i] * b[i * 4 + col];
-            }
-        }
+    foreach(row, 0, 4) foreach(col, 0, 4)
+    {
+        (*out)[row * 4 + col] = 0.0f;
+        
+        foreach(i, 0, 4) (*out)[row * 4 + col] += a[row * 4 + i] * b[i * 4 + col];
     }
 }