commonlibsse_ng\re\n/
NiTexture.rs

1use crate::re::BSFixedString::BSFixedString;
2use crate::re::NiObject::{NiObject, NiObjectVtbl};
3use crate::re::offsets_ni_rtti::NiRTTI_NiTexture;
4use crate::re::offsets_rtti::RTTI_NiTexture;
5use crate::re::offsets_vtable::VTABLE_NiTexture;
6use crate::rel::id::VariantID;
7
8use windows::Win32::Graphics::Direct3D11::{ID3D11ShaderResourceView, ID3D11Texture2D};
9
10#[repr(C)]
11#[derive(Debug)]
12pub struct NiTexture {
13    pub __base: NiObject,         // 0x00
14    pub formatPrefs: FormatPrefs, // 0x10
15    pub name: BSFixedString,      // 0x20
16    pub unk28: u32,               // 0x28
17    pub unk2C: u32,               // 0x2C
18    pub prev: *mut NiTexture,     // 0x30
19    pub next: *mut NiTexture,     // 0x38
20}
21const _: () = assert!(core::mem::size_of::<NiTexture>() == 0x40);
22
23impl NiTexture {
24    pub const RTTI: VariantID = RTTI_NiTexture;
25    pub const NI_RTTI: VariantID = NiRTTI_NiTexture;
26    pub const VTABLE: [VariantID; 1] = VTABLE_NiTexture;
27}
28
29#[repr(C)]
30#[derive(Debug)]
31pub struct FormatPrefs {
32    pub pixelLayout: PixelLayout, // 00
33    pub alphaFormat: AlphaFormat, // 04
34    pub mipMapped: MipFlag,       // 08
35    pub pad0C: u32,               // 0C
36}
37const _: () = assert!(core::mem::size_of::<FormatPrefs>() == 0x10);
38
39#[repr(u32)]
40#[derive(Debug, Clone, Copy)]
41pub enum PixelLayout {
42    Palettized8 = 0,
43    HighColor16,
44    TrueColor32,
45    Compressed,
46    Bumpmap,
47    Palettized4,
48    Default,
49    SingleColor8,
50    SingleColor16,
51    SingleColor32,
52    DoubleColor32,
53    DoubleColor64,
54    FloatColor32,
55    FloatColor64,
56    FloatColor128,
57}
58
59#[repr(u32)]
60#[derive(Debug, Clone, Copy)]
61pub enum AlphaFormat {
62    None = 0,
63    Binary,
64    Smooth,
65    Default,
66}
67
68#[repr(u32)]
69#[derive(Debug, Clone, Copy)]
70pub enum MipFlag {
71    No = 0,
72    Yes = 1,
73    Default = 2,
74}
75
76#[repr(C)]
77#[derive(Debug)]
78pub struct RendererData {
79    pub texture: *mut ID3D11Texture2D,               // 00
80    pub unk08: u64,                                  // 08
81    pub resourceView: *mut ID3D11ShaderResourceView, // 10
82    pub width: u16,                                  // 18
83    pub height: u16,                                 // 1A
84    pub unk1C: u8,                                   // 1C
85    pub unk1D: u8,                                   // 1D
86    pub unk1E: u16,                                  // 1E
87    pub unk20: u32,                                  // 20
88    pub unk24: u32,                                  // 24
89}
90const _: () = assert!(core::mem::size_of::<RendererData>() == 0x28);
91
92#[repr(C)]
93pub struct NiTextureVtbl {
94    pub __base: NiObjectVtbl,
95
96    pub Unk25: extern "C" fn(this: *const NiTexture) -> u32, // 25
97    pub Unk26: extern "C" fn(this: *const NiTexture) -> u32, // 26
98    pub Unk27: extern "C" fn(this: *const NiTexture) -> *const u8, // 27 - returns C-string?
99    pub Unk28: extern "C" fn(this: *const NiTexture),        // 28
100    pub Unk29: extern "C" fn(this: *const NiTexture) -> u32, // 29
101    pub Unk2A: extern "C" fn(this: *const NiTexture) -> u32, // 2A
102}