1
0
Fork 0
mirror of https://codeberg.org/icewind/vbsp.git synced 2026-06-03 18:54:05 +02:00

entity utf8 fixes?

This commit is contained in:
Robin Appelman 2023-12-27 20:12:26 +01:00
commit d11d90c8e6
4 changed files with 16 additions and 2 deletions

2
.gitignore vendored
View file

@ -3,3 +3,5 @@ target
*.obj
result
.direnv
*.log
*.vmf

View file

@ -16,6 +16,13 @@ fn main() -> Result<(), vbsp::BspError> {
}
```
See [vbsp-to-gltf](https://github.com/icewind1991/vbsp-to-gltf) or [vbspviewer](https://github.com/icewind1991/vbspview) for some more examples of how to use the bsp data.
## TODO
- [ ] smooth normals for displacements
- [ ] smooth normals for faces
## Credits
This project is adapted from the [quake bsp parser] and

View file

@ -500,6 +500,10 @@ impl Packfile {
};
result
}
pub fn into_zip(self) -> Mutex<ZipArchive<Cursor<Vec<u8>>>> {
self.zip
}
}
fn try_read_enum<Enum, Reader, Error, ErrorFn>(

View file

@ -28,8 +28,9 @@ impl<'a> LumpReader<Cursor<Cow<'a, [u8]>>> {
impl<R: BinReaderExt + Read> LumpReader<R> {
pub fn read_entities(&mut self) -> BspResult<Entities> {
let mut entities = String::with_capacity(self.length);
self.inner.read_to_string(&mut entities)?;
let mut data: Vec<u8> = Vec::with_capacity(self.length);
self.inner.read_exact(&mut data)?;
let entities = String::from_utf8(data).map_err(|e| StringError::from(e.utf8_error()))?;
Ok(Entities { entities })
}