mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 10:22:45 -04:00
apply user alpha even for other alpha modes
This commit is contained in:
parent
fb53a328b4
commit
008a9e9197
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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_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_OUT)
|
||||
alpha = 1.0f - alpha;
|
||||
}
|
||||
alpha *= get_user_alpha();
|
||||
}
|
||||
|
||||
center_color[3] = alpha;
|
||||
edge_color[3] = alpha;
|
||||
|
@ -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;
|
||||
|
Loading…
x
Reference in New Issue
Block a user