forked from AbleOS/ableos_userland
updates + Addition of AGL
This commit is contained in:
parent
14dd080dba
commit
17323dd5a3
72
Cargo.lock
generated
72
Cargo.lock
generated
|
@ -2,6 +2,13 @@
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 3
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "able_graphics_library"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"versioning",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ahash"
|
name = "ahash"
|
||||||
version = "0.7.6"
|
version = "0.7.6"
|
||||||
|
@ -24,6 +31,12 @@ dependencies = [
|
||||||
"version_check",
|
"version_check",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "anyhow"
|
||||||
|
version = "1.0.66"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "base64"
|
name = "base64"
|
||||||
version = "0.13.1"
|
version = "0.13.1"
|
||||||
|
@ -55,10 +68,26 @@ dependencies = [
|
||||||
"toml 0.5.9 (git+https://git.ablecorp.us/theoddgarlic/toml-rs)",
|
"toml 0.5.9 (git+https://git.ablecorp.us/theoddgarlic/toml-rs)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "delete"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"clparse",
|
||||||
|
"fs_extra",
|
||||||
|
"trash_manifest",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derelict_microarchitecture"
|
name = "derelict_microarchitecture"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "fs_extra"
|
||||||
|
version = "1.2.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "2022715d62ab30faffd124d40b76f4134a550a87792276512b18d63272333394"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "getrandom"
|
name = "getrandom"
|
||||||
version = "0.2.8"
|
version = "0.2.8"
|
||||||
|
@ -98,6 +127,15 @@ version = "0.2.138"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
|
checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "list"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"clparse",
|
||||||
|
"number_prefix",
|
||||||
|
"table",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "log"
|
name = "log"
|
||||||
version = "0.4.17"
|
version = "0.4.17"
|
||||||
|
@ -111,6 +149,12 @@ dependencies = [
|
||||||
name = "no_video"
|
name = "no_video"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "number_prefix"
|
||||||
|
version = "0.4.0"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "once_cell"
|
name = "once_cell"
|
||||||
version = "1.16.0"
|
version = "1.16.0"
|
||||||
|
@ -166,6 +210,13 @@ dependencies = [
|
||||||
"syn",
|
"syn",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "shell"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"clparse",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "syn"
|
name = "syn"
|
||||||
version = "1.0.105"
|
version = "1.0.105"
|
||||||
|
@ -177,6 +228,17 @@ dependencies = [
|
||||||
"unicode-ident",
|
"unicode-ident",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "table"
|
||||||
|
version = "0.1.0"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "table_view"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"table",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "tar"
|
name = "tar"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
@ -232,6 +294,16 @@ dependencies = [
|
||||||
"toml 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
"toml 0.5.9 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "undelete"
|
||||||
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"anyhow",
|
||||||
|
"clparse",
|
||||||
|
"fs_extra",
|
||||||
|
"trash_manifest",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "unicode-ident"
|
name = "unicode-ident"
|
||||||
version = "1.0.5"
|
version = "1.0.5"
|
||||||
|
|
14
Cargo.toml
14
Cargo.toml
|
@ -1,22 +1,22 @@
|
||||||
[workspace]
|
[workspace]
|
||||||
|
|
||||||
members = [
|
members = [
|
||||||
|
|
||||||
"drivers/basic_driver",
|
"drivers/basic_driver",
|
||||||
"drivers/graphics/derelict_microarchitecture",
|
"drivers/graphics/derelict_microarchitecture",
|
||||||
"drivers/graphics/ground",
|
"drivers/graphics/ground",
|
||||||
"drivers/graphics/novideo",
|
"drivers/graphics/novideo",
|
||||||
"drivers/graphics/vgable",
|
"drivers/graphics/vgable",
|
||||||
|
|
||||||
|
"libraries/able_graphics_library",
|
||||||
"libraries/clparse",
|
"libraries/clparse",
|
||||||
"libraries/tar",
|
"libraries/tar",
|
||||||
"libraries/trash_manifest",
|
"libraries/trash_manifest",
|
||||||
"libraries/versioning",
|
"libraries/versioning",
|
||||||
|
"libraries/table",
|
||||||
|
|
||||||
# "programs/delete",
|
"programs/delete",
|
||||||
# "programs/list",
|
"programs/list",
|
||||||
# "programs/shell",
|
"programs/shell",
|
||||||
# "programs/table",
|
"programs/table_view",
|
||||||
# "programs/table_view",
|
"programs/undelete",
|
||||||
# "programs/undelete",
|
|
||||||
]
|
]
|
||||||
|
|
9
libraries/able_graphics_library/Cargo.toml
Normal file
9
libraries/able_graphics_library/Cargo.toml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
[package]
|
||||||
|
name = "able_graphics_library"
|
||||||
|
version = "0.1.0"
|
||||||
|
edition = "2021"
|
||||||
|
|
||||||
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
|
[dependencies]
|
||||||
|
versioning = { path = "../versioning" }
|
2
libraries/able_graphics_library/readme.md
Normal file
2
libraries/able_graphics_library/readme.md
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
# AGL
|
||||||
|
A simple (As of version 0.1.0) 3d graphics library based around vertex buffers and drawing triangles
|
3
libraries/able_graphics_library/src/buffer.rs
Normal file
3
libraries/able_graphics_library/src/buffer.rs
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
pub enum BufferUsage {
|
||||||
|
Vertex,
|
||||||
|
}
|
21
libraries/able_graphics_library/src/color.rs
Normal file
21
libraries/able_graphics_library/src/color.rs
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
pub struct Color3 {
|
||||||
|
pub r: u8,
|
||||||
|
pub g: u8,
|
||||||
|
pub b: u8,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl Color3 {
|
||||||
|
/// Usage
|
||||||
|
/// The alpha value is a number between 0.0 and 1.0, which represents the transparency
|
||||||
|
/// or translucency of the other color.
|
||||||
|
pub fn blend(&self, other: &Self, alpha: f32) -> Self {
|
||||||
|
let r = (1.0 - alpha) * f32::from(self.r) + alpha * f32::from(other.r);
|
||||||
|
let g = (1.0 - alpha) * f32::from(self.g) + alpha * f32::from(other.g);
|
||||||
|
let b = (1.0 - alpha) * f32::from(self.b) + alpha * f32::from(other.b);
|
||||||
|
Self {
|
||||||
|
r: r as u8,
|
||||||
|
g: g as u8,
|
||||||
|
b: b as u8,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
14
libraries/able_graphics_library/src/commands.rs
Normal file
14
libraries/able_graphics_library/src/commands.rs
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
use crate::{buffer::BufferUsage, color::Color3, types::BufferID, vertex::Vertex};
|
||||||
|
|
||||||
|
pub enum DrawCommand {
|
||||||
|
UpdateFrame,
|
||||||
|
Clear(Color3),
|
||||||
|
ClearBuffer(BufferID),
|
||||||
|
|
||||||
|
AppendVertex(BufferID, Vertex),
|
||||||
|
|
||||||
|
MakeBuffer {
|
||||||
|
num_vertices: usize,
|
||||||
|
usage: BufferUsage,
|
||||||
|
},
|
||||||
|
}
|
11
libraries/able_graphics_library/src/lib.rs
Normal file
11
libraries/able_graphics_library/src/lib.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
pub mod buffer;
|
||||||
|
pub mod color;
|
||||||
|
pub mod commands;
|
||||||
|
pub mod types;
|
||||||
|
pub mod vertex;
|
||||||
|
|
||||||
|
pub const VERSION: versioning::Version = versioning::Version {
|
||||||
|
major: 0,
|
||||||
|
minor: 1,
|
||||||
|
patch: 0,
|
||||||
|
};
|
11
libraries/able_graphics_library/src/types.rs
Normal file
11
libraries/able_graphics_library/src/types.rs
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
pub type BufferID = u16;
|
||||||
|
|
||||||
|
pub struct Float3Array {
|
||||||
|
pub inner: [f32; 3],
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct Float2Array {
|
||||||
|
pub inner: [f32; 2],
|
||||||
|
}
|
||||||
|
|
||||||
|
pub type Position3 = Float3Array;
|
16
libraries/able_graphics_library/src/vertex.rs
Normal file
16
libraries/able_graphics_library/src/vertex.rs
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
use crate::{
|
||||||
|
color::Color3,
|
||||||
|
types::{Float2Array, Float3Array, Position3},
|
||||||
|
};
|
||||||
|
|
||||||
|
pub struct Vertex {
|
||||||
|
pub position: Position3,
|
||||||
|
pub normal: Float3Array,
|
||||||
|
pub color: Color3,
|
||||||
|
|
||||||
|
pub tex_coords: Float2Array,
|
||||||
|
}
|
||||||
|
|
||||||
|
pub struct VertexBuffer {
|
||||||
|
pub vertex_buffer: Vec<Vertex>,
|
||||||
|
}
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clparse = { path = "../clparse", features = ["std"] }
|
clparse = { path = "../../libraries/clparse", features = ["std"] }
|
||||||
trash_manifest = { path = "../trash_manifest" }
|
trash_manifest = { path = "../../libraries/trash_manifest" }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
fs_extra = "1.2"
|
fs_extra = "1.2"
|
||||||
|
|
|
@ -6,6 +6,6 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clparse = { path = "../clparse" }
|
clparse = { path = "../../libraries/clparse" }
|
||||||
number_prefix = "*"
|
number_prefix = "*"
|
||||||
table = { path = "../table" }
|
table = { path = "../../libraries/table" }
|
||||||
|
|
|
@ -6,4 +6,4 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clparse = { path = "../clparse" }
|
clparse = { path = "../../libraries/clparse" }
|
||||||
|
|
|
@ -6,4 +6,4 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
table = { path = "../table" }
|
table = { path = "../../libraries/table" }
|
||||||
|
|
|
@ -6,7 +6,7 @@ edition = "2021"
|
||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
clparse = { path = "../clparse" }
|
clparse = { path = "../../libraries/clparse" }
|
||||||
trash_manifest = { path = "../trash_manifest" }
|
trash_manifest = { path = "../../libraries/trash_manifest" }
|
||||||
anyhow = "1.0"
|
anyhow = "1.0"
|
||||||
fs_extra = "1.2"
|
fs_extra = "1.2"
|
Loading…
Reference in a new issue