taurreco 2 years ago
parent
commit
2cdd1979fe
2 changed files with 44 additions and 5 deletions
  1. 41 0
      examples/assets/trailer.obj
  2. 3 5
      examples/bunny.c

+ 41 - 0
examples/assets/trailer.obj

@@ -0,0 +1,41 @@
+# This is a comment
+
+# Define the vertices of the cat
+v -1.0 0.0 0.0
+v 0.0 0.0 0.0
+v 1.0 0.0 0.0
+v 0.0 1.0 0.0
+v 0.0 0.0 1.0
+v -0.5 0.5 0.0
+v 0.5 0.5 0.0
+v 0.5 -0.5 0.0
+v -0.5 -0.5 0.0
+v 0.0 0.5 0.5
+v 0.0 -0.5 0.5
+v 0.0 -0.5 -0.5
+
+# Define the faces of the cat
+f 1 2 3
+f 4 5 6
+f 7 8 9
+f 10 11 12
+f 1 2 6
+f 1 6 5
+f 1 5 4
+f 2 3 9
+f 2 9 8
+f 2 8 6
+f 3 1 12
+f 3 12 11
+f 3 11 9
+f 4 5 10
+f 4 10 12
+f 5 6 8
+f 5 8 10
+f 6 7 11
+f 6 11 10
+f 7 8 9
+f 7 9 11
+f 8 9 10
+f 8 10 11
+

+ 3 - 5
examples/bunny.c

@@ -41,7 +41,7 @@ start()
  *                                                                   *
  *********************************************************************/
 
-    float light_dir[3] = {0.5, 0, -1};
+    float light_dir[3] = {0, -1, 0};
     float light_color[4] = {1, 1, 1, 1};
     float light_attn_const = 0.8;
     float light_attn_lin = 0.2;
@@ -106,11 +106,9 @@ start()
     sr_matrix_mode(SR_PROJECTION_MATRIX);
     sr_perspective(1, (float)SCREEN_WIDTH / (float)SCREEN_HEIGHT, 2, 1000);
     sr_matrix_mode(SR_VIEW_MATRIX);
-    sr_look_at(0, 6, 11, -3, 0, 0, 0, 1, 0);
+    sr_look_at(0, 1, 3, 0, 0, 0, 0, 1, 0);
     sr_matrix_mode(SR_MODEL_MATRIX);
-    sr_scale(0.5, 2, 1.3);
-    sr_translate(-3, 0, 0);
-    sr_rotate_z(0.6);
+    sr_scale(0.3, 0.3, 0.3);
 }
 
 /*********************************************************************