mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-22 23:08:43 -06:00
Compare commits
No commits in common. "3f8056b6ea1e6dd7aa846473c77ee5aa7514a1c0" and "ec592951bcbd8da6f7a59e0ebefdfdea9199a5c3" have entirely different histories.
3f8056b6ea
...
ec592951bc
|
@ -6,9 +6,13 @@ use winit::{
|
||||||
window::{WindowBuilder, Fullscreen, Window},
|
window::{WindowBuilder, Fullscreen, Window},
|
||||||
dpi::PhysicalSize
|
dpi::PhysicalSize
|
||||||
};
|
};
|
||||||
use glium::{Display, Surface, Version, Api as GlApiTy};
|
use glium::{Display, Surface, Version, Api};
|
||||||
use glutin::{
|
use glutin::{
|
||||||
config::{Api, ConfigTemplateBuilder}, context::{ContextAttributesBuilder, GlProfile}, display::GetGlDisplay, prelude::*, surface::{SurfaceAttributesBuilder, WindowSurface}
|
prelude::*,
|
||||||
|
context::{ContextAttributesBuilder, GlProfile},
|
||||||
|
surface::{WindowSurface, SurfaceAttributesBuilder},
|
||||||
|
display::GetGlDisplay,
|
||||||
|
config::ConfigTemplateBuilder
|
||||||
};
|
};
|
||||||
use glutin_winit::DisplayBuilder;
|
use glutin_winit::DisplayBuilder;
|
||||||
use glam::{Vec3, UVec2};
|
use glam::{Vec3, UVec2};
|
||||||
|
@ -92,7 +96,6 @@ impl Renderer {
|
||||||
.with_window_builder(Some(wb));
|
.with_window_builder(Some(wb));
|
||||||
|
|
||||||
let config_template_builder = ConfigTemplateBuilder::new()
|
let config_template_builder = ConfigTemplateBuilder::new()
|
||||||
.with_api(Api::GLES3)
|
|
||||||
.prefer_hardware_accelerated(Some(true))
|
.prefer_hardware_accelerated(Some(true))
|
||||||
.with_depth_size(24)
|
.with_depth_size(24)
|
||||||
.with_multisampling(settings.msaa.unwrap_or_default());
|
.with_multisampling(settings.msaa.unwrap_or_default());
|
||||||
|
@ -153,7 +156,7 @@ impl Renderer {
|
||||||
if display.is_robust() { log::warn!("OpenGL implementation is not robust") }
|
if display.is_robust() { log::warn!("OpenGL implementation is not robust") }
|
||||||
if display.is_debug() { log::info!("OpenGL context is in debug mode") }
|
if display.is_debug() { log::info!("OpenGL context is in debug mode") }
|
||||||
|
|
||||||
assert!(display.is_glsl_version_supported(&Version(GlApiTy::GlEs, 3, 0)), "GLSL ES 3.0 is not supported");
|
assert!(display.is_glsl_version_supported(&Version(Api::GlEs, 3, 0)), "GLSL ES 3.0 is not supported");
|
||||||
|
|
||||||
Self { window, display }
|
Self { window, display }
|
||||||
}
|
}
|
||||||
|
|
|
@ -76,7 +76,7 @@ pub fn draw_world(
|
||||||
let world_position = position.as_vec3() * CHUNK_SIZE as f32;
|
let world_position = position.as_vec3() * CHUNK_SIZE as f32;
|
||||||
|
|
||||||
//Skip mesh if its empty
|
//Skip mesh if its empty
|
||||||
if mesh.index_buffer.len() == 0 && mesh.trans_index_buffer.len() == 0 {
|
if mesh.index_buffer.len() == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,21 +90,19 @@ pub fn draw_world(
|
||||||
}
|
}
|
||||||
|
|
||||||
//Draw chunk mesh
|
//Draw chunk mesh
|
||||||
if mesh.index_buffer.len() > 0 {
|
target.0.draw(
|
||||||
target.0.draw(
|
&mesh.vertex_buffer,
|
||||||
&mesh.vertex_buffer,
|
&mesh.index_buffer,
|
||||||
&mesh.index_buffer,
|
&program.0,
|
||||||
&program.0,
|
&uniform! {
|
||||||
&uniform! {
|
position_offset: world_position.to_array(),
|
||||||
position_offset: world_position.to_array(),
|
view: view,
|
||||||
view: view,
|
perspective: perspective,
|
||||||
perspective: perspective,
|
tex: texture_sampler,
|
||||||
tex: texture_sampler,
|
discard_alpha: true,
|
||||||
discard_alpha: true,
|
},
|
||||||
},
|
&draw_parameters
|
||||||
&draw_parameters
|
).unwrap();
|
||||||
).unwrap();
|
|
||||||
}
|
|
||||||
|
|
||||||
if mesh.trans_index_buffer.len() > 0 {
|
if mesh.trans_index_buffer.len() > 0 {
|
||||||
enqueue_trans.push((chunk, mesh));
|
enqueue_trans.push((chunk, mesh));
|
||||||
|
|
Loading…
Reference in a new issue