diff --git a/Cargo.toml b/Cargo.toml index 3cedbb8..97fff64 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -32,3 +32,6 @@ tracing = "0.1.22" tracing-subscriber = "0.2.15" inter_quake_model = {path = "../inter_quake_model"} + +[profile.dev.package."*"] +opt-level = 3 diff --git a/cube.iqm b/cube.iqm index e923f4f..6801b76 100644 Binary files a/cube.iqm and b/cube.iqm differ diff --git a/shaders/pumpkin-frag.glsl b/shaders/pumpkin-frag.glsl index bc381b3..bb956fa 100644 --- a/shaders/pumpkin-frag.glsl +++ b/shaders/pumpkin-frag.glsl @@ -24,7 +24,7 @@ void main (void) { lowp vec3 sun = max (sun_factor, 0.0) * (vec3 (1.0) - sky_color); lowp vec3 sky = (sky_factor * 0.5 + 0.5) * sky_color; - lowp vec3 diffuse_color = albedo * max (uni_min_bright, (sun + sky)); + lowp vec3 diffuse_color = max (uni_min_bright, (sun + sky)); - gl_FragColor = vec4 (sqrt (diffuse_color), 1.0); + gl_FragColor = vec4 (albedo * sqrt (diffuse_color), 1.0); } diff --git a/src/bin/platformer.rs b/src/bin/platformer.rs index a9268e8..ea0098e 100644 --- a/src/bin/platformer.rs +++ b/src/bin/platformer.rs @@ -72,6 +72,7 @@ struct GameGraphics { text_stream: TriangleStream, + texture_crate: Texture, texture_sky: Texture, } @@ -113,6 +114,8 @@ impl GameGraphics { let attrs = shader_vars.attrs; let unis = shader_vars.unis; + self.texture_sky.bind (); + { let mvp = view_mat * Mat4::from_translation (state.player.pos) * @@ -124,6 +127,8 @@ impl GameGraphics { }); } + self.texture_crate.bind (); + for aabb in &state.aabbs { let min = aabb.min; let max = aabb.max; @@ -278,6 +283,7 @@ async fn main () -> Result <()> { shader_lookup, shaders, text_stream, + texture_crate: Texture::from_file ("crate.png"), texture_sky: Texture::from_file ("sky.png"), }; diff --git a/src/texture.rs b/src/texture.rs index bc2d691..ad0888d 100644 --- a/src/texture.rs +++ b/src/texture.rs @@ -39,8 +39,8 @@ impl Texture { gl::TexParameteri (gl::TEXTURE_2D, gl::TEXTURE_WRAP_S, gl::CLAMP_TO_EDGE as i32); gl::TexParameteri (gl::TEXTURE_2D, gl::TEXTURE_WRAP_T, gl::CLAMP_TO_EDGE as i32); - gl::TexParameteri (gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::LINEAR as i32); - gl::TexParameteri (gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::LINEAR as i32); + gl::TexParameteri (gl::TEXTURE_2D, gl::TEXTURE_MIN_FILTER, gl::NEAREST as i32); + gl::TexParameteri (gl::TEXTURE_2D, gl::TEXTURE_MAG_FILTER, gl::NEAREST as i32); id };