[Bf-blender-cvs] [355c699] master: Fix T37834: smoke opengl render not delivering correct alpha channel.
Brecht Van Lommel
noreply at git.blender.org
Wed Dec 18 17:25:50 CET 2013
Commit: 355c699dc6b6e95ef9305100a62efa7e70ae93ec
Author: Brecht Van Lommel
Date: Wed Dec 18 17:24:52 2013 +0100
http://developer.blender.org/rB355c699dc6b6e95ef9305100a62efa7e70ae93ec
Fix T37834: smoke opengl render not delivering correct alpha channel.
===================================================================
M source/blender/editors/space_view3d/drawvolume.c
===================================================================
diff --git a/source/blender/editors/space_view3d/drawvolume.c b/source/blender/editors/space_view3d/drawvolume.c
index 8fc12e8..6ee1df4 100644
--- a/source/blender/editors/space_view3d/drawvolume.c
+++ b/source/blender/editors/space_view3d/drawvolume.c
@@ -132,6 +132,8 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
float cor[3] = {1.0f, 1.0f, 1.0f};
int gl_depth = 0, gl_blend = 0;
+ int use_fire = (sds->active_fields & SM_ACTIVE_FIRE);
+
/* draw slices of smoke is adapted from c++ code authored
* by: Johannes Schmid and Ingemar Rask, 2006, johnny at grob.org */
float cv[][3] = {
@@ -460,22 +462,32 @@ void draw_smoke_volume(SmokeDomainSettings *sds, Object *ob,
}
/* render fire slice */
- glBlendFunc(GL_SRC_ALPHA, GL_ONE);
- glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, 1.0, 0.0, 0.0, 0.0);
- glBegin(GL_POLYGON);
- glColor3f(1.0, 1.0, 1.0);
- for (i = 0; i < numpoints; i++) {
- glTexCoord3d((points[i][0] - min[0]) * cor[0],
- (points[i][1] - min[1]) * cor[1],
- (points[i][2] - min[2]) * cor[2]);
- glVertex3f(points[i][0] * ob_sizei[0],
- points[i][1] * ob_sizei[1],
- points[i][2] * ob_sizei[2]);
+ if (use_fire) {
+ if (GLEW_VERSION_1_4)
+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE, GL_ONE, GL_ONE);
+ else
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE);
+
+ glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, 1.0, 0.0, 0.0, 0.0);
+ glBegin(GL_POLYGON);
+ glColor3f(1.0, 1.0, 1.0);
+ for (i = 0; i < numpoints; i++) {
+ glTexCoord3d((points[i][0] - min[0]) * cor[0],
+ (points[i][1] - min[1]) * cor[1],
+ (points[i][2] - min[2]) * cor[2]);
+ glVertex3f(points[i][0] * ob_sizei[0],
+ points[i][1] * ob_sizei[1],
+ points[i][2] * ob_sizei[2]);
+ }
+ glEnd();
}
- glEnd();
/* render smoke slice */
- glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+ if (GLEW_VERSION_1_4)
+ glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ONE_MINUS_SRC_ALPHA);
+ else
+ glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
+
glProgramLocalParameter4fARB(GL_FRAGMENT_PROGRAM_ARB, 2, -1.0, 0.0, 0.0, 0.0);
glBegin(GL_POLYGON);
glColor3f(1.0, 1.0, 1.0);
More information about the Bf-blender-cvs
mailing list