2020-09-14 00:00:00 +00:00
|
|
|
#include "./menu_background.h"
|
|
|
|
|
|
|
|
#include <assert.h>
|
2020-10-09 00:00:00 +00:00
|
|
|
#include <stddef.h>
|
2020-09-14 00:00:00 +00:00
|
|
|
|
|
|
|
#include "util/gleasy/program.h"
|
|
|
|
#include "util/math/algorithm.h"
|
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
#include "./single.h"
|
2020-09-14 00:00:00 +00:00
|
|
|
#include "./uniblock.h"
|
|
|
|
|
|
|
|
/* resources */
|
2020-10-09 00:00:00 +00:00
|
|
|
#include "core/loshader/anysrc/header.shader.h"
|
|
|
|
#include "core/loshader/anysrc/menu_background.vshader.h"
|
|
|
|
#include "core/loshader/anysrc/menu_background.fshader.h"
|
2020-09-14 00:00:00 +00:00
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
#define UNIFORM_ALPHA_ 0
|
2020-09-14 00:00:00 +00:00
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
#define PRIMITIVE_COUNT_ 6
|
2020-09-14 00:00:00 +00:00
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
void loshader_menu_background_drawer_initialize(
|
|
|
|
loshader_menu_background_drawer_t* drawer,
|
|
|
|
const loshader_uniblock_t* uniblock) {
|
|
|
|
assert(drawer != NULL);
|
|
|
|
assert(uniblock != NULL);
|
2020-09-14 00:00:00 +00:00
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
const gleasy_program_t prog = gleasy_program_new(
|
2020-09-14 00:00:00 +00:00
|
|
|
loshader_header_shader_,
|
|
|
|
sizeof(loshader_header_shader_),
|
|
|
|
loshader_menu_background_vshader_,
|
|
|
|
sizeof(loshader_menu_background_vshader_),
|
|
|
|
loshader_menu_background_fshader_,
|
|
|
|
sizeof(loshader_menu_background_fshader_));
|
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
loshader_single_drawer_initialize(&drawer->super, prog, uniblock, 0);
|
2020-09-14 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loshader_menu_background_drawer_draw(
|
|
|
|
const loshader_menu_background_drawer_t* drawer) {
|
|
|
|
assert(drawer != NULL);
|
2020-10-09 00:00:00 +00:00
|
|
|
assert(MATH_FLOAT_VALID(drawer->alpha));
|
2020-09-14 00:00:00 +00:00
|
|
|
|
|
|
|
if (drawer->alpha == 0) return;
|
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
glUseProgram(drawer->super.prog);
|
|
|
|
glUniform1f(UNIFORM_ALPHA_, drawer->alpha);
|
2020-09-14 00:00:00 +00:00
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
loshader_single_drawer_draw_without_use_program(
|
|
|
|
&drawer->super, PRIMITIVE_COUNT_);
|
2020-09-14 00:00:00 +00:00
|
|
|
}
|