mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-10-12 17:28:14 +03:00
Implement DrawGraph.FillAMapGradationUD
This commit is contained in:
+20
@@ -34,6 +34,7 @@ struct copy_shader {
|
||||
// optional
|
||||
GLint color;
|
||||
GLint threshold;
|
||||
GLint threshold2;
|
||||
};
|
||||
|
||||
struct copy_data {
|
||||
@@ -43,6 +44,7 @@ struct copy_data {
|
||||
// optional
|
||||
float r, g, b, a;
|
||||
float threshold;
|
||||
float threshold2;
|
||||
};
|
||||
|
||||
#define ROTATE_DATA(dst, _sx, _sy, _w, _h) \
|
||||
@@ -68,6 +70,7 @@ static struct copy_shader blend_use_amap_color_shader;
|
||||
static struct copy_shader fill_shader;
|
||||
static struct copy_shader fill_amap_over_border_shader;
|
||||
static struct copy_shader fill_amap_under_border_shader;
|
||||
static struct copy_shader fill_amap_gradation_ud_shader;
|
||||
static struct copy_shader hitbox_shader;
|
||||
static struct copy_shader hitbox_noblend_shader;
|
||||
static struct copy_shader dilate_shader;
|
||||
@@ -81,6 +84,7 @@ static void prepare_copy_shader(struct gfx_render_job *job, void *data)
|
||||
|
||||
glUniform4f(s->color, d->r, d->g, d->b, d->a);
|
||||
glUniform1f(s->threshold, d->threshold);
|
||||
glUniform1f(s->threshold2, d->threshold2);
|
||||
}
|
||||
|
||||
static void load_copy_shader(struct copy_shader *s, const char *v_path, const char *f_path)
|
||||
@@ -90,6 +94,7 @@ static void load_copy_shader(struct copy_shader *s, const char *v_path, const ch
|
||||
s->top_right = glGetUniformLocation(s->s.program, "top_right");
|
||||
s->color = glGetUniformLocation(s->s.program, "color");
|
||||
s->threshold = glGetUniformLocation(s->s.program, "threshold");
|
||||
s->threshold2 = glGetUniformLocation(s->s.program, "threshold2");
|
||||
s->s.prepare = prepare_copy_shader;
|
||||
}
|
||||
|
||||
@@ -131,6 +136,9 @@ void gfx_draw_init(void)
|
||||
// fill shader that only fills fragments below a certain alpha threshold
|
||||
load_copy_shader(&fill_amap_under_border_shader, "shaders/render.v.glsl", "shaders/fill_amap_under_border.f.glsl");
|
||||
|
||||
// fill shader that fills the alpha map with a gradient
|
||||
load_copy_shader(&fill_amap_gradation_ud_shader, "shaders/render.v.glsl", "shaders/fill_amap_gradation_ud.f.glsl");
|
||||
|
||||
// shader that discards texels that fail a hitbox test
|
||||
load_copy_shader(&hitbox_shader, "shaders/render.v.glsl", "shaders/hitbox.f.glsl");
|
||||
|
||||
@@ -541,6 +549,18 @@ void gfx_fill_amap_under_border(Texture *dst, int x, int y, int w, int h, int al
|
||||
restore_blend_mode();
|
||||
}
|
||||
|
||||
void gfx_fill_amap_gradation_ud(Texture *dst, int x, int y, int w, int h, int up_a, int down_a)
|
||||
{
|
||||
glBlendFuncSeparate(GL_ZERO, GL_ONE, GL_ONE, GL_ZERO);
|
||||
|
||||
struct copy_data data = COPY_DATA(x, y, 0, 0, w, h);
|
||||
data.threshold = up_a / 255.0;
|
||||
data.threshold2 = down_a / 255.0;
|
||||
run_fill_shader(&fill_amap_gradation_ud_shader.s, dst, &data);
|
||||
|
||||
restore_blend_mode();
|
||||
}
|
||||
|
||||
void gfx_add_da_daxsa(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h)
|
||||
{
|
||||
// color = dst_color
|
||||
|
||||
+6
-2
@@ -176,7 +176,11 @@ static void DrawGraph_FillAMapUnderBorder(int dst, int x, int y, int w, int h, i
|
||||
gfx_fill_amap_under_border(DTEX(dst), x, y, w, h, alpha, border);
|
||||
}
|
||||
|
||||
//void DrawGraph_FillAMapGradationUD(int dst, int x, int y, int w, int h, int up_a, int down_a);
|
||||
static void DrawGraph_FillAMapGradationUD(int dst, int x, int y, int w, int h, int up_a, int down_a)
|
||||
{
|
||||
gfx_fill_amap_gradation_ud(DTEX(dst), x, y, w, h, up_a, down_a);
|
||||
}
|
||||
|
||||
//void DrawGraph_FillScreen(int dst, int x, int y, int w, int h, int r, int g, int b);
|
||||
//void DrawGraph_FillMultiply(int dst, int x, int y, int w, int h, int r, int g, int b);
|
||||
//void DrawGraph_SaturDP_DPxSA(int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
|
||||
@@ -405,7 +409,7 @@ HLL_LIBRARY(DrawGraph,
|
||||
HLL_EXPORT(FillAMap, DrawGraph_FillAMap),
|
||||
HLL_EXPORT(FillAMapOverBorder, DrawGraph_FillAMapOverBorder),
|
||||
HLL_EXPORT(FillAMapUnderBorder, DrawGraph_FillAMapUnderBorder),
|
||||
//HLL_EXPORT(FillAMapGradationUD, DrawGraph_FillAMapGradationUD),
|
||||
HLL_EXPORT(FillAMapGradationUD, DrawGraph_FillAMapGradationUD),
|
||||
//HLL_EXPORT(FillScreen, DrawGraph_FillScreen),
|
||||
//HLL_EXPORT(FillMultiply, DrawGraph_FillMultiply),
|
||||
//HLL_EXPORT(SaturDP_DPxSA, DrawGraph_SaturDP_DPxSA),
|
||||
|
||||
Reference in New Issue
Block a user