3 Commits

Author SHA1 Message Date
Benjamin d6cc193e4e Mention Extensions/ source in README.md 2026-06-08 19:08:41 +02:00
Benjamin_Loison fd087469df Add instructions to README.md to build and run the client 2022-11-03 02:43:18 +01:00
Benjamin_Loison 5934f3527a Apply cargo fmt 2022-11-03 02:35:20 +01:00
3 changed files with 31 additions and 36 deletions
+8
View File
@@ -1 +1,9 @@
# LemnosLife Rust # LemnosLife Rust
Download `Extensions/` from [issues/8#issue-732](https://gitea.lemnoslife.com/LemnosLife/LemnosLife_Rust/issues/8#issue-732).
First install [Rust](https://rustup.rs), then build and run the client by executing:
```
cargo run --release
```
+12 -12
View File
@@ -25,7 +25,7 @@ struct PerInstance {
} }
implement_vertex!(PerInstance, w_position, w_rotation); implement_vertex!(PerInstance, w_position, w_rotation);
const STRUCTURES_TEXTURES_NUMBER: usize = 16; //78; const STRUCTURES_TEXTURES_NUMBER: usize = 78;
const STRUCTURES_TEXTURES: [&str; STRUCTURES_TEXTURES_NUMBER] = [ const STRUCTURES_TEXTURES: [&str; STRUCTURES_TEXTURES_NUMBER] = [
"redNoise.jpg", "redNoise.jpg",
"cargoLightBlue.jpg", "cargoLightBlue.jpg",
@@ -43,7 +43,7 @@ const STRUCTURES_TEXTURES: [&str; STRUCTURES_TEXTURES_NUMBER] = [
"30kmh.jpg", "30kmh.jpg",
"white.jpg", "white.jpg",
"blackYellow.jpg", "blackYellow.jpg",
/*"stopText.jpg", "stopText.jpg",
"cargoOrange.jpg", "cargoOrange.jpg",
"redWhite.jpg", "redWhite.jpg",
"grid.png", "grid.png",
@@ -104,7 +104,7 @@ const STRUCTURES_TEXTURES: [&str; STRUCTURES_TEXTURES_NUMBER] = [
"yellowNoise.jpg", "yellowNoise.jpg",
"gridFull.jpg", "gridFull.jpg",
"rust.jpg", "rust.jpg",
"cargo.jpg",*/ "cargo.jpg",
]; ];
// This approach works as there isn't file names having several file extensions. // This approach works as there isn't file names having several file extensions.
@@ -126,7 +126,7 @@ static STRUCTURES_TEXTURES_REVERSED: phf::Map<&'static str, u32> = phf_map! {
"30kmh" => 13, "30kmh" => 13,
"white" => 14, "white" => 14,
"blackYellow" => 15, "blackYellow" => 15,
/*"stopText" => 16, "stopText" => 16,
"cargoOrange" => 17, "cargoOrange" => 17,
"redWhite" => 18, "redWhite" => 18,
"grid" => 19, "grid" => 19,
@@ -187,10 +187,10 @@ static STRUCTURES_TEXTURES_REVERSED: phf::Map<&'static str, u32> = phf_map! {
"yellowNoise" => 74, "yellowNoise" => 74,
"gridFull" => 75, "gridFull" => 75,
"rust" => 76, "rust" => 76,
"cargo" => 77,*/ "cargo" => 77,
}; };
const BIOMES_NUMBER: usize = 16; //19; const BIOMES_NUMBER: usize = 19;
const BIOMES: [&str; BIOMES_NUMBER] = [ const BIOMES: [&str; BIOMES_NUMBER] = [
"dirt", "dirt",
"grassDry", "grassDry",
@@ -208,9 +208,9 @@ const BIOMES: [&str; BIOMES_NUMBER] = [
"mud", "mud",
"stonyThistle", "stonyThistle",
"marsh", "marsh",
/*"dead", "dead",
"desert", "desert",
"weed",*/ "weed",
]; ];
fn main() { fn main() {
@@ -549,9 +549,9 @@ fn main() {
tex13: &ground_textures[13], tex13: &ground_textures[13],
tex14: &ground_textures[14], tex14: &ground_textures[14],
tex15: &ground_textures[15], tex15: &ground_textures[15],
/*tex16: &ground_textures[16], tex16: &ground_textures[16],
tex17: &ground_textures[17], tex17: &ground_textures[17],
tex18: &ground_textures[18],*/ tex18: &ground_textures[18],
}; };
// That way we *load* far too many textures per structure but until haven't treated http://gitea.lemnoslife.com:3006/Benjamin_Loison/LemnosLife_Rust/issues/6#issuecomment-240, can't do better. // That way we *load* far too many textures per structure but until haven't treated http://gitea.lemnoslife.com:3006/Benjamin_Loison/LemnosLife_Rust/issues/6#issuecomment-240, can't do better.
@@ -575,7 +575,7 @@ fn main() {
tex13: &structures_textures[13], tex13: &structures_textures[13],
tex14: &structures_textures[14], tex14: &structures_textures[14],
tex15: &structures_textures[15], tex15: &structures_textures[15],
/*tex16: &structures_textures[16], tex16: &structures_textures[16],
tex17: &structures_textures[17], tex17: &structures_textures[17],
tex18: &structures_textures[18], tex18: &structures_textures[18],
tex19: &structures_textures[19], tex19: &structures_textures[19],
@@ -636,7 +636,7 @@ fn main() {
tex74: &structures_textures[74], tex74: &structures_textures[74],
tex75: &structures_textures[75], tex75: &structures_textures[75],
tex76: &structures_textures[76], tex76: &structures_textures[76],
tex77: &structures_textures[77],*/ tex77: &structures_textures[77],
}; };
// draw parameters // draw parameters
+4 -17
View File
@@ -104,7 +104,6 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
.unwrap() .unwrap()
.replace(ground_folder, "") .replace(ground_folder, "")
.replace(".height", ""); .replace(".height", "");
//for file_name in ["3 13"] {
println!("{}", file_name); println!("{}", file_name);
let file_name_parts: Vec<&str> = file_name.split(' ').collect(); let file_name_parts: Vec<&str> = file_name.split(' ').collect();
@@ -188,9 +187,9 @@ pub fn load_ground(display: &Display) -> VertexBufferAny {
chunk, chunk,
}); });
// i == 250 thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BufferCreationError(OutOfMemory)', src/support/mod.rs:203:10 // i == 250 thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: BufferCreationError(OutOfMemory)', src/support/mod.rs:203:10
if i == 200 { /*if i == 1 {
break; break;
} }*/
} }
println!("charlie"); println!("charlie");
@@ -227,13 +226,7 @@ pub fn load_wavefront(display: &Display, data: &[u8]) -> VertexBufferAny {
let texture_index = if let obj::ObjMaterial::Ref(texture) = let texture_index = if let obj::ObjMaterial::Ref(texture) =
group.material.as_ref().unwrap() group.material.as_ref().unwrap()
{ {
if let Some(texture_index) = STRUCTURES_TEXTURES_REVERSED[texture]
STRUCTURES_TEXTURES_REVERSED.get(texture)
{
*texture_index
} else {
0
}
} else { } else {
panic!() panic!()
}; };
@@ -253,13 +246,7 @@ pub fn load_wavefront(display: &Display, data: &[u8]) -> VertexBufferAny {
let texture_index = if let obj::ObjMaterial::Ref(texture) = let texture_index = if let obj::ObjMaterial::Ref(texture) =
group.material.as_ref().unwrap() group.material.as_ref().unwrap()
{ {
if let Some(texture_index) = STRUCTURES_TEXTURES_REVERSED[texture]
STRUCTURES_TEXTURES_REVERSED.get(texture)
{
*texture_index
} else {
0
}
} else { } else {
panic!() panic!()
}; };