pub struct Material { /* private fields */ }Expand description
Complete material definition with textures, transforms, and shader parameters.
Materials contain all rendering data except geometry. The exact fields present depend on the material type - some types use only a subset of these fields.
§Field Organization
- Identification:
vertex_format,name - Unknown fields:
uk_1throughuk_6(only in certain material types) - Textures:
texture_directory,textureslist - Transforms:
v_pivot,matrix1/2/3, matrix indices - Attachments:
attachment_pointsfor effects/weapons - Shader params:
params_string,params_f32,params_i32,params_vector4df32 - Cloth physics:
uk_7,uk_8,uk_9(cloth materials only)
§Matrix Storage
3x4 matrices are stored in the same format as skeleton bind pose matrices.
The implicit fourth row [0, 0, 0, 1] must be added when converting to 4x4.
Implementations§
Source§impl Material
impl Material
pub fn read_alpha_blend<R: ReadBytes>( data: &mut R, version: u32, ) -> Result<Self>
pub fn write_alpha_blend<W: WriteBytes>( &self, data: &mut W, version: u32, ) -> Result<()>
Source§impl Material
impl Material
pub fn read_cloth<R: ReadBytes>(data: &mut R, version: u32) -> Result<Self>
pub fn write_cloth<W: WriteBytes>( &self, buffer: &mut W, version: u32, ) -> Result<()>
Source§impl Material
Collision shape materials: the default material, followed by the sphere around the shape.
impl Material
Collision shape materials: the default material, followed by the sphere around the shape.
pub fn read_collision_shape<R: ReadBytes>( data: &mut R, version: u32, ) -> Result<Self>
pub fn write_collision_shape<W: WriteBytes>( &self, data: &mut W, version: u32, ) -> Result<()>
Source§impl Material
Custom terrain materials (cliffs and other hand-made terrain pieces): just the path of their texture.
impl Material
Custom terrain materials (cliffs and other hand-made terrain pieces): just the path of their texture.
pub fn read_custom_terrain<R: ReadBytes>( data: &mut R, _version: u32, ) -> Result<Self>
pub fn write_custom_terrain<W: WriteBytes>( &self, data: &mut W, _version: u32, ) -> Result<()>
Source§impl Material
impl Material
pub fn read_default<R: ReadBytes>(data: &mut R, version: u32) -> Result<Self>
pub fn write_default<W: WriteBytes>( &self, buffer: &mut W, version: u32, ) -> Result<()>
Source§impl Material
impl Material
pub fn read_rs_terrain<R: ReadBytes>(data: &mut R, version: u32) -> Result<Self>
pub fn write_rs_terrain<W: WriteBytes>( &self, data: &mut W, version: u32, ) -> Result<()>
Source§impl Material
Rope materials of version 6 RigidModels: the default material, followed by the rope as a chain of nodes.
impl Material
Rope materials of version 6 RigidModels: the default material, followed by the rope as a chain of nodes.
There’s one link fewer than nodes, and the file doesn’t store their count.
Source§impl Material
impl Material
pub fn read_rs_river<R: ReadBytes>(_data: &mut R, _version: u32) -> Result<Self>
pub fn write_rs_river<W: WriteBytes>( &self, _data: &mut W, _version: u32, ) -> Result<()>
Source§impl Material
Static point light materials: the name of the light, and its position in v_pivot.
impl Material
Static point light materials: the name of the light, and its position in v_pivot.
pub fn read_static_point_light<R: ReadBytes>( data: &mut R, version: u32, ) -> Result<Self>
pub fn write_static_point_light<W: WriteBytes>( &self, data: &mut W, version: u32, ) -> Result<()>
Source§impl Material
Texture combo materials: a name and a texture directory.
impl Material
Texture combo materials: a name and a texture directory.
pub fn read_texture_combo<R: ReadBytes>( data: &mut R, version: u32, ) -> Result<Self>
pub fn write_texture_combo<W: WriteBytes>( &self, data: &mut W, version: u32, ) -> Result<()>
Source§impl Material
Materials of type 27: the strings of the default material.
impl Material
Materials of type 27: the strings of the default material.
pub fn read_uk_27<R: ReadBytes>(data: &mut R, version: u32) -> Result<Self>
pub fn write_uk_27<W: WriteBytes>( &self, data: &mut W, version: u32, ) -> Result<()>
Source§impl Material
Materials of types 54, 56 and 57: the strings of the default material, its pivot and its matrix index, with no vertex format.
Types 56 and 57 have a second name, after the first one.
impl Material
Materials of types 54, 56 and 57: the strings of the default material, its pivot and its matrix index, with no vertex format. Types 56 and 57 have a second name, after the first one.
pub fn read_uk_54<R: ReadBytes>( data: &mut R, version: u32, mtype: MaterialType, ) -> Result<Self>
pub fn write_uk_54<W: WriteBytes>( &self, data: &mut W, version: u32, mtype: MaterialType, ) -> Result<()>
Source§impl Material
Weighted cloth materials of version 6 RigidModels: the default material, followed by the bones of the cloth simulation.
impl Material
Weighted cloth materials of version 6 RigidModels: the default material, followed by the bones of the cloth simulation.
pub fn read_weighted_cloth<R: ReadBytes>( data: &mut R, version: u32, ) -> Result<Self>
pub fn write_weighted_cloth<W: WriteBytes>( &self, buffer: &mut W, version: u32, ) -> Result<()>
Source§impl Material
Projected decal materials of version 6 RigidModels: the decal’s texture path, a flag, and since ProjectedDecalV2,
the box the decal is projected in.
impl Material
Projected decal materials of version 6 RigidModels: the decal’s texture path, a flag, and since ProjectedDecalV2,
the box the decal is projected in.
pub fn read_projected_decal<R: ReadBytes>( data: &mut R, version: u32, mtype: MaterialType, ) -> Result<Self>
pub fn write_projected_decal<W: WriteBytes>( &self, data: &mut W, version: u32, mtype: MaterialType, ) -> Result<()>
Source§impl Material
impl Material
pub fn read_projected_decal_v4<R: ReadBytes>( data: &mut R, version: u32, ) -> Result<Self>
pub fn write_projected_decal_v4<W: WriteBytes>( &self, data: &mut W, version: u32, ) -> Result<()>
Source§impl Material
impl Material
pub fn read_weighted_texture_blend<R: ReadBytes>( data: &mut R, version: u32, ) -> Result<Self>
pub fn write_weighted_texture_blend<W: WriteBytes>( &self, data: &mut W, version: u32, ) -> Result<()>
Source§impl Material
impl Material
Sourcepub fn vertex_format(&self) -> &VertexFormat
pub fn vertex_format(&self) -> &VertexFormat
Vertex format determining vertex data layout.
Sourcepub fn name2(&self) -> &String
pub fn name2(&self) -> &String
Second name, only in materials of types 56 and 57: the name of the mesh followed by a suffix, like burning or rain.
Sourcepub fn name_padding(&self) -> &Vec<u8> ⓘ
pub fn name_padding(&self) -> &Vec<u8> ⓘ
Bytes found after the end of name in its padded field, usually leftovers of the program that wrote the file.
They’re kept so the file is written back as it was.
Sourcepub fn texture_directory(&self) -> &String
pub fn texture_directory(&self) -> &String
Directory path for texture files (relative to game data directory).
Sourcepub fn padding_byte0(&self) -> &u8
pub fn padding_byte0(&self) -> &u8
Padding byte 0 (alignment/reserved).
Sourcepub fn padding_byte1(&self) -> &u8
pub fn padding_byte1(&self) -> &u8
Padding byte 1 (alignment/reserved).
Sourcepub fn decal_center(&self) -> &Vector3<f32>
pub fn decal_center(&self) -> &Vector3<f32>
Center of the box a projected decal is projected in.
Sourcepub fn decal_size(&self) -> &Vector3<f32>
pub fn decal_size(&self) -> &Vector3<f32>
Size of the box a projected decal is projected in.
Sourcepub fn sphere_center(&self) -> &Vector3<f32>
pub fn sphere_center(&self) -> &Vector3<f32>
Center of the sphere around a collision shape.
Sourcepub fn sphere_radius(&self) -> &f32
pub fn sphere_radius(&self) -> &f32
Radius of the sphere around a collision shape.
Sourcepub fn cloth_bones(&self) -> &Vec<ClothBone>
pub fn cloth_bones(&self) -> &Vec<ClothBone>
Bones of the cloth simulation of weighted cloth materials.
Sourcepub fn matrix1(&self) -> &Matrix3x4<f32>
pub fn matrix1(&self) -> &Matrix3x4<f32>
Transform matrix 1 (3x4, implicit 4th row: [0, 0, 0, 1]).
Sourcepub fn matrix2(&self) -> &Matrix3x4<f32>
pub fn matrix2(&self) -> &Matrix3x4<f32>
Transform matrix 2 (3x4, implicit 4th row: [0, 0, 0, 1]).
Sourcepub fn matrix3(&self) -> &Matrix3x4<f32>
pub fn matrix3(&self) -> &Matrix3x4<f32>
Transform matrix 3 (3x4, implicit 4th row: [0, 0, 0, 1]).
Sourcepub fn i_matrix_index(&self) -> &i32
pub fn i_matrix_index(&self) -> &i32
Matrix index in hierarchy.
Sourcepub fn i_parent_matrix_index(&self) -> &i32
pub fn i_parent_matrix_index(&self) -> &i32
Parent matrix index for hierarchical transforms.
Sourcepub fn sz_padding(&self) -> &Vec<u8> ⓘ
pub fn sz_padding(&self) -> &Vec<u8> ⓘ
Additional padding bytes (variable length).
Sourcepub fn attachment_points(&self) -> &Vec<AttachmentPointEntry>
pub fn attachment_points(&self) -> &Vec<AttachmentPointEntry>
Named attachment points for weapons, effects, banners, etc.
Sourcepub fn params_string(&self) -> &Vec<(i32, String)>
pub fn params_string(&self) -> &Vec<(i32, String)>
String shader parameters (index, value pairs).
Sourcepub fn params_f32(&self) -> &Vec<(i32, f32)>
pub fn params_f32(&self) -> &Vec<(i32, f32)>
Float shader parameters (index, value pairs).
Sourcepub fn params_i32(&self) -> &Vec<(i32, i32)>
pub fn params_i32(&self) -> &Vec<(i32, i32)>
Integer shader parameters (index, value pairs).
Sourcepub fn params_vector4df32(&self) -> &Vec<(i32, Vector4<f32>)>
pub fn params_vector4df32(&self) -> &Vec<(i32, Vector4<f32>)>
Vector4 shader parameters (index, value pairs).
Sourcepub fn uk_7(&self) -> &Vec<Uk7>
pub fn uk_7(&self) -> &Vec<Uk7>
Cloth physics data section 1 (cloth materials only, format undocumented).
Source§impl Material
impl Material
Sourcepub fn vertex_format_mut(&mut self) -> &mut VertexFormat
pub fn vertex_format_mut(&mut self) -> &mut VertexFormat
Vertex format determining vertex data layout.
Sourcepub fn name2_mut(&mut self) -> &mut String
pub fn name2_mut(&mut self) -> &mut String
Second name, only in materials of types 56 and 57: the name of the mesh followed by a suffix, like burning or rain.
Sourcepub fn name_padding_mut(&mut self) -> &mut Vec<u8> ⓘ
pub fn name_padding_mut(&mut self) -> &mut Vec<u8> ⓘ
Bytes found after the end of name in its padded field, usually leftovers of the program that wrote the file.
They’re kept so the file is written back as it was.
Sourcepub fn uk_1_mut(&mut self) -> &mut u32
pub fn uk_1_mut(&mut self) -> &mut u32
Unknown field 1 (only in RsTerrain and projected decal materials).
Sourcepub fn uk_2_mut(&mut self) -> &mut u32
pub fn uk_2_mut(&mut self) -> &mut u32
Unknown field 2 (only in RsTerrain and projected decal materials).
Sourcepub fn uk_3_mut(&mut self) -> &mut u32
pub fn uk_3_mut(&mut self) -> &mut u32
Unknown field 3 (only in RsTerrain and projected decal materials).
Sourcepub fn uk_4_mut(&mut self) -> &mut u32
pub fn uk_4_mut(&mut self) -> &mut u32
Unknown field 4 (only in RsTerrain and projected decal materials).
Sourcepub fn uk_5_mut(&mut self) -> &mut u32
pub fn uk_5_mut(&mut self) -> &mut u32
Unknown field 5 (only in RsTerrain and projected decal materials).
Sourcepub fn uk_6_mut(&mut self) -> &mut u32
pub fn uk_6_mut(&mut self) -> &mut u32
Unknown field 6 (only in RsTerrain and projected decal materials).
Sourcepub fn texture_directory_mut(&mut self) -> &mut String
pub fn texture_directory_mut(&mut self) -> &mut String
Directory path for texture files (relative to game data directory).
Sourcepub fn filters_mut(&mut self) -> &mut String
pub fn filters_mut(&mut self) -> &mut String
Filter settings (NOT part of file format, runtime-only).
Sourcepub fn padding_byte0_mut(&mut self) -> &mut u8
pub fn padding_byte0_mut(&mut self) -> &mut u8
Padding byte 0 (alignment/reserved).
Sourcepub fn padding_byte1_mut(&mut self) -> &mut u8
pub fn padding_byte1_mut(&mut self) -> &mut u8
Padding byte 1 (alignment/reserved).
Sourcepub fn v_pivot_mut(&mut self) -> &mut Vector3<f32>
pub fn v_pivot_mut(&mut self) -> &mut Vector3<f32>
Pivot point for transformations.
Sourcepub fn decal_center_mut(&mut self) -> &mut Vector3<f32>
pub fn decal_center_mut(&mut self) -> &mut Vector3<f32>
Center of the box a projected decal is projected in.
Sourcepub fn decal_size_mut(&mut self) -> &mut Vector3<f32>
pub fn decal_size_mut(&mut self) -> &mut Vector3<f32>
Size of the box a projected decal is projected in.
Sourcepub fn sphere_center_mut(&mut self) -> &mut Vector3<f32>
pub fn sphere_center_mut(&mut self) -> &mut Vector3<f32>
Center of the sphere around a collision shape.
Sourcepub fn sphere_radius_mut(&mut self) -> &mut f32
pub fn sphere_radius_mut(&mut self) -> &mut f32
Radius of the sphere around a collision shape.
Sourcepub fn cloth_bones_mut(&mut self) -> &mut Vec<ClothBone>
pub fn cloth_bones_mut(&mut self) -> &mut Vec<ClothBone>
Bones of the cloth simulation of weighted cloth materials.
Sourcepub fn matrix1_mut(&mut self) -> &mut Matrix3x4<f32>
pub fn matrix1_mut(&mut self) -> &mut Matrix3x4<f32>
Transform matrix 1 (3x4, implicit 4th row: [0, 0, 0, 1]).
Sourcepub fn matrix2_mut(&mut self) -> &mut Matrix3x4<f32>
pub fn matrix2_mut(&mut self) -> &mut Matrix3x4<f32>
Transform matrix 2 (3x4, implicit 4th row: [0, 0, 0, 1]).
Sourcepub fn matrix3_mut(&mut self) -> &mut Matrix3x4<f32>
pub fn matrix3_mut(&mut self) -> &mut Matrix3x4<f32>
Transform matrix 3 (3x4, implicit 4th row: [0, 0, 0, 1]).
Sourcepub fn i_matrix_index_mut(&mut self) -> &mut i32
pub fn i_matrix_index_mut(&mut self) -> &mut i32
Matrix index in hierarchy.
Sourcepub fn i_parent_matrix_index_mut(&mut self) -> &mut i32
pub fn i_parent_matrix_index_mut(&mut self) -> &mut i32
Parent matrix index for hierarchical transforms.
Sourcepub fn sz_padding_mut(&mut self) -> &mut Vec<u8> ⓘ
pub fn sz_padding_mut(&mut self) -> &mut Vec<u8> ⓘ
Additional padding bytes (variable length).
Sourcepub fn attachment_points_mut(&mut self) -> &mut Vec<AttachmentPointEntry>
pub fn attachment_points_mut(&mut self) -> &mut Vec<AttachmentPointEntry>
Named attachment points for weapons, effects, banners, etc.
Sourcepub fn textures_mut(&mut self) -> &mut Vec<Texture>
pub fn textures_mut(&mut self) -> &mut Vec<Texture>
Texture list with type and path for each texture.
Sourcepub fn params_string_mut(&mut self) -> &mut Vec<(i32, String)>
pub fn params_string_mut(&mut self) -> &mut Vec<(i32, String)>
String shader parameters (index, value pairs).
Sourcepub fn params_f32_mut(&mut self) -> &mut Vec<(i32, f32)>
pub fn params_f32_mut(&mut self) -> &mut Vec<(i32, f32)>
Float shader parameters (index, value pairs).
Sourcepub fn params_i32_mut(&mut self) -> &mut Vec<(i32, i32)>
pub fn params_i32_mut(&mut self) -> &mut Vec<(i32, i32)>
Integer shader parameters (index, value pairs).
Sourcepub fn params_vector4df32_mut(&mut self) -> &mut Vec<(i32, Vector4<f32>)>
pub fn params_vector4df32_mut(&mut self) -> &mut Vec<(i32, Vector4<f32>)>
Vector4 shader parameters (index, value pairs).
Sourcepub fn uk_7_mut(&mut self) -> &mut Vec<Uk7>
pub fn uk_7_mut(&mut self) -> &mut Vec<Uk7>
Cloth physics data section 1 (cloth materials only, format undocumented).
Source§impl Material
impl Material
Sourcepub fn set_vertex_format(&mut self, val: VertexFormat) -> &mut Self
pub fn set_vertex_format(&mut self, val: VertexFormat) -> &mut Self
Vertex format determining vertex data layout.
Sourcepub fn set_name(&mut self, val: String) -> &mut Self
pub fn set_name(&mut self, val: String) -> &mut Self
Material name (human-readable identifier).
Sourcepub fn set_name2(&mut self, val: String) -> &mut Self
pub fn set_name2(&mut self, val: String) -> &mut Self
Second name, only in materials of types 56 and 57: the name of the mesh followed by a suffix, like burning or rain.
Sourcepub fn set_name_padding(&mut self, val: Vec<u8>) -> &mut Self
pub fn set_name_padding(&mut self, val: Vec<u8>) -> &mut Self
Bytes found after the end of name in its padded field, usually leftovers of the program that wrote the file.
They’re kept so the file is written back as it was.
Sourcepub fn set_uk_1(&mut self, val: u32) -> &mut Self
pub fn set_uk_1(&mut self, val: u32) -> &mut Self
Unknown field 1 (only in RsTerrain and projected decal materials).
Sourcepub fn set_uk_2(&mut self, val: u32) -> &mut Self
pub fn set_uk_2(&mut self, val: u32) -> &mut Self
Unknown field 2 (only in RsTerrain and projected decal materials).
Sourcepub fn set_uk_3(&mut self, val: u32) -> &mut Self
pub fn set_uk_3(&mut self, val: u32) -> &mut Self
Unknown field 3 (only in RsTerrain and projected decal materials).
Sourcepub fn set_uk_4(&mut self, val: u32) -> &mut Self
pub fn set_uk_4(&mut self, val: u32) -> &mut Self
Unknown field 4 (only in RsTerrain and projected decal materials).
Sourcepub fn set_uk_5(&mut self, val: u32) -> &mut Self
pub fn set_uk_5(&mut self, val: u32) -> &mut Self
Unknown field 5 (only in RsTerrain and projected decal materials).
Sourcepub fn set_uk_6(&mut self, val: u32) -> &mut Self
pub fn set_uk_6(&mut self, val: u32) -> &mut Self
Unknown field 6 (only in RsTerrain and projected decal materials).
Sourcepub fn set_texture_directory(&mut self, val: String) -> &mut Self
pub fn set_texture_directory(&mut self, val: String) -> &mut Self
Directory path for texture files (relative to game data directory).
Sourcepub fn set_filters(&mut self, val: String) -> &mut Self
pub fn set_filters(&mut self, val: String) -> &mut Self
Filter settings (NOT part of file format, runtime-only).
Sourcepub fn set_padding_byte0(&mut self, val: u8) -> &mut Self
pub fn set_padding_byte0(&mut self, val: u8) -> &mut Self
Padding byte 0 (alignment/reserved).
Sourcepub fn set_padding_byte1(&mut self, val: u8) -> &mut Self
pub fn set_padding_byte1(&mut self, val: u8) -> &mut Self
Padding byte 1 (alignment/reserved).
Sourcepub fn set_v_pivot(&mut self, val: Vector3<f32>) -> &mut Self
pub fn set_v_pivot(&mut self, val: Vector3<f32>) -> &mut Self
Pivot point for transformations.
Sourcepub fn set_decal_center(&mut self, val: Vector3<f32>) -> &mut Self
pub fn set_decal_center(&mut self, val: Vector3<f32>) -> &mut Self
Center of the box a projected decal is projected in.
Sourcepub fn set_decal_size(&mut self, val: Vector3<f32>) -> &mut Self
pub fn set_decal_size(&mut self, val: Vector3<f32>) -> &mut Self
Size of the box a projected decal is projected in.
Sourcepub fn set_sphere_center(&mut self, val: Vector3<f32>) -> &mut Self
pub fn set_sphere_center(&mut self, val: Vector3<f32>) -> &mut Self
Center of the sphere around a collision shape.
Sourcepub fn set_sphere_radius(&mut self, val: f32) -> &mut Self
pub fn set_sphere_radius(&mut self, val: f32) -> &mut Self
Radius of the sphere around a collision shape.
Sourcepub fn set_cloth_bones(&mut self, val: Vec<ClothBone>) -> &mut Self
pub fn set_cloth_bones(&mut self, val: Vec<ClothBone>) -> &mut Self
Bones of the cloth simulation of weighted cloth materials.
Sourcepub fn set_matrix1(&mut self, val: Matrix3x4<f32>) -> &mut Self
pub fn set_matrix1(&mut self, val: Matrix3x4<f32>) -> &mut Self
Transform matrix 1 (3x4, implicit 4th row: [0, 0, 0, 1]).
Sourcepub fn set_matrix2(&mut self, val: Matrix3x4<f32>) -> &mut Self
pub fn set_matrix2(&mut self, val: Matrix3x4<f32>) -> &mut Self
Transform matrix 2 (3x4, implicit 4th row: [0, 0, 0, 1]).
Sourcepub fn set_matrix3(&mut self, val: Matrix3x4<f32>) -> &mut Self
pub fn set_matrix3(&mut self, val: Matrix3x4<f32>) -> &mut Self
Transform matrix 3 (3x4, implicit 4th row: [0, 0, 0, 1]).
Sourcepub fn set_i_matrix_index(&mut self, val: i32) -> &mut Self
pub fn set_i_matrix_index(&mut self, val: i32) -> &mut Self
Matrix index in hierarchy.
Sourcepub fn set_i_parent_matrix_index(&mut self, val: i32) -> &mut Self
pub fn set_i_parent_matrix_index(&mut self, val: i32) -> &mut Self
Parent matrix index for hierarchical transforms.
Sourcepub fn set_sz_padding(&mut self, val: Vec<u8>) -> &mut Self
pub fn set_sz_padding(&mut self, val: Vec<u8>) -> &mut Self
Additional padding bytes (variable length).
Sourcepub fn set_attachment_points(
&mut self,
val: Vec<AttachmentPointEntry>,
) -> &mut Self
pub fn set_attachment_points( &mut self, val: Vec<AttachmentPointEntry>, ) -> &mut Self
Named attachment points for weapons, effects, banners, etc.
Sourcepub fn set_textures(&mut self, val: Vec<Texture>) -> &mut Self
pub fn set_textures(&mut self, val: Vec<Texture>) -> &mut Self
Texture list with type and path for each texture.
Sourcepub fn set_params_string(&mut self, val: Vec<(i32, String)>) -> &mut Self
pub fn set_params_string(&mut self, val: Vec<(i32, String)>) -> &mut Self
String shader parameters (index, value pairs).
Sourcepub fn set_params_f32(&mut self, val: Vec<(i32, f32)>) -> &mut Self
pub fn set_params_f32(&mut self, val: Vec<(i32, f32)>) -> &mut Self
Float shader parameters (index, value pairs).
Sourcepub fn set_params_i32(&mut self, val: Vec<(i32, i32)>) -> &mut Self
pub fn set_params_i32(&mut self, val: Vec<(i32, i32)>) -> &mut Self
Integer shader parameters (index, value pairs).
Sourcepub fn set_params_vector4df32(
&mut self,
val: Vec<(i32, Vector4<f32>)>,
) -> &mut Self
pub fn set_params_vector4df32( &mut self, val: Vec<(i32, Vector4<f32>)>, ) -> &mut Self
Vector4 shader parameters (index, value pairs).
Sourcepub fn set_uk_7(&mut self, val: Vec<Uk7>) -> &mut Self
pub fn set_uk_7(&mut self, val: Vec<Uk7>) -> &mut Self
Cloth physics data section 1 (cloth materials only, format undocumented).
Source§impl Material
impl Material
Sourcepub fn read<R: ReadBytes>(
data: &mut R,
version: u32,
mtype: MaterialType,
) -> Result<Self>
pub fn read<R: ReadBytes>( data: &mut R, version: u32, mtype: MaterialType, ) -> Result<Self>
Reads a material from binary data based on the material type.
Different material types have different binary layouts, which may change between versions of the RigidModel format. This function dispatches to the appropriate reader.
§Errors
Returns RLibError::DecodingRigidModelUnsupportedMaterialType if the
material type is not supported.
Sourcepub fn write<W: WriteBytes>(
&self,
buffer: &mut W,
version: u32,
mtype: MaterialType,
) -> Result<()>
pub fn write<W: WriteBytes>( &self, buffer: &mut W, version: u32, mtype: MaterialType, ) -> Result<()>
Writes a material to binary data based on the material type.
Different material types have different binary layouts, which may change between versions of the RigidModel format. This function dispatches to the appropriate writer.
§Errors
Returns RLibError::DecodingRigidModelUnsupportedMaterialType if the
material type is not supported.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Material
impl<'de> Deserialize<'de> for Material
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Material
Auto Trait Implementations§
impl Freeze for Material
impl RefUnwindSafe for Material
impl Send for Material
impl Sync for Material
impl Unpin for Material
impl UnsafeUnpin for Material
impl UnwindSafe for Material
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().impl<T> Scalar for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.