DRW: Add DRW_STATE_BLEND_PREMUL_UNDER
Just basic alpha under operation with premultiplied source.
This commit is contained in:
parent
28ada66f38
commit
e6705fad33
|
@ -329,7 +329,7 @@ typedef enum {
|
|||
DRW_STATE_BLEND = (1 << 15),
|
||||
DRW_STATE_ADDITIVE = (1 << 16),
|
||||
DRW_STATE_MULTIPLY = (1 << 17),
|
||||
/* DRW_STATE_TRANSMISSION = (1 << 18), */ /* Not used */
|
||||
DRW_STATE_BLEND_PREMUL_UNDER = (1 << 18),
|
||||
DRW_STATE_CLIP_PLANES = (1 << 19),
|
||||
/** Same as DRW_STATE_ADDITIVE but let alpha accumulate without premult. */
|
||||
DRW_STATE_ADDITIVE_FULL = (1 << 20),
|
||||
|
|
|
@ -205,7 +205,7 @@ void drw_state_set(DRWState state)
|
|||
int test;
|
||||
if (CHANGED_ANY_STORE_VAR(DRW_STATE_BLEND | DRW_STATE_BLEND_PREMUL | DRW_STATE_ADDITIVE |
|
||||
DRW_STATE_MULTIPLY | DRW_STATE_ADDITIVE_FULL |
|
||||
DRW_STATE_BLEND_OIT,
|
||||
DRW_STATE_BLEND_OIT | DRW_STATE_BLEND_PREMUL_UNDER,
|
||||
test)) {
|
||||
if (test) {
|
||||
glEnable(GL_BLEND);
|
||||
|
@ -216,6 +216,9 @@ void drw_state_set(DRWState state)
|
|||
GL_ONE,
|
||||
GL_ONE_MINUS_SRC_ALPHA); /* Alpha */
|
||||
}
|
||||
else if ((state & DRW_STATE_BLEND_PREMUL_UNDER) != 0) {
|
||||
glBlendFunc(GL_ONE_MINUS_DST_ALPHA, GL_ONE);
|
||||
}
|
||||
else if ((state & DRW_STATE_BLEND_PREMUL) != 0) {
|
||||
glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue