2020-09-14 00:00:00 +00:00
|
|
|
#include "./backwall.h"
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stddef.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/backwall.vshader.h"
|
|
|
|
#include "core/loshader/anysrc/backwall.fshader.h"
|
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
|
|
|
|
|
|
|
#pragma pack(push, 1)
|
|
|
|
typedef struct {
|
|
|
|
float type;
|
|
|
|
float prev_type;
|
|
|
|
float transition;
|
|
|
|
} loshader_backwall_drawer_internal_param_t;
|
|
|
|
#pragma pack(pop)
|
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
_Static_assert(
|
|
|
|
sizeof(float)*3 ==
|
|
|
|
sizeof(loshader_backwall_drawer_internal_param_t),
|
|
|
|
"recheck the type has no padding");
|
2020-09-14 00:00:00 +00:00
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
void loshader_backwall_drawer_initialize(
|
|
|
|
loshader_backwall_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_backwall_vshader_, sizeof(loshader_backwall_vshader_),
|
|
|
|
loshader_backwall_fshader_, sizeof(loshader_backwall_fshader_));
|
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
loshader_single_drawer_initialize(
|
|
|
|
&drawer->super,
|
|
|
|
prog,
|
|
|
|
uniblock,
|
|
|
|
sizeof(loshader_backwall_drawer_internal_param_t));
|
2020-09-14 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loshader_backwall_drawer_set_param(
|
|
|
|
loshader_backwall_drawer_t* drawer,
|
|
|
|
const loshader_backwall_drawer_param_t* param) {
|
|
|
|
assert(drawer != NULL);
|
|
|
|
assert(param != NULL);
|
|
|
|
|
|
|
|
const loshader_backwall_drawer_internal_param_t p = {
|
|
|
|
.type = param->type,
|
|
|
|
.prev_type = param->prev_type,
|
|
|
|
.transition = param->transition,
|
|
|
|
};
|
2020-10-09 00:00:00 +00:00
|
|
|
loshader_single_drawer_set_param(&drawer->super, &p);
|
2020-09-14 00:00:00 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void loshader_backwall_drawer_draw(const loshader_backwall_drawer_t* drawer) {
|
|
|
|
assert(drawer != NULL);
|
|
|
|
|
2020-10-09 00:00:00 +00:00
|
|
|
loshader_single_drawer_draw(&drawer->super, PRIMITIVE_COUNT_);
|
2020-09-14 00:00:00 +00:00
|
|
|
}
|