From 58d17f1b308dece89c133c514c43a291a28a7f16 Mon Sep 17 00:00:00 2001 From: Floogle <18466542+skyfloogle@users.noreply.github.com> Date: Thu, 15 Aug 2024 14:17:48 +0200 Subject: [PATCH] gltf_draw_scene --- gm82gltf.gej | 14 +++++++++++++- gm82gltf.gml | 13 ++++++++++++- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/gm82gltf.gej b/gm82gltf.gej index 3bdb832..8af803f 100644 --- a/gm82gltf.gej +++ b/gm82gltf.gej @@ -844,11 +844,23 @@ "argtypes": null, "returntype": 2 }, + { + "name": "gltf_draw_scene", + "extname": "", + "calltype": 2, + "helpline": "gltf_draw_scene(gltf,scene)", + "hidden": false, + "argtypes": [ + 2, + 2 + ], + "returntype": 2 + }, { "name": "gltf_draw_node", "extname": "", "calltype": 2, - "helpline": "gltf_draw_node(gltf,node_id)", + "helpline": "gltf_draw_node(gltf,node)", "hidden": false, "argtypes": [ 2, diff --git a/gm82gltf.gml b/gm82gltf.gml index dd1129c..fb9cabf 100644 --- a/gm82gltf.gml +++ b/gm82gltf.gml @@ -49,6 +49,7 @@ ///gltf_load(fn) var __i,__j,__k,__gltf,__texfile,__accessor,__type,__usage,__stride; __gltf=__gltf_load(argument0) + if (__gltf<0) return __gltf // load textures __i=0 repeat (gltf_texture_count(__gltf)) { __texfile=string_replace(gltf_texture_type(__gltf,__i),"image/",temp_directory+"\tmp.") @@ -184,8 +185,18 @@ return __ib +#define gltf_draw_scene + ///gltf_draw_scene(gltf,scene) + var __i; + show_debug_message(gltf_scene_node_count(argument0,argument1)) + __i=0 repeat (gltf_scene_node_count(argument0,argument1)) { + gltf_draw_node(argument0,gltf_scene_node(argument0,argument1,__i)) + __i+=1 + } + + #define gltf_draw_node - ///gltf_draw_node(gltf,node_id) + ///gltf_draw_node(gltf,node) var __i,__j,__k,__mesh_id,__cullmode,__unique_mesh_id,__unique_primitive_id,__material,__base_texture_id,__base_texture; __mesh_id=gltf_node_mesh(argument0,argument1)