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
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
```
+7 -8
View File
@@ -4,17 +4,17 @@ extern crate glium;
#[macro_use]
extern crate load_file;
use std::f32::consts::PI;
use glium::texture::SrgbTexture2d;
use phf::phf_map;
use std::f32::consts::PI;
use std::fs;
use std::io::Cursor;
use std::time::Instant;
use crate::support::CHUNK_SIZE;
use glium::vertex::VertexBufferAny;
#[allow(unused_imports)]
use glium::{glutin, Surface};
use crate::support::CHUNK_SIZE;
mod support;
@@ -433,10 +433,7 @@ fn main() {
let file = file_path.replace(structures_folder, "");
println!("{}", file);
structures_vertex_buffer.push((
file
.replace(".obj", "")
.parse()
.unwrap(),
file.replace(".obj", "").parse().unwrap(),
support::load_wavefront(&display, load_bytes!(&format!("../{}", file_path))),
))
}
@@ -494,7 +491,8 @@ fn main() {
let file_name = file.replace(".objects", "");
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| {
file_name_parts[file_name_parts_index]
@@ -517,7 +515,8 @@ fn main() {
let y: f32 = object_line_parts[2].parse().unwrap();
let z = object_line_parts[3].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 {
w_position: (offset_x + x, z, offset_y + y),
w_rotation: 2.0 * PI * rotation / 360.0,