From 42941b0337a715a0145466ad2e884517b5f49a94 Mon Sep 17 00:00:00 2001 From: Tada Teruki Date: Mon, 2 Sep 2024 14:33:16 +0900 Subject: [PATCH 1/2] =?UTF-8?q?mtl=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB?= =?UTF-8?q?=E3=81=AE=E6=8C=87=E5=AE=9A=E3=81=A8=E3=82=B0=E3=83=AB=E3=83=BC?= =?UTF-8?q?=E3=83=97=E4=BD=9C=E6=88=90=20(#630)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nusamai/src/sink/obj/obj_writer.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/nusamai/src/sink/obj/obj_writer.rs b/nusamai/src/sink/obj/obj_writer.rs index 4d422252..b2f9d3d2 100644 --- a/nusamai/src/sink/obj/obj_writer.rs +++ b/nusamai/src/sink/obj/obj_writer.rs @@ -47,8 +47,10 @@ fn write_obj( mesh_data.push((feature_id, mesh, vertex_offset, uv_offset)); } - let mut obj_writer = BufWriter::new(File::create(&obj_path)?); + + writeln!(obj_writer, "mtllib {}.mtl", file_name)?; + for vertex in &all_vertices { writeln!(obj_writer, "v {} {} {}", vertex[0], vertex[1], vertex[2])?; } @@ -62,7 +64,7 @@ fn write_obj( let mut local_obj = Vec::new(); if is_split { - local_obj.push(format!("o {}", feature_id)); + local_obj.push(format!("g {}", feature_id)); } for (material_key, indices) in &mesh.primitives { From d0014cf0892f128a3a118f75fe662dc0063b84d7 Mon Sep 17 00:00:00 2001 From: Tada Teruki Date: Mon, 2 Sep 2024 15:48:46 +0900 Subject: [PATCH 2/2] =?UTF-8?q?obj:=20o=E3=82=BF=E3=82=B0=E3=81=AE?= =?UTF-8?q?=E8=BF=BD=E5=8A=A0=20(#630)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- nusamai/src/sink/obj/obj_writer.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/nusamai/src/sink/obj/obj_writer.rs b/nusamai/src/sink/obj/obj_writer.rs index b2f9d3d2..b7b0273a 100644 --- a/nusamai/src/sink/obj/obj_writer.rs +++ b/nusamai/src/sink/obj/obj_writer.rs @@ -64,6 +64,7 @@ fn write_obj( let mut local_obj = Vec::new(); if is_split { + local_obj.push(format!("o {}", feature_id)); local_obj.push(format!("g {}", feature_id)); }