Skip to main content

rpfm_lib/files/rigidmodel/materials/
texture_combo.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 super::*;
12
13//---------------------------------------------------------------------------//
14//                            Implementation
15//---------------------------------------------------------------------------//
16
17/// Texture combo materials: a name and a texture directory.
18impl Material {
19    pub fn read_texture_combo<R: ReadBytes>(data: &mut R, version: u32) -> Result<Self> {
20        Ok(Self {
21            name: read_padded_string(data, version, PADDED_SIZE_32)?,
22            texture_directory: read_padded_string(data, version, PADDED_SIZE_256)?,
23            ..Default::default()
24        })
25    }
26
27    pub fn write_texture_combo<W: WriteBytes>(&self, data: &mut W, version: u32) -> Result<()> {
28        write_padded_string(data, version, &self.name, PADDED_SIZE_32)?;
29        write_padded_string(data, version, &self.texture_directory, PADDED_SIZE_256)
30    }
31}