mirror of
https://github.com/IllusionMan1212/3dobs.git
synced 2026-10-24 10:12:35 +00:00
Add support for importing models via launcher arguments
This commit is contained in:
+13
-1
@@ -1,7 +1,8 @@
|
||||
use glfw::{Action, Context, Key, Modifiers};
|
||||
use glad_gl::gl;
|
||||
use anyhow;
|
||||
|
||||
use std::env;
|
||||
use std::path::PathBuf;
|
||||
use threedobs::{shader, ui::ui, utils};
|
||||
|
||||
fn main() -> anyhow::Result<(), Box<dyn std::error::Error>> {
|
||||
@@ -183,6 +184,17 @@ fn main() -> anyhow::Result<(), Box<dyn std::error::Error>> {
|
||||
|
||||
let scene_fb = create_scene_framebuffer();
|
||||
|
||||
// Import models from launch arguments
|
||||
let args: Vec<String> = env::args().collect();
|
||||
if args.len() > 1 {
|
||||
let paths: Vec<PathBuf> = args
|
||||
.iter()
|
||||
.skip(1)
|
||||
.map(|arg| PathBuf::from(arg))
|
||||
.collect();
|
||||
utils::import_models_from_paths(&paths, &mut state);
|
||||
}
|
||||
|
||||
// main loop
|
||||
while !window.should_close() {
|
||||
let current_frame = glfw.get_time() as f32;
|
||||
|
||||
Reference in New Issue
Block a user