rust/mapgen/src/theme.rs
author nemo
Wed, 02 Jan 2019 11:08:26 -0500
changeset 14516 3e6b12d23957
parent 14180 76a52e8149e3
child 14715 946df0bb3b28
permissions -rw-r--r--
heh. apparently pas2c doesn't validate pascal, so I guess we need to dogfood *both*
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
14156
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
     1
use std::{
14169
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
     2
    slice::{
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
     3
        from_raw_parts,
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
     4
        from_raw_parts_mut
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
     5
    },
14156
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
     6
    io,
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
     7
    io::BufReader,
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
     8
    fs::{File, read_dir},
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
     9
    path::Path
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
    10
};
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
    11
use png::{
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
    12
    ColorType,
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
    13
    Decoder,
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
    14
    DecodingError
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
    15
};
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
    16
14165
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    17
use integral_geometry::Size;
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    18
use vec2d::Vec2D;
14156
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
    19
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
    20
pub struct ThemeSprite {
14165
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    21
    pixels: Vec2D<u32>
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    22
}
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    23
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    24
impl ThemeSprite {
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    25
    #[inline]
14180
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    26
    pub fn size(&self) -> Size {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    27
        self.pixels.size()
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    28
    }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    29
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    30
    #[inline]
14165
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    31
    pub fn width(&self) -> usize {
14180
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    32
        self.size().width
14165
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    33
    }
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    34
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    35
    #[inline]
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    36
    pub fn height(&self) -> usize {
14180
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    37
        self.size().height
14165
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    38
    }
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    39
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    40
    #[inline]
14175
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
    41
    pub fn rows(&self) -> impl DoubleEndedIterator<Item = &[u32]> {
14165
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    42
        self.pixels.rows()
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    43
    }
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    44
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    45
    #[inline]
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    46
    pub fn get_row(&self, index: usize) -> &[u32] {
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    47
        &self.pixels[index]
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
    48
    }
14175
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
    49
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
    50
    #[inline]
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
    51
    pub fn get_pixel(&self, x: usize, y: usize) -> u32 {
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
    52
        self.pixels[y][x]
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
    53
    }
14180
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    54
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    55
    pub fn to_transposed(&self) -> ThemeSprite {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    56
        let size = self.size().transpose();
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    57
        let mut pixels = Vec2D::new(size, 0u32);
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    58
        for (y, row) in self.pixels.rows().enumerate() {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    59
            for (x, v) in row.iter().enumerate() {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    60
                pixels[x][y] = *v;
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    61
            }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    62
        }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    63
        ThemeSprite { pixels }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    64
    }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    65
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    66
    pub fn to_tiled(&self) -> TiledSprite {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    67
        let size = self.size();
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    68
        assert!(size.is_power_of_two());
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    69
        let tile_width_shift = size.width.trailing_zeros() as usize + 2;
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    70
        let mut pixels = vec![0u32; size.area()];
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    71
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    72
        for (y, row) in self.pixels.rows().enumerate() {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    73
            for (x, v) in row.iter().enumerate() {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    74
                pixels[get_tiled_index(x, y, tile_width_shift)] = *v;
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    75
            }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    76
        }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    77
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    78
        TiledSprite { tile_width_shift, size, pixels }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    79
    }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    80
}
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    81
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    82
#[inline]
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    83
fn get_tiled_index(x: usize, y: usize, tile_width_shift: usize) -> usize {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    84
    (((y >> 2) << tile_width_shift) + ((x >> 2) << 4)) + ((y & 0b11) << 2) + (x & 0b11)
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    85
}
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    86
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    87
pub struct TiledSprite {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    88
    tile_width_shift: usize,
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    89
    size: Size,
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    90
    pixels: Vec<u32>
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    91
}
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    92
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    93
impl TiledSprite {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    94
    #[inline]
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    95
    pub fn size(&self) -> Size {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    96
        self.size
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    97
    }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    98
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
    99
    #[inline]
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   100
    pub fn width(&self) -> usize {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   101
        self.size().width
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   102
    }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   103
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   104
    #[inline]
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   105
    pub fn height(&self) -> usize {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   106
        self.size().height
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   107
    }
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   108
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   109
    #[inline]
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   110
    pub fn get_pixel(&self, x: usize, y: usize) -> u32 {
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   111
        self.pixels[get_tiled_index(x, y, self.tile_width_shift)]
76a52e8149e3 add some texture transforms
alfadur
parents: 14175
diff changeset
   112
    }
14156
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   113
}
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   114
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   115
pub struct Theme {
14175
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   116
    land_texture: Option<ThemeSprite>,
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   117
    border_texture: Option<ThemeSprite>
14156
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   118
}
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   119
14165
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
   120
