From 6e4c14a3d0f80c960a5bb867e68cbd1f6b253709 Mon Sep 17 00:00:00 2001 From: Romet Tagobert Date: Sun, 26 Nov 2023 20:15:55 +0200 Subject: [PATCH] fix duplicate niplane definition --- src/blocks/ni_main/ni_collision_data.rs | 8 +------- src/blocks/ni_main/ni_texture_effect.rs | 8 +------- src/common/mod.rs | 2 ++ src/common/ni_plane.rs | 9 +++++++++ 4 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 src/common/ni_plane.rs diff --git a/src/blocks/ni_main/ni_collision_data.rs b/src/blocks/ni_main/ni_collision_data.rs index 563de0e..3cb92bb 100644 --- a/src/blocks/ni_main/ni_collision_data.rs +++ b/src/blocks/ni_main/ni_collision_data.rs @@ -1,5 +1,5 @@ use super::ni_collision_object::NiCollisionObject; -use crate::common::Vector3; +use crate::common::{NiPlane, Vector3}; use binrw::{ io::{Read, Seek}, @@ -60,12 +60,6 @@ pub struct CapsuleBV { pub radius: f32, } -#[derive(Debug, PartialEq, BinRead)] -pub struct NiPlane { - pub normal: Vector3, - pub constant: f32, -} - #[derive(Debug, PartialEq, BinRead)] pub struct HalfSpaceBV { pub plane: NiPlane, diff --git a/src/blocks/ni_main/ni_texture_effect.rs b/src/blocks/ni_main/ni_texture_effect.rs index 3f1ebc2..f5d0640 100644 --- a/src/blocks/ni_main/ni_texture_effect.rs +++ b/src/blocks/ni_main/ni_texture_effect.rs @@ -4,7 +4,7 @@ use binrw::{ }; use super::{NiDynamicEffect, TexClampMode, TexFilterMode}; -use crate::common::{BlockRef, Matrix33, Vector3}; +use crate::common::{BlockRef, Matrix33, NiPlane, Vector3}; #[derive(Debug, PartialEq, BinRead)] pub struct NiTextureEffect { @@ -20,12 +20,6 @@ pub struct NiTextureEffect { pub plane: NiPlane, } -#[derive(Debug, PartialEq, BinRead)] -pub struct NiPlane { - pub normal: Vector3, - pub constant: f32, -} - impl NiTextureEffect { pub fn parse(reader: &mut R) -> anyhow::Result { Ok(reader.read_le()?) diff --git a/src/common/mod.rs b/src/common/mod.rs index 064beab..012a8b6 100644 --- a/src/common/mod.rs +++ b/src/common/mod.rs @@ -1,6 +1,7 @@ pub mod color; pub mod key_group; pub mod matrix; +pub mod ni_plane; pub mod quaternion; pub mod refs; pub mod vector; @@ -8,6 +9,7 @@ pub mod vector; pub use color::*; pub use key_group::*; pub use matrix::*; +pub use ni_plane::*; pub use quaternion::*; pub use refs::*; pub use vector::*; diff --git a/src/common/ni_plane.rs b/src/common/ni_plane.rs new file mode 100644 index 0000000..2cb8d9d --- /dev/null +++ b/src/common/ni_plane.rs @@ -0,0 +1,9 @@ +use binrw::BinRead; + +use crate::common::Vector3; + +#[derive(Debug, PartialEq, BinRead)] +pub struct NiPlane { + pub normal: Vector3, + pub constant: f32, +}