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

entity fixes and test

This commit is contained in:
Robin Appelman 2019-08-28 12:44:33 +02:00
commit 0df7d0b394
10 changed files with 626 additions and 46 deletions

View file

@ -2,9 +2,7 @@ use bitstream_reader::{BitRead, BitSize};
use parse_display::Display;
use serde::{Deserialize, Serialize};
#[derive(
BitRead, BitSize, Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Display,
)]
#[derive(BitRead, BitSize, Debug, Clone, Copy, Default, Serialize, Deserialize, Display)]
#[display("({x}, {y}, {z})")]
pub struct Vector {
pub x: f32,
@ -12,11 +10,21 @@ pub struct Vector {
pub z: f32,
}
#[derive(
BitRead, BitSize, Debug, Clone, Copy, Default, Serialize, Deserialize, PartialEq, Display,
)]
impl PartialEq for Vector {
fn eq(&self, other: &Self) -> bool {
(self.x - other.x < 0.001) && (self.y - other.y < 0.001) && (self.z - other.z < 0.001)
}
}
#[derive(BitRead, BitSize, Debug, Clone, Copy, Default, Serialize, Deserialize, Display)]
#[display("({x}, {y})")]
pub struct VectorXY {
pub x: f32,
pub y: f32,
}
impl PartialEq for VectorXY {
fn eq(&self, other: &Self) -> bool {
(self.x - other.x < 0.001) && (self.y - other.y < 0.001)
}
}