mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-22 03:48:21 -06:00
move wireframe mode to options
This commit is contained in:
parent
717e219003
commit
a439dc9dcf
|
@ -15,4 +15,3 @@ simdnoise = "3.1"
|
|||
|
||||
[features]
|
||||
default = []
|
||||
polygon_rendering = []
|
||||
|
|
|
@ -123,7 +123,7 @@ pub fn run() {
|
|||
let view = state.camera.view_matrix();
|
||||
|
||||
//Draw chunks
|
||||
state.world.render(&mut target, &programs, &assets, perspective, view);
|
||||
state.world.render(&mut target, &programs, &assets, perspective, view, &options);
|
||||
|
||||
//Draw example triangle
|
||||
// target.draw(
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
#[derive(Clone, Debug)]
|
||||
pub struct GameOptions {
|
||||
pub render_distance: u8,
|
||||
pub debug_wireframe_mode: bool,
|
||||
}
|
||||
impl Default for GameOptions {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
render_distance: if cfg!(debug_assertions) { 8 } else { 16 },
|
||||
debug_wireframe_mode: false,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,8 @@ use glam::{Vec2, IVec2};
|
|||
use glium::{
|
||||
Display, Frame, Surface,
|
||||
DrawParameters, Depth,
|
||||
DepthTest, uniform,
|
||||
DepthTest, PolygonMode,
|
||||
uniform,
|
||||
uniforms::{
|
||||
Sampler, SamplerBehavior,
|
||||
MinifySamplerFilter, MagnifySamplerFilter,
|
||||
|
@ -55,7 +56,8 @@ impl World {
|
|||
programs: &Programs,
|
||||
assets: &Assets,
|
||||
perspective: [[f32; 4]; 4],
|
||||
view: [[f32; 4]; 4]
|
||||
view: [[f32; 4]; 4],
|
||||
options: &GameOptions
|
||||
) {
|
||||
let sampler = SamplerBehavior {
|
||||
minify_filter: MinifySamplerFilter::Linear,
|
||||
|
@ -69,7 +71,11 @@ impl World {
|
|||
write: true,
|
||||
..Default::default()
|
||||
},
|
||||
#[cfg(feature = "polygon_rendering")] polygon_mode: glium::PolygonMode::Line,
|
||||
polygon_mode: if options.debug_wireframe_mode {
|
||||
PolygonMode::Line
|
||||
} else {
|
||||
PolygonMode::Fill
|
||||
},
|
||||
backface_culling: glium::draw_parameters::BackfaceCullingMode::CullCounterClockwise,
|
||||
..Default::default()
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue