Skip to main content

rpfm_lib/files/rigidmodel/materials/
custom_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 super::*;
12
13//---------------------------------------------------------------------------//
14//                            Implementation
15//---------------------------------------------------------------------------//
16
17/// Custom terrain materials (cliffs and other hand-made terrain pieces): just the path of their texture.
18impl Material {
19    pub fn read_custom_terrain<R: ReadBytes>(data: &mut R, _version: u32) -> Result<Self> {
20        let (name, name_padding) = read_string_0padded_with_tail(data, PADDED_SIZE_256, false)?;
21        Ok(Self {
22            name,
23            name_padding,
24            ..Default::default()
25        })
26    }
27
28    pub fn write_custom_terrain<W: WriteBytes>(&self, data: &mut W, _version: u32) -> Result<()> {
29        write_string_0padded_with_tail(data, &self.name, &self.name_padding, PADDED_SIZE_256, false)
30    }
31}