mirror of
https://github.com/Theaninova/mhlib.git
synced 2025-12-11 03:56:18 +00:00
pr3d
This commit is contained in:
@@ -1 +1,2 @@
|
||||
pub mod pro;
|
||||
pub mod trk;
|
||||
|
||||
@@ -3,6 +3,7 @@ use binrw::BinRead;
|
||||
use std::fs::File;
|
||||
|
||||
pub mod pro;
|
||||
pub mod trk;
|
||||
|
||||
fn main() {
|
||||
let mut file = File::open(r#"E:\Games\Moorhuhn Kart\data\alk.pro"#).unwrap();
|
||||
|
||||
51
rust/powerrender-3d/src/trk.rs
Normal file
51
rust/powerrender-3d/src/trk.rs
Normal file
@@ -0,0 +1,51 @@
|
||||
use binrw::{binrw, NullString};
|
||||
|
||||
#[binrw]
|
||||
#[br(magic = b"TRK.V07\0")]
|
||||
#[derive(Debug)]
|
||||
pub struct Trk {
|
||||
#[br(temp)]
|
||||
#[bw(calc = chunks.len() as u32)]
|
||||
chunk_count: u32,
|
||||
pub start_chunk: u16,
|
||||
#[br(count = chunk_count)]
|
||||
pub chunks: Vec<Chunk>,
|
||||
#[br(temp)]
|
||||
#[bw(calc = objects.len() as u32)]
|
||||
object_count: u32,
|
||||
#[br(count = object_count)]
|
||||
pub objects: Vec<Object>,
|
||||
#[br(temp)]
|
||||
#[bw(calc = clusters.len() as u32)]
|
||||
cluster_count: u32,
|
||||
#[br(count = cluster_count)]
|
||||
pub clusters: Vec<Cluster>,
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug)]
|
||||
pub struct Chunk {
|
||||
pub id: u16,
|
||||
pub flags: u16,
|
||||
pub bbox: [f32; 4],
|
||||
pub adjacent_chunks: [i16; 4],
|
||||
pub offset: [f32; 4],
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug)]
|
||||
pub struct Object {
|
||||
pub name: NullString,
|
||||
pub position: [f32; 3],
|
||||
}
|
||||
|
||||
#[binrw]
|
||||
#[derive(Debug)]
|
||||
pub struct Cluster {
|
||||
pub name: NullString,
|
||||
#[br(temp)]
|
||||
#[bw(calc = values.len() as u32)]
|
||||
value_count: u32,
|
||||
#[br(count = value_count)]
|
||||
pub values: Vec<[f32; 4]>,
|
||||
}
|
||||
Reference in New Issue
Block a user