Browse Source

apply user alpha even for other alpha modes

David Rose 23 years ago
parent
commit
008a9e9197

+ 2 - 1
panda/src/particlesystem/geomParticleRenderer.cxx

@@ -189,11 +189,12 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
         float alpha_scalar;
 
         if(_alpha_mode == PR_ALPHA_USER) {
-          alpha_scalar=get_user_alpha();
+          alpha_scalar = get_user_alpha();
         } else {
           alpha_scalar = cur_particle->get_parameterized_age();
           if (_alpha_mode == PR_ALPHA_OUT)
             alpha_scalar = 1.0f - alpha_scalar;
+          alpha_scalar *= get_user_alpha();
         }
         
         cur_node->set_attrib(ColorAttrib::make_flat

+ 3 - 3
panda/src/particlesystem/pointParticleRenderer.cxx

@@ -193,16 +193,16 @@ create_color(const BaseParticle *p) {
 
   if(_alpha_mode != PR_ALPHA_NONE) {
     if(_alpha_mode == PR_ALPHA_USER) {
-      parameterized_age = get_user_alpha();
+      parameterized_age = 1.0;
     } else {
       if(!have_alpha_t)
         parameterized_age = p->get_parameterized_age();
 
       if(_alpha_mode==PR_ALPHA_OUT) {
-        parameterized_age=1.0f-parameterized_age;
+        parameterized_age = 1.0f - parameterized_age;
       }
     }
-    color[3] = parameterized_age;
+    color[3] = parameterized_age * get_user_alpha();
   }
 
   return color;

+ 9 - 8
panda/src/particlesystem/sparkleParticleRenderer.cxx

@@ -215,14 +215,15 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
     // handle alpha
 
     if (_alpha_mode != PR_ALPHA_NONE) {
-          if(_alpha_mode == PR_ALPHA_USER) {
-                  alpha=get_user_alpha();
-          } else {
-                  alpha = cur_particle->get_parameterized_age();
-
-                  if (_alpha_mode == PR_ALPHA_OUT)
-                          alpha = 1.0f - alpha;
-          }
+      if(_alpha_mode == PR_ALPHA_USER) {
+        alpha = get_user_alpha();
+      } else {
+        alpha = cur_particle->get_parameterized_age();
+        if (_alpha_mode == PR_ALPHA_OUT)
+          alpha = 1.0f - alpha;
+
+        alpha *= get_user_alpha();
+      }
 
       center_color[3] = alpha;
       edge_color[3] = alpha;

+ 7 - 7
panda/src/particlesystem/spriteParticleRenderer.cxx

@@ -321,18 +321,18 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
     // put the current color into the array
     Colorf c = _color;
 
-        int alphamode=get_alpha_mode();
+    int alphamode=get_alpha_mode();
     if (alphamode != PR_ALPHA_NONE) {
       float t = cur_particle->get_parameterized_age();
 
       if (alphamode == PR_ALPHA_OUT)
-        c[3] = 1.0f - t;
+        c[3] = (1.0f - t) * get_user_alpha();
       else if (alphamode == PR_ALPHA_IN)
-        c[3] = t;
-          else {
-                  assert(alphamode == PR_ALPHA_USER);
-                  c[3] = get_user_alpha();
-          }
+        c[3] = t * get_user_alpha();
+      else {
+        assert(alphamode == PR_ALPHA_USER);
+        c[3] = get_user_alpha();
+      }
     }
 
     *cur_color++ = c;