make the boxes a little prettier

main
_ 2021-12-19 01:23:00 +00:00
parent 3c2f247167
commit c61f734a5b
5 changed files with 13 additions and 4 deletions

View File

@ -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

BIN
cube.iqm

Binary file not shown.

View File

@ -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);
}

View File

@ -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"),
};

View File

@ -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
};