1
0
Fork 0
mirror of https://codeberg.org/demostf/parser.git synced 2026-06-04 10:34:11 +02:00

entity reading wip

This commit is contained in:
Robin Appelman 2019-08-26 23:07:14 +02:00
commit e90bc53852
11 changed files with 509 additions and 114 deletions

View file

@ -1,5 +1,6 @@
use bitstream_reader::{BitRead, BitSize};
use serde::{Deserialize, Serialize};
use std::fmt;
#[derive(BitRead, BitSize, Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
pub struct Vector {
@ -8,8 +9,20 @@ pub struct Vector {
pub z: f32,
}
impl fmt::Display for Vector {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({}, {}, {})", self.x, self.y, self.z)
}
}
#[derive(BitRead, BitSize, Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq)]
pub struct VectorXY {
pub x: f32,
pub y: f32,
}
impl fmt::Display for VectorXY {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "({}, {})", self.x, self.y)
}
}