Implement DrawGraph.BlendSrcBright

This commit is contained in:
Nunuhara Cabbage
2022-05-02 15:12:40 -07:00
parent d085951f68
commit d482e165d6
3 changed files with 20 additions and 2 deletions
+1
View File
@@ -114,6 +114,7 @@ void gfx_blend(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w
void gfx_blend_amap(struct texture *dst, int dx, int dy, struct texture *src, int sx, int sy, int w, int h);
void gfx_blend_amap_color(struct texture *dst, int dx, int dy, struct texture *src, int sx, int sy, int w, int h, int r, int g, int b);
void gfx_blend_amap_alpha(struct texture *dst, int dx, int dy, struct texture *src, int sx, int sy, int w, int h, int a);
void gfx_blend_src_bright(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h, int a, int rate);
void gfx_blend_amap_color_alpha(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h, int r, int g, int b, int a);
void gfx_fill(struct texture *dst, int x, int y, int w, int h, int r, int g, int b);
void gfx_fill_alpha_color(struct texture *dst, int x, int y, int w, int h, int r, int g, int b, int a);
+13
View File
@@ -347,6 +347,19 @@ void gfx_blend_amap_alpha(Texture *dst, int dx, int dy, Texture *src, int sx, in
restore_blend_mode();
}
void gfx_blend_src_bright(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h, int a, int rate)
{
GLfloat f_rate = rate / 255.0;
f_rate *= (a / 255.0);
glBlendFuncSeparate(GL_CONSTANT_COLOR, GL_ONE_MINUS_CONSTANT_ALPHA, GL_ZERO, GL_ONE);
glBlendColor(f_rate, f_rate, f_rate, a / 255.0);
struct copy_data data = COPY_DATA(dx, dy, sx, sy, w, h);
run_copy_shader(&copy_shader.s, dst, src, &data);
restore_blend_mode();
}
void gfx_blend_amap_color_alpha(Texture *dst, int dx, int dy, Texture *src, int sx, int sy, int w, int h, int r, int g, int b, int a)
{
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+6 -2
View File
@@ -206,7 +206,11 @@ static void DrawGraph_SetFontName(struct string *text)
gfx_set_font_name(text->text);
}
//void DrawGraph_BlendSrcBright(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int alpha, int rate);
void DrawGraph_BlendSrcBright(int dst, int dx, int dy, int src, int sx, int sy, int w, int h, int alpha, int rate)
{
gfx_blend_src_bright(DTEX(dst), dx, dy, STEX(src), sx, sy, w, h, alpha, rate);
}
//void DrawGraph_BlendAddSatur(int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
//void DrawGraph_BlendAMapSrcOnly(int dst, int dx, int dy, int src, int sx, int sy, int w, int h);
@@ -346,7 +350,7 @@ HLL_LIBRARY(DrawGraph,
HLL_EXPORT(CopyAMapMax, DrawGraph_CopyAMapMax),
HLL_EXPORT(CopyAMapMin, DrawGraph_CopyAMapMin),
HLL_EXPORT(Blend, DrawGraph_Blend),
//HLL_EXPORT(BlendSrcBright, DrawGraph_BlendSrcBright),
HLL_EXPORT(BlendSrcBright, DrawGraph_BlendSrcBright),
//HLL_EXPORT(BlendAddSatur, DrawGraph_BlendAddSatur),
HLL_EXPORT(BlendAMap, DrawGraph_BlendAMap),
//HLL_EXPORT(BlendAMapSrcOnly, DrawGraph_BlendAMapSrcOnly),