impl Theme {
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
   121
    pub fn land_texture(&self) -> Option<&ThemeSprite> {
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
   122
        self.land_texture.as_ref()
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
   123
    }
14175
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   124
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   125
    pub fn border_texture(&self) -> Option<&ThemeSprite> {
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   126
        self.border_texture.as_ref()
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   127
    }
14165
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
   128
}
c24a76f131d6 implement basic land texturing
alfadur
parents: 14161
diff changeset
   129
14169
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   130
#[derive(Debug)]
14156
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   131
pub enum ThemeLoadError {
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   132
    File(io::Error),
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   133
    Decoding(DecodingError),
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   134
    Format(String)
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   135
}
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   136
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   137
impl From<io::Error> for ThemeLoadError {
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   138
    fn from(e: io::Error) -> Self {
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   139
        ThemeLoadError::File(e)
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   140
    }
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   141
}
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   142
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   143
impl From<DecodingError> for ThemeLoadError {
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   144
    fn from(e: DecodingError) -> Self {
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   145
        ThemeLoadError::Decoding(e)
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   146
    }
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   147
}
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   148
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   149
impl Theme {
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   150
    pub fn new() -> Self {
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   151
        Theme {
14175
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   152
            land_texture: None,
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   153
            border_texture: None,
14156
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   154
        }
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   155
    }
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   156
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   157
    pub fn load(path: &Path) -> Result<Theme, ThemeLoadError> {
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   158
        let mut theme = Self::new();
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   159
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   160
        for entry in read_dir(path)? {
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   161
            let file = entry?;
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   162
            if file.file_name() == "LandTex.png" {
14175
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   163
                theme.land_texture = Some(load_sprite(&file.path())?)
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   164
            } else if file.file_name() == "Border.png" {
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   165
                theme.border_texture = Some(load_sprite(&file.path())?)
14156
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   166
            }
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   167
        }
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   168
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   169
        Ok(theme)
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   170
    }
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   171
}
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   172
14175
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   173
fn load_sprite(path: &Path) -> Result<ThemeSprite, ThemeLoadError> {
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   174
    let decoder = Decoder::new(
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   175
        BufReader::new(File::open(path)?));
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   176
    let (info, mut reader) = decoder.read_info()?;
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   177
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   178
    if info.color_type != ColorType::RGBA {
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   179
        return Err(ThemeLoadError::Format(
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   180
            format!("Unexpected format: {:?}", info.color_type)));
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   181
    }
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   182
    let size = Size::new(info.width as usize, info.height as usize);
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   183
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   184
    let mut pixels: Vec2D<u32> = Vec2D::new(size, 0);
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   185
    reader.next_frame(slice_u32_to_u8_mut(pixels.as_mut_slice()))?;
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   186
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   187
    Ok(ThemeSprite { pixels })
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   188
}
a4c1a2d0ac24 implement basic land bordering
alfadur
parents: 14169
diff changeset
   189
14169
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   190
pub fn slice_u32_to_u8(slice_u32: &[u32]) -> &[u8] {
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   191
    unsafe {
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   192
        from_raw_parts::<u8>(
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   193
            slice_u32.as_ptr() as *const u8,
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   194
            slice_u32.len() * 4
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   195
        )
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   196
    }
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   197
}
14156
3c8a33ba06ba start loading theme textures
alfadur
parents:
diff changeset
   198
14169
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   199
pub fn slice_u32_to_u8_mut(slice_u32: &mut [u32]) -> &mut [u8] {
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   200
    unsafe {
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   201
        from_raw_parts_mut::<u8>(
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   202
            slice_u32.as_mut_ptr() as *mut u8,
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   203
            slice_u32.len() * 4
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   204
        )
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   205
    }
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   206
}
1749961647b9 fix texturing and add a theme loading option to land_dump
alfadur
parents: 14165
diff changeset
   207