mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-03 18:31:55 -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;
|
float alpha_scalar;
|
||||||
|
|
||||||
if(_alpha_mode == PR_ALPHA_USER) {
|
if(_alpha_mode == PR_ALPHA_USER) {
|
||||||
alpha_scalar=get_user_alpha();
|
alpha_scalar = get_user_alpha();
|
||||||
} else {
|
} else {
|
||||||
alpha_scalar = cur_particle->get_parameterized_age();
|
alpha_scalar = cur_particle->get_parameterized_age();
|
||||||
if (_alpha_mode == PR_ALPHA_OUT)
|
if (_alpha_mode == PR_ALPHA_OUT)
|
||||||
alpha_scalar = 1.0f - alpha_scalar;
|
alpha_scalar = 1.0f - alpha_scalar;
|
||||||
|
alpha_scalar *= get_user_alpha();
|
||||||
}
|
}
|
||||||
|
|
||||||
cur_node->set_attrib(ColorAttrib::make_flat
|
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_NONE) {
|
||||||
if(_alpha_mode == PR_ALPHA_USER) {
|
if(_alpha_mode == PR_ALPHA_USER) {
|
||||||
parameterized_age = get_user_alpha();
|
parameterized_age = 1.0;
|
||||||
} else {
|
} else {
|
||||||
if(!have_alpha_t)
|
if(!have_alpha_t)
|
||||||
parameterized_age = p->get_parameterized_age();
|
parameterized_age = p->get_parameterized_age();
|
||||||
|
|
||||||
if(_alpha_mode==PR_ALPHA_OUT) {
|
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;
|
return color;
|
||||||
|
@ -215,14 +215,15 @@ render(pvector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
|
|||||||
// handle alpha
|
// handle alpha
|
||||||
|
|
||||||
if (_alpha_mode != PR_ALPHA_NONE) {
|
if (_alpha_mode != PR_ALPHA_NONE) {
|
||||||
if(_alpha_mode == PR_ALPHA_USER) {
|
if(_alpha_mode == PR_ALPHA_USER) {
|
||||||
alpha=get_user_alpha();
|
alpha = get_user_alpha();
|
||||||
} else {
|
} else {
|
||||||
alpha = cur_particle->get_parameterized_age();
|
alpha = cur_particle->get_parameterized_age();
|
||||||
|
if (_alpha_mode == PR_ALPHA_OUT)
|
||||||
|
alpha = 1.0f - alpha;
|
||||||
|
|
||||||
if (_alpha_mode == PR_ALPHA_OUT)
|
alpha *= get_user_alpha();
|
||||||
alpha = 1.0f - alpha;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
center_color[3] = alpha;
|
center_color[3] = alpha;
|
||||||
edge_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
|
// put the current color into the array
|
||||||
Colorf c = _color;
|
Colorf c = _color;
|
||||||
|
|
||||||
int alphamode=get_alpha_mode();
|
int alphamode=get_alpha_mode();
|
||||||
if (alphamode != PR_ALPHA_NONE) {
|
if (alphamode != PR_ALPHA_NONE) {
|
||||||
float t = cur_particle->get_parameterized_age();
|
float t = cur_particle->get_parameterized_age();
|
||||||
|
|
||||||
if (alphamode == PR_ALPHA_OUT)
|
if (alphamode == PR_ALPHA_OUT)
|
||||||
c[3] = 1.0f - t;
|
c[3] = (1.0f - t) * get_user_alpha();
|
||||||
else if (alphamode == PR_ALPHA_IN)
|
else if (alphamode == PR_ALPHA_IN)
|
||||||
c[3] = t;
|
c[3] = t * get_user_alpha();
|
||||||
else {
|
else {
|
||||||
assert(alphamode == PR_ALPHA_USER);
|
assert(alphamode == PR_ALPHA_USER);
|
||||||
c[3] = get_user_alpha();
|
c[3] = get_user_alpha();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*cur_color++ = c;
|
*cur_color++ = c;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user