Compare commits

..

No commits in common. "4e536d420d8b437dda1720ddd9901d1dc3b60abc" and "d74879d339335fa2d75d06291dad9783497bdd7b" have entirely different histories.

5 changed files with 16 additions and 58 deletions

View File

@ -2,6 +2,6 @@
Lithium is a small Real-Time 3D renderer written in rust. Lithium is a small Real-Time 3D renderer written in rust.
It is not meant for real world usage, but for learning about 3D rendering. It is not meant for real world usage, but for learning about 3D rendering.
## License # License
Lithium is licensed under the MIT open source license. Lithium is licensed under the MIT open source license.
Check the `LICENSE` file for more info. Check the `LICENSE` file for more info.

View File

@ -2,17 +2,10 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "anyhow"
version = "1.0.75"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6"
[[package]] [[package]]
name = "lithium-loader" name = "lithium-loader"
version = "0.1.0" version = "0.1.0"
dependencies = [ dependencies = [
"anyhow",
"lithium-utils", "lithium-utils",
] ]

View File

@ -9,5 +9,3 @@ authors = ["antifallobst"]
[dependencies] [dependencies]
lithium-utils = { path = "../lithium-utils" } lithium-utils = { path = "../lithium-utils" }
anyhow = "1.0.75"

View File

@ -1,4 +1,3 @@
use anyhow::Result;
use lithium_utils::{Vector2, Vector3}; use lithium_utils::{Vector2, Vector3};
pub struct Vertex { pub struct Vertex {
@ -54,12 +53,4 @@ impl Model {
faces, faces,
} }
} }
pub fn faces(&self) -> &Vec<(u32, u32, u32)> {
&self.faces
}
pub fn vertex(&self, id: u32) -> Option<&Vertex> {
self.vertices.get(id as usize)
}
} }

View File

@ -1,26 +1,6 @@
use std::ops::{Add, Sub};
pub struct Vector2 { pub struct Vector2 {
pub x: f32, x: f32,
pub y: f32, y: f32,
}
impl Default for Vector2 {
fn default() -> Self {
Self { x: 0_f32, y: 0_f32 }
}
}
impl Vector2 {
pub fn new(x: f32, y: f32) -> Self {
Self { x, y }
}
}
pub struct Vector3 {
pub x: f32,
pub y: f32,
pub z: f32,
} }
impl Default for Vector3 { impl Default for Vector3 {
@ -33,25 +13,21 @@ impl Default for Vector3 {
} }
} }
impl Add for Vector3 { impl Vector2 {
type Output = Self; pub fn new(x: f32, y: f32) -> Self {
fn add(self, rhs: Self) -> Self::Output { Self { x, y }
Self::Output {
x: self.x + rhs.x,
y: self.y + rhs.y,
z: self.z + rhs.z,
}
} }
} }
impl Sub for Vector3 { pub struct Vector3 {
type Output = Vector3; x: f32,
fn sub(self, rhs: Self) -> Self::Output { y: f32,
Self::Output { z: f32,
x: self.x - rhs.x, }
y: self.y - rhs.y,
z: self.z - rhs.z, impl Default for Vector2 {
} fn default() -> Self {
Self { x: 0_f32, y: 0_f32 }
} }
} }