rpfm_lib/files/rigidmodel/materials/rs_terrain.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_rs_terrain<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 ..Default::default()
29 })
30 }
31 pub fn write_rs_terrain<W: WriteBytes>(&self, data: &mut W) -> Result<()> {
32 data.write_string_u8_0padded(self.name(), PADDED_SIZE_64, true)?;
33 data.write_u32(*self.uk_1())?;
34 data.write_u32(*self.uk_2())?;
35 data.write_u32(*self.uk_3())?;
36 data.write_u32(*self.uk_4())?;
37 data.write_u32(*self.uk_5())?;
38
39 Ok(())
40 }
41}