mirror of
https://codeberg.org/demostf/parser.git
synced 2026-06-04 10:34:11 +02:00
read some common, but rarely important for us, values lazily
This commit is contained in:
parent
3c6d814e9b
commit
5886debbfb
4 changed files with 44 additions and 32 deletions
|
|
@ -1,26 +1,16 @@
|
|||
use bitstream_reader::{BitRead, LittleEndian};
|
||||
use bitstream_reader::{BitRead, LittleEndian, BitSize};
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::{ReadResult, Stream};
|
||||
|
||||
#[derive(Debug, Clone, Copy, Default, Serialize)]
|
||||
#[derive(BitRead, BitSize, Debug, Clone, Copy, Default, Serialize)]
|
||||
pub struct Vector {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
pub z: f32,
|
||||
}
|
||||
|
||||
impl BitRead<LittleEndian> for Vector {
|
||||
fn read(stream: &mut Stream) -> ReadResult<Self> {
|
||||
Ok(Vector {
|
||||
x: stream.read()?,
|
||||
y: stream.read()?,
|
||||
z: stream.read()?,
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(BitRead, Debug, Clone, Copy, Default, Serialize)]
|
||||
#[derive(BitRead, BitSize, Debug, Clone, Copy, Default, Serialize)]
|
||||
pub struct VectorXY {
|
||||
pub x: f32,
|
||||
pub y: f32,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue