aboutsummaryrefslogtreecommitdiff
path: root/stockton-levels/src/q3/light_vols.rs
diff options
context:
space:
mode:
authortcmal <me@aria.rip>2024-08-25 17:44:23 +0100
committertcmal <me@aria.rip>2024-08-25 17:44:23 +0100
commit439219e74090c7158f8dbc33fed4107a5eb7c003 (patch)
tree7ba62254b2d888578ff6c1c8de4f0f35c01c75dd /stockton-levels/src/q3/light_vols.rs
parent04f17923d38171f07f72603a54237f20ca3572dd (diff)
refactor(levels): no longer q3 specific
Diffstat (limited to 'stockton-levels/src/q3/light_vols.rs')
-rw-r--r--stockton-levels/src/q3/light_vols.rs39
1 files changed, 0 insertions, 39 deletions
diff --git a/stockton-levels/src/q3/light_vols.rs b/stockton-levels/src/q3/light_vols.rs
deleted file mode 100644
index 46f2557..0000000
--- a/stockton-levels/src/q3/light_vols.rs
+++ /dev/null
@@ -1,39 +0,0 @@
-use std::convert::TryInto;
-
-use super::Q3BspFile;
-use crate::coords::CoordSystem;
-use crate::traits::light_vols::*;
-use crate::types::{ParseError, Result, Rgb};
-
-const VOL_LENGTH: usize = (3 * 2) + 2;
-
-pub fn from_data(data: &[u8]) -> Result<Box<[LightVol]>> {
- if data.len() % VOL_LENGTH != 0 {
- return Err(ParseError::Invalid);
- }
- let length = data.len() / VOL_LENGTH;
-
- let mut vols = Vec::with_capacity(length);
- for n in 0..length {
- let data = &data[n * VOL_LENGTH..(n + 1) * VOL_LENGTH];
- vols.push(LightVol {
- ambient: Rgb::from_slice(&data[0..3]),
- directional: Rgb::from_slice(&data[3..6]),
- dir: data[6..8].try_into().unwrap(),
- });
- }
-
- Ok(vols.into_boxed_slice())
-}
-
-impl<T: CoordSystem> HasLightVols for Q3BspFile<T> {
- type LightVolsIter<'a> = std::slice::Iter<'a, LightVol>;
-
- fn lightvols_iter(&self) -> Self::LightVolsIter<'_> {
- self.light_vols.iter()
- }
-
- fn get_lightvol(&self, index: u32) -> &LightVol {
- &self.light_vols[index as usize]
- }
-}