[StructLayout(LayoutKind.Sequential, Size = 124)]
public struct Material
{
public int material_flags; // 0
public int material_flags_2; // 4
public int diffuseTextureId; // 8
public int detail_texture_index; // 12
public int bumpmap_texture_index; // 16
public int specularTextureId; // 20
public int emissive_texture_index; // 24
public int reflection_texture_index; // 28
public int fresnel_texture_index; // 32
public float4 diffuse; // 36 - 52
public float4 specular; // 52 - 18
public float specular_power; // 68
public float detail_map_scale; // 72
public float bump_map_scale; // 76
public float reflection_scale; // 80
public float precipitation_offset; // 84
public float specular_map_power_scale; // 88
public float specular_bloom_floor; // 92
public float ambient_light_scale; // 96
public int source_blend; // 100
public int destination_blend; // 104
public int alpha_test_function; // 108
public float alpha_test_threshold; // 112
public float final_alpha_multiply; // 116
public float biasZ; // 120
public override string ToString() { return $"Material {{ diffuse[{diffuseTextureId}] {diffuse}, specular[{specularTextureId}] {specular} }}"; }
}
[StructLayout(LayoutKind.Explicit, Size = 16)]
public struct float4
{
[FieldOffset(0)] public float x;
[FieldOffset(4)] public float y;
[FieldOffset(8)] public float z;
[FieldOffset(12)] public float w;
[FieldOffset(0)] public float r;
[FieldOffset(4)] public float g;
[FieldOffset(8)] public float b;
[FieldOffset(12)] public float a;
public override string ToString() { return $"({x}, {y}, {z}, {w})"; }
}