[Bf-blender-cvs] [1413bee158e] blender2.8: Draw Manager: Add additive blending.
Clément Foucault
noreply at git.blender.org
Wed May 10 01:12:07 CEST 2017
Commit: 1413bee158e0703f7fc616bddbc27845ba4be6f5
Author: Clément Foucault
Date: Tue May 9 21:51:30 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB1413bee158e0703f7fc616bddbc27845ba4be6f5
Draw Manager: Add additive blending.
===================================================================
M source/blender/draw/intern/DRW_render.h
M source/blender/draw/intern/draw_manager.c
===================================================================
diff --git a/source/blender/draw/intern/DRW_render.h b/source/blender/draw/intern/DRW_render.h
index 8db189022cb..b54d1c11bd8 100644
--- a/source/blender/draw/intern/DRW_render.h
+++ b/source/blender/draw/intern/DRW_render.h
@@ -242,11 +242,12 @@ typedef enum {
DRW_STATE_STIPPLE_3 = (1 << 11),
DRW_STATE_STIPPLE_4 = (1 << 12),
DRW_STATE_BLEND = (1 << 13),
+ DRW_STATE_ADDITIVE = (1 << 14),
- DRW_STATE_WRITE_STENCIL_SELECT = (1 << 14),
- DRW_STATE_WRITE_STENCIL_ACTIVE = (1 << 15),
- DRW_STATE_TEST_STENCIL_SELECT = (1 << 16),
- DRW_STATE_TEST_STENCIL_ACTIVE = (1 << 17),
+ DRW_STATE_WRITE_STENCIL_SELECT = (1 << 27),
+ DRW_STATE_WRITE_STENCIL_ACTIVE = (1 << 28),
+ DRW_STATE_TEST_STENCIL_SELECT = (1 << 29),
+ DRW_STATE_TEST_STENCIL_ACTIVE = (1 << 30),
} DRWState;
#define DRW_STATE_DEFAULT (DRW_STATE_WRITE_DEPTH | DRW_STATE_WRITE_COLOR | DRW_STATE_DEPTH_LESS)
@@ -258,6 +259,7 @@ DRWShadingGroup *DRW_shgroup_material_instance_create(struct GPUMaterial *materi
DRWShadingGroup *DRW_shgroup_instance_create(struct GPUShader *shader, DRWPass *pass, struct Batch *geom);
DRWShadingGroup *DRW_shgroup_point_batch_create(struct GPUShader *shader, DRWPass *pass);
DRWShadingGroup *DRW_shgroup_line_batch_create(struct GPUShader *shader, DRWPass *pass);
+DRWShadingGroup *DRW_shgroup_empty_tri_batch_create(struct GPUShader *shader, DRWPass *pass, int size);
void DRW_shgroup_free(struct DRWShadingGroup *shgroup);
void DRW_shgroup_call_add(DRWShadingGroup *shgroup, struct Batch *geom, float (*obmat)[4]);
@@ -269,6 +271,7 @@ void DRW_shgroup_call_dynamic_add_array(DRWShadingGroup *shgroup, const void *at
#define DRW_shgroup_call_dynamic_add_empty(shgroup) do { \
DRW_shgroup_call_dynamic_add_array(shgroup, NULL, 0); \
} while (0)
+void DRW_shgroup_set_instance_count(DRWShadingGroup *shgroup, int count);
void DRW_shgroup_state_enable(DRWShadingGroup *shgroup, DRWState state);
void DRW_shgroup_attrib_int(DRWShadingGroup *shgroup, const char *name, int size);
diff --git a/source/blender/draw/intern/draw_manager.c b/source/blender/draw/intern/draw_manager.c
index 1caf1abfd01..bc89775a45c 100644
--- a/source/blender/draw/intern/draw_manager.c
+++ b/source/blender/draw/intern/draw_manager.c
@@ -1210,10 +1210,22 @@ static void DRW_state_set(DRWState state)
/* Blending (all buffer) */
{
int test;
- if ((test = CHANGED_TO(DRW_STATE_BLEND))) {
- if (test == 1) {
+ if (CHANGED_ANY_STORE_VAR(
+ DRW_STATE_BLEND | DRW_STATE_ADDITIVE,
+ test))
+ {
+ if (test) {
glEnable(GL_BLEND);
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
+ if ((state & DRW_STATE_BLEND) != 0) {
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ }
+ else if ((state & DRW_STATE_ADDITIVE) != 0) {
+ glBlendFunc(GL_ONE, GL_ONE);
+ }
+ else {
+ BLI_assert(0);
+ }
}
else {
glDisable(GL_BLEND);
More information about the Bf-blender-cvs
mailing list