loading all chunks at the same place

This commit is contained in:
2022-10-19 01:50:49 +02:00
parent f9d77ea119
commit 33628ef7bc
2 changed files with 131 additions and 72 deletions
+28 -7
View File
@@ -4,8 +4,8 @@ extern crate glium;
#[macro_use]
extern crate load_file;
use std::io::Cursor;
use glium::texture::SrgbTexture2d;
use std::io::Cursor;
#[allow(unused_imports)]
use glium::{glutin, Surface};
@@ -13,7 +13,27 @@ use glium::{glutin, Surface};
mod support;
const BIOMES_NUMBER: usize = 19;
const BIOMES: [&str; BIOMES_NUMBER] = ["dirt", "grassDry", "grassGreen", "concrete", "soil", "beach", "seabed", "thorn", "wildField", "rock", "grassWild", "stony", "forestPine", "mud", "stonyThistle", "marsh", "dead", "desert", "weed"];
const BIOMES: [&str; BIOMES_NUMBER] = [
"dirt",
"grassDry",
"grassGreen",
"concrete",
"soil",
"beach",
"seabed",
"thorn",
"wildField",
"rock",
"grassWild",
"stony",
"forestPine",
"mud",
"stonyThistle",
"marsh",
"dead",
"desert",
"weed",
];
fn main() {
// building the display, ie. the main object
@@ -28,13 +48,14 @@ fn main() {
let textures: [SrgbTexture2d; BIOMES_NUMBER] = BIOMES.map(|biome| {
println!("{}", biome);
let image = image::load(
Cursor::new(&load_bytes!(
&format!("../Extensions/LemnosLife/Assets/Pictures/Map/Ground/{}.jpg", biome)
)),
Cursor::new(&load_bytes!(&format!(
"../Extensions/LemnosLife/Assets/Pictures/Map/Ground/{}.jpg",
biome
))),
image::ImageFormat::Jpeg,
)
.unwrap()
.to_rgba8();
.unwrap()
.to_rgba8();
let image_dimensions = image.dimensions();
let image =
glium::texture::RawImage2d::from_raw_rgba_reversed(&image.into_raw(), image_dimensions);