StereoKitCTest: actually load file
@@ -12,6 +12,8 @@ using namespace sk;
pose_t picker_win_pose = { {0.5f, 0, -0.5f}, quat_lookat(vec3_zero, {-1,0,1}) };
char *picker_filename = nullptr;
file_filter_t picker_filter[] = { {".glb"}, {".gltf"} };
+model_t model;
+bool model_loaded = false;
///////////////////////////////////////////
@@ -24,6 +26,9 @@ void demo_picker_on_pick(void *, bool32_t confirmed, const char *filename) {
picker_filename = (char*)malloc(sizeof(char)*(strlen(filename)+1));
if (picker_filename != nullptr)
memcpy(picker_filename, filename, strlen(filename)+1);
+
+ model = model_create_file(filename);
+ model_loaded=true;
}
///////////////////////////////////////////
@@ -40,10 +45,16 @@ void demo_picker_update() {
ui_sameline();
if (ui_button("Save") && !platform_file_picker_visible())
platform_file_picker(picker_mode_save, nullptr, demo_picker_on_pick, picker_filter, sizeof(picker_filter) / sizeof(file_filter_t));
+ if (ui_button("Clear")) {
+ model_loaded = false;
+ }
ui_label(picker_filename == nullptr ? " " : picker_filename);
ui_window_end();
+ if (model_loaded) {
+ render_add_model(model,matrix_trs(vec3{0,0.3,0}));
+ }
}
///////////////////////////////////////////
