mirror of
https://github.com/nunuhara/xsystem4.git
synced 2026-09-22 23:18:01 +03:00
ReignEngine: Fix BackCG issues
- Enable both alpha map and alpha mod, using the new drawing function gfx_copy_stretch_blend_amap_alpha(). - Do not draw if `bcg->show` flag is false. - Do not WARNING() for SetBackCGNum(0) as it's used to unload the CG.
This commit is contained in:
@@ -144,6 +144,7 @@ void gfx_copy_stretch(struct texture *dst, int dx, int dy, int dw, int dh, struc
|
||||
void gfx_copy_stretch_amap(struct texture *dst, int dx, int dy, int dw, int dh, struct texture *src, int sx, int sy, int sw, int sh);
|
||||
void gfx_copy_stretch_blend(struct texture *dst, int dx, int dy, int dw, int dh, struct texture *src, int sx, int sy, int sw, int sh, int a);
|
||||
void gfx_copy_stretch_blend_amap(struct texture *dst, int dx, int dy, int dw, int dh, struct texture *src, int sx, int sy, int sw, int sh);
|
||||
void gfx_copy_stretch_blend_amap_alpha(struct texture *dst, int dx, int dy, int dw, int dh, struct texture *src, int sx, int sy, int sw, int sh, int a);
|
||||
void gfx_copy_rot_zoom(Texture *dst, Texture *src, int sx, int sy, int w, int h, float rotate, float mag);
|
||||
void gfx_copy_rot_zoom_amap(Texture *dst, Texture *src, int sx, int sy, int w, int h, float rotate, float mag);
|
||||
void gfx_copy_rot_zoom_use_amap(Texture *dst, Texture *src, int sx, int sy, int w, int h, float rotate, float mag);
|
||||
|
||||
@@ -888,6 +888,9 @@ bool RE_back_cg_set(struct RE_back_cg *bcg, int no)
|
||||
bcg->no = no;
|
||||
gfx_delete_texture(&bcg->texture);
|
||||
|
||||
if (!no) // unload only.
|
||||
return true;
|
||||
|
||||
struct cg *cg = asset_cg_load(no);
|
||||
if (!cg) {
|
||||
WARNING("cannot load back CG: %d", no);
|
||||
|
||||
+2
-2
@@ -505,11 +505,11 @@ static void render_shadow_map(struct RE_plugin *plugin, mat4 light_space_transfo
|
||||
|
||||
static void render_back_cg(struct texture *dst, struct RE_back_cg *bcg, struct RE_renderer *r)
|
||||
{
|
||||
if (!bcg->texture.handle)
|
||||
if (!bcg->show || !bcg->texture.handle)
|
||||
return;
|
||||
int sw = bcg->texture.w;
|
||||
int sh = bcg->texture.h;
|
||||
gfx_copy_stretch_blend(dst, bcg->x, bcg->y, sw * bcg->mag, sh * bcg->mag, &bcg->texture, 0, 0, sw, sh, bcg->blend_rate * 255);
|
||||
gfx_copy_stretch_blend_amap_alpha(dst, bcg->x, bcg->y, sw * bcg->mag, sh * bcg->mag, &bcg->texture, 0, 0, sw, sh, bcg->blend_rate * 255);
|
||||
}
|
||||
|
||||
static void setup_lights(struct RE_plugin *plugin)
|
||||
|
||||
+14
@@ -712,6 +712,20 @@ void gfx_copy_stretch_blend_amap(struct texture *dst, int dx, int dy, int dw, in
|
||||
restore_blend_mode();
|
||||
}
|
||||
|
||||
void gfx_copy_stretch_blend_amap_alpha(struct texture *dst, int dx, int dy, int dw, int dh, struct texture *src, int sx, int sy, int sw, int sh, int a)
|
||||
{
|
||||
glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_DST_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||
|
||||
struct copy_data data = STRETCH_DATA(dx, dy, dw, dh, sx, sy, sw, sh);
|
||||
data.r = 1.0;
|
||||
data.g = 1.0;
|
||||
data.b = 1.0;
|
||||
data.a = a / 255.0;
|
||||
run_copy_shader(&blend_amap_alpha_bright_shader.s, dst, src, &data);
|
||||
|
||||
restore_blend_mode();
|
||||
}
|
||||
|
||||
// FIXME: this doesn't work correctly when the src rectangle crosses the edge of the CG.
|
||||
static void copy_rot_zoom(Texture *dst, Texture *src, int sx, int sy, int w, int h, float rotate, float mag, Shader *shader)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user