diff --git a/src/main.rs b/src/main.rs index 656b002..a92e12d 100644 --- a/src/main.rs +++ b/src/main.rs @@ -141,7 +141,7 @@ fn setup_cars( }); let shapes = models.into_iter().map(|m| { - debug!("{:?}", m); + trace!("{:?}", m); meshes.add(m.bevy_mesh()) }); diff --git a/src/support/brender/material.rs b/src/support/brender/material.rs index 3b83dda..f08c462 100644 --- a/src/support/brender/material.rs +++ b/src/support/brender/material.rs @@ -223,7 +223,7 @@ impl Material { match mat { Err(_) => break, // @fixme allow only Eof here Ok(mat) => { - debug!(".. Loaded {}", mat.material.identifier); + trace!(".. Loaded {}", mat.material.identifier); materials.push(mat) } } diff --git a/src/support/brender/model.rs b/src/support/brender/model.rs index e177631..22abd93 100644 --- a/src/support/brender/model.rs +++ b/src/support/brender/model.rs @@ -206,7 +206,7 @@ impl Model { match m { Err(_) => break, // fixme: allow only Eof here Ok(m) => { - debug!(".. Loaded {}", m.name); + trace!(".. Loaded {}", m.name); models.push(m) } } diff --git a/src/support/brender/pixelmap.rs b/src/support/brender/pixelmap.rs index 46b8941..0693691 100644 --- a/src/support/brender/pixelmap.rs +++ b/src/support/brender/pixelmap.rs @@ -3,7 +3,7 @@ use { crate::support, byteorder::ReadBytesExt, culpa::{throw, throws}, - log::debug, + log::trace, std::io::prelude::BufRead, support::brender::resource::file_type, }; @@ -61,9 +61,15 @@ impl FromStream for PixelMap { pixelmap.origin_x = origin_x; pixelmap.origin_y = origin_y; - debug!( + trace!( "Pixelmap {} (type {}, row_bytes {}, {}x{} origin {}x{})", - identifier, r#type, row_bytes, width, height, origin_x, origin_y + identifier, + r#type, + row_bytes, + width, + height, + origin_x, + origin_y ); } Chunk::Pixels(PixelsChunk { @@ -75,9 +81,10 @@ impl FromStream for PixelMap { pixelmap.unit_bytes = unit_bytes; pixelmap.data = data; - debug!( + trace!( "Pixelmap data in {} units, {} bytes each", - units, unit_bytes + units, + unit_bytes ); } Chunk::AddMap() => {} diff --git a/src/support/brender/resource.rs b/src/support/brender/resource.rs index 5cf157a..d734add 100644 --- a/src/support/brender/resource.rs +++ b/src/support/brender/resource.rs @@ -33,6 +33,60 @@ pub trait FromStreamExt { ) -> Result; } +struct ChunkType(u32); + +impl std::fmt::Display for ChunkType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self.0 { + chunk::END => "END", + chunk::PIXELMAP => "PIXELMAP", + chunk::MATERIAL => "MATERIAL", + chunk::ANIM => "ANIM", + chunk::ANIM_TRANSFORM => "ANIM_TRANSFORM", + chunk::ANIM_RATE => "ANIM_RATE", + chunk::FILE_INFO => "FILE_INFO", + chunk::PIVOT => "PIVOT", + chunk::MATERIAL_INDEX => "MATERIAL_INDEX", + chunk::VERTICES => "VERTICES", + chunk::VERTEX_UV => "VERTEX_UV", + chunk::FACE_MATERIAL => "FACE_MATERIAL", + chunk::COLOUR_MAP_REF => "COLOUR_MAP_REF", + chunk::INDEX_BLEND_REF => "INDEX_BLEND_REF", + chunk::INDEX_SHADE_REF => "INDEX_SHADE_REF", + chunk::SCREENDOOR_REF => "SCREENDOOR_REF", + chunk::PIXELS => "PIXELS", + chunk::ADD_MAP => "ADD_MAP", + chunk::ACTOR => "ACTOR", + chunk::ACTOR_MODEL => "ACTOR_MODEL", + chunk::ACTOR_TRANSFORM => "ACTOR_TRANSFORM", + chunk::ACTOR_MATERIAL => "ACTOR_MATERIAL", + chunk::ACTOR_LIGHT => "ACTOR_LIGHT", + chunk::ACTOR_CAMERA => "ACTOR_CAMERA", + chunk::ACTOR_BOUNDS => "ACTOR_BOUNDS", + chunk::ACTOR_ADD_CHILD => "ACTOR_ADD_CHILD", + chunk::TRANSFORM_MATRIX34 => "TRANSFORM_MATRIX34", + chunk::TRANSFORM_MATRIX34_LP => "TRANSFORM_MATRIX34_LP", + chunk::TRANSFORM_QUAT => "TRANSFORM_QUAT", + chunk::TRANSFORM_EULER => "TRANSFORM_EULER", + chunk::TRANSFORM_LOOK_UP => "TRANSFORM_LOOK_UP", + chunk::TRANSFORM_TRANSLATION => "TRANSFORM_TRANSLATION", + chunk::TRANSFORM_IDENTITY => "TRANSFORM_IDENTITY", + chunk::BOUNDS => "BOUNDS", + chunk::LIGHT => "LIGHT", + chunk::CAMERA => "CAMERA", + chunk::FACES => "FACES", + chunk::MODEL => "MODEL", + chunk::ACTOR_CLIP_PLANE => "ACTOR_CLIP_PLANE", + chunk::PLANE => "PLANE", + _ => "UNKNOWN", + } + ) + } +} + //------------------------------------------------------------------ /// A binary resource file consisting of chunks with specific size. /// Reading from such file yields array of chunk results, some of @@ -50,9 +104,11 @@ impl FromStream for ChunkHeader { fn from_stream(source: &mut R) -> Self::Output { let chunk_type = source.read_u32::()?; let size = source.read_u32::()?; - debug!( - "Loaded chunk type {chunk_type}/0x{:x} size {}", - chunk_type, size + trace!( + "Loaded chunk type {chunk_type}/0x{:x} {} size {}", + chunk_type, + ChunkType(chunk_type), + size ); Self::Output { chunk_type, size } } diff --git a/src/support/render_manager.rs b/src/support/render_manager.rs index a6bd492..1e6e6ec 100644 --- a/src/support/render_manager.rs +++ b/src/support/render_manager.rs @@ -28,12 +28,12 @@ pub struct RenderManager { program: Program, } -fn debug_tree(name: &String, actor_name: &String, stack: &[Matrix4]) { - debug!("{} for {}: stack depth {}", name, actor_name, stack.len()); - for x in stack.iter().rev() { - debug!(".. {:?}", x); - } -} +// fn debug_tree(name: &String, actor_name: &String, stack: &[Matrix4]) { +// debug!("{} for {}: stack depth {}", name, actor_name, stack.len()); +// for x in stack.iter().rev() { +// debug!(".. {:?}", x); +// } +// } // Load VertexBuffer // Load IndexBuffers for each material