lotus_utils_texture/
kind.rs

1use anyhow::Error;
2
3#[derive(Debug, PartialEq, Eq, Clone, Copy)]
4pub enum TextureKind {
5    DiffuseEmissionTint = 0xA3,
6    BillboardSpritemapDiffuse = 0xA4,
7    BillboardSpritemapNormal = 0xA5,
8    Roughness = 0xA7,
9    Skybox = 0xAB,
10    Texture174 = 0xAE, // TODO: Rename to something more descriptive
11    Texture176 = 0xB0, // TODO: Rename to something more descriptive
12    Cubemap = 0xB1,
13    NormalMap = 0xB8,
14    Packmap = 0xBC,
15    Texture194 = 0xC2, // TODO: Rename to something more descriptive
16    DetailsPack = 0xC3,
17}
18
19impl TryFrom<u32> for TextureKind {
20    type Error = Error;
21
22    fn try_from(value: u32) -> Result<Self, Self::Error> {
23        match value {
24            0xA3 => Ok(TextureKind::DiffuseEmissionTint),
25            0xA4 => Ok(TextureKind::BillboardSpritemapDiffuse),
26            0xA5 => Ok(TextureKind::BillboardSpritemapNormal),
27            0xA7 => Ok(TextureKind::Roughness),
28            0xAB => Ok(TextureKind::Skybox),
29            0xAE => Ok(TextureKind::Texture174),
30            0xB0 => Ok(TextureKind::Texture176),
31            0xB1 => Ok(TextureKind::Cubemap),
32            0xB8 => Ok(TextureKind::NormalMap),
33            0xBC => Ok(TextureKind::Packmap),
34            0xC2 => Ok(TextureKind::Texture194),
35            0xC3 => Ok(TextureKind::DetailsPack),
36            _ => Err(Error::msg("Unknown texture kind")),
37        }
38    }
39}