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
2 changed files with 16 additions and 9 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
```
+8 -9
View File
@@ -4,17 +4,17 @@ extern crate glium;
#[macro_use] #[macro_use]
extern crate load_file; extern crate load_file;
use std::f32::consts::PI;
use glium::texture::SrgbTexture2d; use glium::texture::SrgbTexture2d;
use phf::phf_map; use phf::phf_map;
use std::f32::consts::PI;
use std::fs; use std::fs;
use std::io::Cursor; use std::io::Cursor;
use std::time::Instant; use std::time::Instant;
use crate::support::CHUNK_SIZE;
use glium::vertex::VertexBufferAny; use glium::vertex::VertexBufferAny;
#[allow(unused_imports)] #[allow(unused_imports)]
use glium::{glutin, Surface}; use glium::{glutin, Surface};
use crate::support::CHUNK_SIZE;
mod support; mod support;
@@ -433,10 +433,7 @@ fn main() {
let file = file_path.replace(structures_folder, ""); let file = file_path.replace(structures_folder, "");
println!("{}", file); println!("{}", file);
structures_vertex_buffer.push(( structures_vertex_buffer.push((
file file.replace(".obj", "").parse().unwrap(),
.replace(".obj", "")
.parse()
.unwrap(),
support::load_wavefront(&display, load_bytes!(&format!("../{}", file_path))), support::load_wavefront(&display, load_bytes!(&format!("../{}", file_path))),
)) ))
} }
@@ -494,7 +491,8 @@ fn main() {
let file_name = file.replace(".objects", ""); let file_name = file.replace(".objects", "");
let file_name_parts: Vec<&str> = file_name.split(' ').collect(); let file_name_parts: Vec<&str> = file_name.split(' ').collect();
let objects_contents = fs::read_to_string(file_path).unwrap_or_else(|_| panic!("Unable to load {} file!", file_path)); let objects_contents = fs::read_to_string(file_path)
.unwrap_or_else(|_| panic!("Unable to load {} file!", file_path));
let chunk = [0, 1].map(|file_name_parts_index| { let chunk = [0, 1].map(|file_name_parts_index| {
file_name_parts[file_name_parts_index] file_name_parts[file_name_parts_index]
@@ -517,7 +515,8 @@ fn main() {
let y: f32 = object_line_parts[2].parse().unwrap(); let y: f32 = object_line_parts[2].parse().unwrap();
let z = object_line_parts[3].parse().unwrap(); let z = object_line_parts[3].parse().unwrap();
let rotation: f32 = object_line_parts[4].parse().unwrap(); let rotation: f32 = object_line_parts[4].parse().unwrap();
let structure_per_instance: &mut Vec<PerInstance> = structures_per_instance.get_mut(structure_id).unwrap(); let structure_per_instance: &mut Vec<PerInstance> =
structures_per_instance.get_mut(structure_id).unwrap();
structure_per_instance.push(PerInstance { structure_per_instance.push(PerInstance {
w_position: (offset_x + x, z, offset_y + y), w_position: (offset_x + x, z, offset_y + y),
w_rotation: 2.0 * PI * rotation / 360.0, w_rotation: 2.0 * PI * rotation / 360.0,
@@ -654,7 +653,7 @@ fn main() {
let mut structures_params = ground_params.clone(); let mut structures_params = ground_params.clone();
structures_params.blend = glium::draw_parameters::Blend::alpha_blending(); // Could disable per opaque structure to optimize. structures_params.blend = glium::draw_parameters::Blend::alpha_blending(); // Could disable per opaque structure to optimize.
// Doesn't seem to apply transparency from a structure instance to the other. // Doesn't seem to apply transparency from a structure instance to the other.
// drawing a frame // drawing a frame
let start = Instant::now(); let start = Instant::now();