Get into a runnable state

This commit is contained in:
Thinkofdeath 2016-03-16 17:53:04 +00:00
parent e9631f044d
commit 479ba4f03e
7 changed files with 410 additions and 299 deletions

626
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@ -5,19 +5,19 @@ authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>" ]
build = "build.rs" build = "build.rs"
[dependencies] [dependencies]
glutin = "0.3.7" glutin = "0.4.9"
byteorder = "0.3.13" byteorder = "0.5.0"
hyper = "0.6.13" hyper = "0.8.0"
serde = "0.6.0" serde = "0.7.0"
serde_json = "0.6.0" serde_json = "0.7.0"
flate2 = "0.2.9" flate2 = "0.2.13"
zip = "0.1.12" zip = "0.1.16"
image = "0.3.12" image = "0.7.0"
time = "0.1.32" time = "0.1.34"
rand = "0.3.11" rand = "0.3.14"
rustc-serialize = "0.3" rustc-serialize = "0.3.18"
log = "0.3.2" log = "0.3.5"
cgmath = "0.3.1" cgmath = "0.7.0"
[dependencies.steven_gl] [dependencies.steven_gl]
path = "./gl" path = "./gl"

37
gl/Cargo.lock generated
View File

@ -2,58 +2,49 @@
name = "steven_gl" name = "steven_gl"
version = "0.0.1" version = "0.0.1"
dependencies = [ dependencies = [
"gl_common 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "gl_generator 0.4.2 (registry+https://github.com/rust-lang/crates.io-index)",
"gl_generator 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"khronos_api 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "bitflags" name = "bitflags"
version = "0.3.2" version = "0.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "gl_common"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]] [[package]]
name = "gl_generator" name = "gl_generator"
version = "0.1.0" version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"khronos_api 0.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "khronos_api 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
"xml-rs 0.1.26 (registry+https://github.com/rust-lang/crates.io-index)", "xml-rs 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "khronos_api" name = "khronos_api"
version = "0.0.8" version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "libc" name = "libc"
version = "0.1.10" version = "0.2.8"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "log" name = "log"
version = "0.3.2" version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
] ]
[[package]] [[package]]
name = "xml-rs" name = "xml-rs"
version = "0.1.26" version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [ dependencies = [
"bitflags 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", "bitflags 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
] ]

View File

@ -5,9 +5,8 @@ authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>" ]
build = "build.rs" build = "build.rs"
[build-dependencies] [build-dependencies]
gl_generator = "0.1.0" gl_generator = "0.4.2"
khronos_api = "0.0.8" khronos_api = "1.0.0"
[dependencies] [dependencies]
gl_common = "0.1.0" libc = "0.2"
libc = "*"

View File

@ -4,5 +4,5 @@ version = "0.0.1"
authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>" ] authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>" ]
[dependencies] [dependencies]
libc = "*" libc = "0.2"
openssl-sys = "0.6.5" openssl-sys = "0.7.6"

View File

@ -23,7 +23,7 @@ use std::ops::{Deref, DerefMut};
/// Inits the gl library. This should be called once a context is ready. /// Inits the gl library. This should be called once a context is ready.
pub fn init(window: &mut glutin::Window) { pub fn init(window: &mut glutin::Window) {
gl::load_with(|s| window.get_proc_address(s)); gl::load_with(|s| window.get_proc_address(s) as *const _);
} }
/// Dsed to specify how the vertices will be handled /// Dsed to specify how the vertices will be handled
@ -594,7 +594,7 @@ impl Buffer {
pub fn set_data(&self, target: BufferTarget, data: &[u8], usage: BufferUsage) { pub fn set_data(&self, target: BufferTarget, data: &[u8], usage: BufferUsage) {
unsafe { unsafe {
gl::BufferData(target, gl::BufferData(target,
data.len() as i64, data.len() as isize,
data.as_ptr() as *const gl::types::GLvoid, data.as_ptr() as *const gl::types::GLvoid,
usage); usage);
} }

View File

@ -96,6 +96,7 @@ init_shader! {
impl Renderer { impl Renderer {
pub fn new(res: Arc<RwLock<resources::Manager>>) -> Renderer { pub fn new(res: Arc<RwLock<resources::Manager>>) -> Renderer {
use cgmath::Matrix;
let version = { let version = {
res.read().unwrap().version() res.read().unwrap().version()
}; };
@ -175,7 +176,7 @@ impl Renderer {
self.perspective_matrix = cgmath::Matrix4::from( self.perspective_matrix = cgmath::Matrix4::from(
cgmath::PerspectiveFov { cgmath::PerspectiveFov {
fovy: cgmath::Deg{s: 90f32}, fovy: cgmath::Rad::from(cgmath::Deg{s: 90f32}),
aspect: (width / height) as f32, aspect: (width / height) as f32,
near: 0.1f32, near: 0.1f32,
far: 500.0f32, far: 500.0f32,
@ -277,7 +278,7 @@ impl Renderer {
fn init_trans(&mut self, width: u32, height: u32) { fn init_trans(&mut self, width: u32, height: u32) {
self.trans = None; self.trans = None;
self.trans = Some(TransInfo::new(width, height)); // self.trans = Some(TransInfo::new(width, height));
} }
pub fn get_textures(&self) -> Arc<RwLock<TextureManager>> { pub fn get_textures(&self) -> Arc<RwLock<TextureManager>> {