lightwave_3d/lwo2/sub_tags/blocks/
image_texture.rs1use crate::iff::SubChunk;
2use crate::lwo2::sub_tags::blocks::texture_mapping::TextureMapping;
3use crate::lwo2::sub_tags::{ValueEnvelope, VxReference};
4use crate::lwo2::vx;
5use binrw::{binread, NullString};
6
7#[binread]
8#[derive(Debug)]
9pub enum SurfaceBlockImageTextureSubChunk {
10 #[br(magic(b"TMAP"))]
11 TextureMapping(SubChunk<TextureMapping>),
12 #[br(magic(b"PROJ"))]
13 ProjectionMode(SubChunk<ProjectionMode>),
14 #[br(magic(b"AXIS"))]
15 MajorAxis(SubChunk<MajorAxis>),
16 #[br(magic(b"IMAG"))]
17 ImageMap(SubChunk<VxReference>),
18 #[br(magic(b"WRAP"))]
19 ImageWrapOptions(SubChunk<ImageWrapOptions>),
20 #[br(magic(b"WRPW"))]
21 ImageWrapAmountWidth(SubChunk<ImageWrapAmount>),
22 #[br(magic(b"WRPH"))]
23 ImageWrapAmountHeight(SubChunk<ImageWrapAmount>),
24 #[br(magic(b"VMAP"))]
25 UvVertexMap(SubChunk<UvMap>),
26 #[br(magic(b"AAST"))]
27 AntialiasingStrength(SubChunk<AntialiasingStrength>),
28 #[br(magic(b"PIXB"))]
29 PixelBlending(SubChunk<PixelBlending>),
30 #[br(magic(b"STICK"))]
31 StickyProjection(SubChunk<ValueEnvelope>),
32 #[br(magic(b"TAMP"))]
33 TextureAmplitude(SubChunk<ValueEnvelope>),
34}
35
36#[binread]
39#[br(import(_length: u32))]
40#[derive(Debug)]
41pub struct MajorAxis {
42 pub texture_axis: u16,
43}
44
45#[binread]
48#[br(import(_length: u32))]
49#[derive(Debug)]
50pub struct PixelBlending {
51 pub flags: u16,
52}
53
54#[binread]
58#[br(import(_length: u32))]
59#[derive(Debug)]
60pub struct AntialiasingStrength {
61 pub flags: u16,
62 pub strength: f32,
63}
64
65#[binread]
68#[br(import(_length: u32))]
69#[derive(Debug)]
70pub struct UvMap {
71 #[br(align_after = 2)]
72 pub txuv_map_name: NullString,
73}
74
75#[binread]
78#[br(import(_length: u32))]
79#[derive(Debug)]
80pub struct ImageWrapAmount {
81 pub cycles: f32,
82 #[br(parse_with = vx)]
83 pub envelope: u32,
84}
85
86#[binread]
88#[br(import(_length: u32))]
89#[derive(Debug)]
90pub struct ImageWrapOptions {
91 pub width_wrap: ImageWrapType,
92 pub height_wrap: ImageWrapType,
93}
94
95#[binread]
96#[br(repr = u16)]
97#[derive(Debug)]
98pub enum ImageWrapType {
99 Reset = 0,
103 Repeat = 1,
105 Mirror = 2,
107 Edge = 3,
109}
110
111#[binread]
112#[br(repr = u16, import(_length: u32))]
113#[derive(Debug)]
114pub enum ProjectionMode {
115 Planar = 0,
116 Cylindrical = 1,
117 Spherical = 2,
118 Cubic = 3,
119 FrontProjection = 4,
120 UV = 5,
121}