1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
use std::io::{self, Read};

pub const INOCHI2D_SPEC_VERSION: &str = "1.0-alpha";

#[inline]
fn read_n<R: Read, const N: usize>(data: &mut R) -> io::Result<[u8; N]> {
	let mut buf = [0_u8; N];
	data.read_exact(&mut buf)?;
	Ok(buf)
}

#[inline]
fn read_u8<R: Read>(data: &mut R) -> io::Result<u8> {
	let buf = read_n::<_, 1>(data)?;
	Ok(u8::from_ne_bytes(buf))
}

#[inline]
fn read_be_u32<R: Read>(data: &mut R) -> io::Result<u32> {
	let buf = read_n::<_, 4>(data)?;
	Ok(u32::from_be_bytes(buf))
}

#[inline]
fn read_vec<R: Read>(data: &mut R, n: usize) -> io::Result<Vec<u8>> {
	let mut buf = vec![0_u8; n];
	data.read_exact(&mut buf)?;
	Ok(buf)
}

pub mod formats;
pub mod math;
pub mod mesh;
pub mod model;
pub mod nodes;
pub mod params;
pub mod physics;
pub mod puppet;
pub mod render;
pub mod texture;