Skip to main content

rpfm_lib/files/rigidmodel/materials/
projected_decal_v4.rs

1//---------------------------------------------------------------------------//
2// Copyright (c) 2017-2026 Ismael Gutiérrez González. All rights reserved.
3//
4// This file is part of the Rusted PackFile Manager (RPFM) project,
5// which can be found here: https://github.com/Frodo45127/rpfm.
6//
7// This file is licensed under the MIT license, which can be found here:
8// https://github.com/Frodo45127/rpfm/blob/master/LICENSE.
9//---------------------------------------------------------------------------//
10
11use crate::files::rigidmodel::PADDED_SIZE_64;
12
13use super::*;
14
15//---------------------------------------------------------------------------//
16//                            Implementation
17//---------------------------------------------------------------------------//
18
19impl Material {
20    pub fn read_projected_decal_v4<R: ReadBytes>(data: &mut R) -> Result<Self> {
21        Ok(Self {
22            name: data.read_string_u8_0padded(PADDED_SIZE_64)?,
23            uk_1: data.read_u32()?,
24            uk_2: data.read_u32()?,
25            uk_3: data.read_u32()?,
26            uk_4: data.read_u32()?,
27            uk_5: data.read_u32()?,
28            uk_6: data.read_u32()?,
29            ..Default::default()
30        })
31    }
32
33    pub fn write_projected_decal_v4<W: WriteBytes>(&self, data: &mut W) -> Result<()> {
34        data.write_string_u8_0padded(self.name(), PADDED_SIZE_64, true)?;
35        data.write_u32(*self.uk_1())?;
36        data.write_u32(*self.uk_2())?;
37        data.write_u32(*self.uk_3())?;
38        data.write_u32(*self.uk_4())?;
39        data.write_u32(*self.uk_5())?;
40        data.write_u32(*self.uk_6())?;
41
42        Ok(())
43    }
44}