mirror of
https://github.com/PrimeDecomp/retrotool.git
synced 2026-07-12 18:18:58 -07:00
cargo fmt
This commit is contained in:
+23
-14
@@ -46,7 +46,7 @@ pub const K_DCLN_WRITER_VERSION: u32 = 18;
|
||||
pub struct Vertices {
|
||||
pub count: u32,
|
||||
#[br(count = count)]
|
||||
vertices: Vec<CVector3f>
|
||||
vertices: Vec<CVector3f>,
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
@@ -54,7 +54,7 @@ pub struct Vertices {
|
||||
pub struct Materials {
|
||||
pub count: u32,
|
||||
#[br(count = count)]
|
||||
materials: Vec<CCollisionMaterial>
|
||||
materials: Vec<CCollisionMaterial>,
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
@@ -82,7 +82,7 @@ pub struct CIndexedTriangle {
|
||||
pub struct Triangles {
|
||||
count: u32,
|
||||
#[br(count = count)]
|
||||
triangles: Vec<CIndexedTriangle>
|
||||
triangles: Vec<CIndexedTriangle>,
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
@@ -192,7 +192,8 @@ fn convert(args: ConvertArgs) -> Result<()> {
|
||||
if desc.id == K_CHUNK_INFO {
|
||||
//bounds = Some(Cursor::new(data).read_type(Endian::Little)?);
|
||||
//log::debug!("Bounds: {bounds:#?}");
|
||||
} else */ if desc.id == K_CHUNK_VERT {
|
||||
} else */
|
||||
if desc.id == K_CHUNK_VERT {
|
||||
vertices = Some(Cursor::new(data).read_type(Endian::Little)?);
|
||||
log::debug!("Vertices: {vertices:#?}");
|
||||
} else if desc.id == K_CHUNK_MTRL {
|
||||
@@ -202,27 +203,35 @@ fn convert(args: ConvertArgs) -> Result<()> {
|
||||
triangles = Some(Cursor::new(data).read_type(Endian::Little)?);
|
||||
log::debug!("Triangles: {triangles:#?}");
|
||||
} /* else if desc.id == K_CHUNK_TREE {
|
||||
if form_desc.id == K_FORM_CLSN {
|
||||
//aboxtree = Some(Cursor::new(data).read_type(Endian::Little)?);
|
||||
//log::debug!("Tree: {aboxtree:#?}");
|
||||
} else {
|
||||
//oboxtree = Some(Cursor::new(data).read_type(Endian::Little)?);
|
||||
//log::debug!("Tree: {oboxtree:#?}");
|
||||
}
|
||||
} */
|
||||
if form_desc.id == K_FORM_CLSN {
|
||||
//aboxtree = Some(Cursor::new(data).read_type(Endian::Little)?);
|
||||
//log::debug!("Tree: {aboxtree:#?}");
|
||||
} else {
|
||||
//oboxtree = Some(Cursor::new(data).read_type(Endian::Little)?);
|
||||
//log::debug!("Tree: {oboxtree:#?}");
|
||||
}
|
||||
} */
|
||||
col_data = remain;
|
||||
}
|
||||
|
||||
let mut file = File::create(&args.out)?;
|
||||
if let Some(verts) = vertices {
|
||||
let tris = triangles.unwrap();
|
||||
file.write_fmt(format_args!("# Generated by retrotool, {} vertices, {} triangles\n# Vertices\n", verts.count, tris.count))?;
|
||||
file.write_fmt(format_args!(
|
||||
"# Generated by retrotool, {} vertices, {} triangles\n# Vertices\n",
|
||||
verts.count, tris.count
|
||||
))?;
|
||||
for vertex in verts.vertices.iter() {
|
||||
file.write_fmt(format_args!("v {} {} {}\n", vertex.x, vertex.y, vertex.z))?;
|
||||
}
|
||||
file.write_fmt(format_args!("\n# Triangles\n"))?;
|
||||
for triangle in tris.triangles.iter() {
|
||||
file.write_fmt(format_args!("f {} {} {}\n", triangle.idx1 + 1, triangle.idx2 + 1, triangle.idx3 + 1))?;
|
||||
file.write_fmt(format_args!(
|
||||
"f {} {} {}\n",
|
||||
triangle.idx1 + 1,
|
||||
triangle.idx2 + 1,
|
||||
triangle.idx3 + 1
|
||||
))?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
|
||||
Reference in New Issue
Block a user