Change the way entity data is stored

This commit is contained in:
Lol3rrr
2024-09-22 23:19:18 +02:00
parent 8b41ad5108
commit ff8d05b79a
8 changed files with 73 additions and 30 deletions

View File

@@ -268,8 +268,8 @@ impl<'b> crate::bitreader::Bitreader<'b> {
pub fn decode_vector_noscale(&mut self) -> Result<[f32; 3], super::FirstPassError> {
let mut v = [0.0; 3];
for idx in 0..3 {
v[idx] = self.decode_noscale()?;
for item in v.iter_mut() {
*item = self.decode_noscale()?;
}
Ok(v)
}
@@ -343,8 +343,8 @@ impl<'b> crate::bitreader::Bitreader<'b> {
pub fn decode_vector_float_coord(&mut self) -> Result<[f32; 3], super::FirstPassError> {
let mut v = [0.0; 3];
for idx in 0..3 {
v[idx] = self.decode_float_coord()?;
for item in v.iter_mut() {
*item = self.decode_float_coord()?;
}
Ok(v)
}

View File

@@ -54,12 +54,11 @@ impl QuantalizedFloat {
self.high_low_mul = 0.0;
let range = self.high - self.low;
let high: u32;
if self.bit_count == 32 {
high = 0xFFFFFFFE;
let high: u32 = if self.bit_count == 32 {
0xFFFFFFFE
} else {
high = (1 << self.bit_count) - 1;
}
(1 << self.bit_count) - 1
};
let mut high_mul: f32;
// Xd?

View File

@@ -114,7 +114,7 @@ impl PropController {
self.traverse_fields(&mut serializer.fields, serializer.name.clone(), Vec::new())
}
fn traverse_fields(&mut self, fields: &mut Vec<Field>, ser_name: String, path_og: Vec<i32>) {
fn traverse_fields(&mut self, fields: &mut [Field], ser_name: String, path_og: Vec<i32>) {
for (idx, f) in fields.iter_mut().enumerate() {
let mut path = path_og.clone();
path.push(idx as i32);