very important optimization

This commit is contained in:
Andrei Alexeyev 2019-01-23 16:02:51 +02:00
parent e628301f48
commit f8a2d3c112
No known key found for this signature in database
GPG key ID: 363707CD4C7FE8A4
3 changed files with 39 additions and 6 deletions

View file

@ -1,4 +0,0 @@
w = 800
h = 600

28
resources/models/hud.obj Normal file
View file

@ -0,0 +1,28 @@
# Blender v2.79 (sub 0) OBJ File: 'hud.blend'
# www.blender.org
v -400.000000 300.000000 0.000000
v 400.000000 300.000000 0.000000
v -400.000000 -300.000000 0.000000
v 400.000000 -300.000000 0.000000
v -360.000000 -280.000000 0.000000
v 120.000000 280.000000 0.000000
v 120.000000 -280.000000 0.000000
v -360.000000 280.000000 0.000000
vt 1.000000 0.000000
vt 0.650000 0.966667
vt 0.650000 0.033333
vt 0.000000 1.000000
vt 0.000000 0.000000
vt 0.050000 0.966667
vt 0.050000 0.033333
vt 1.000000 1.000000
vn 0.0000 0.0000 -1.0000
s off
f 2/1/1 7/2/1 6/3/1
f 3/4/1 1/5/1 5/6/1
f 8/7/1 1/5/1 6/3/1
f 1/5/1 2/1/1 6/3/1
f 2/1/1 4/8/1 7/2/1
f 1/5/1 8/7/1 5/6/1
f 5/6/1 7/2/1 3/4/1
f 7/2/1 4/8/1 3/4/1

View file

@ -288,11 +288,15 @@ void stage_draw_init(void) {
"hud/heart",
"hud/star",
"star",
"hud",
NULL);
preload_resources(RES_TEXTURE, RESF_PERMANENT,
"titletransition",
"hud",
NULL);
preload_resources(RES_MODEL, RESF_PERMANENT,
"hud",
NULL);
preload_resources(RES_SHADER_PROGRAM, RESF_PERMANENT,
@ -1220,7 +1224,12 @@ static void stage_draw_framerate_graphs(void) {
void stage_draw_hud(void) {
// Background
draw_sprite(SCREEN_W/2.0, SCREEN_H/2.0, "hud");
r_mat_push();
r_mat_translate(SCREEN_W*0.5, SCREEN_H*0.5, 0);
r_shader_standard();
r_uniform_sampler("tex", "hud");
r_draw_model("hud");
r_mat_pop();
// TODO: refactor this whole mess of arcane magic numbers into something more sensible
// hahaha who am I kidding, nobody is gonna do that.