nif/blocks/ni_main/
ni_dither_property.rs

1use super::ni_object_net::NiObjectNET;
2use binrw::{
3    io::{Read, Seek},
4    BinRead, BinReaderExt,
5};
6
7#[derive(Debug, PartialEq, BinRead)]
8pub struct NiDitherProperty {
9    pub base: NiObjectNET,
10    pub flags: DitherFlags,
11}
12
13#[derive(Debug, PartialEq, BinRead)]
14pub enum DitherFlags {
15    #[br(magic = 0u16)]
16    Disabled,
17    #[br(magic = 1u16)]
18    Enabled,
19}
20
21impl NiDitherProperty {
22    pub fn parse<R: Read + Seek>(reader: &mut R) -> anyhow::Result<Self> {
23        Ok(reader.read_le()?)
24    }
25}
26
27impl std::ops::Deref for NiDitherProperty {
28    type Target = NiObjectNET;
29
30    fn deref(&self) -> &Self::Target {
31        &self.base
32    }
33}