quick backup of the finished scene loader before I submit other parts
[demo] / src / main.cc
index 2926420..dc3440d 100644 (file)
@@ -3,6 +3,10 @@
 #include <string.h>
 #include <vector>
 
+#include "object.h"
+#include "mesh.h"
+#include "scene.h"
+
 #include "opengl/opengl.h"
 #include "vulkan/vk.h"
 
@@ -20,6 +24,7 @@ bool use_vulkan;
 GLFWwindow *win;
 
 /* variables */
+static Scene scene;
 
 int main(int argc, char **argv)
 {
@@ -66,6 +71,18 @@ static bool init()
                        return false;
        }
 
+       if(!scene.load("data/spot/spot_control_mesh.obj")) {
+               fprintf(stderr, "Failed to load scene.\n");
+               return false;
+       }
+
+       for(size_t i=0; i<scene.objects.size(); ++i) {
+               printf("object: %d\n", (int)i);
+               printf("mesh: %s\n", scene.objects[i]->mesh->name.c_str());
+               printf("material: %s\n", scene.objects[i]->material->name.c_str());
+               printf("transform:\n");
+               scene.objects[i]->transform.print();
+       }
        return true;
 }