fix user alpha

This commit is contained in:
georges 2001-02-08 22:11:34 +00:00
parent 7296ae3a75
commit 0acafa7712
4 changed files with 40 additions and 19 deletions

View File

@ -148,17 +148,18 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
PT(ColorTransition) alpha;
xform = new TransformTransition(LMatrix4f::translate_mat(pos));
if ((_alpha_mode != PR_ALPHA_NONE) && (_alpha_mode != PR_ALPHA_USER)) {
if ((_alpha_mode != PR_ALPHA_NONE)) {
float alpha_scalar;
float alpha_scalar = cur_particle->get_parameterized_age();
if (_alpha_mode == PR_ALPHA_IN) {
alpha = new ColorTransition(1.0f, 1.0f, 1.0f, alpha_scalar);
}
else if (_alpha_mode == PR_ALPHA_OUT) {
alpha = new ColorTransition(1.0f, 1.0f, 1.0f, 1.0f - alpha_scalar);
if(_alpha_mode == PR_ALPHA_USER) {
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 = new ColorTransition(1.0f, 1.0f, 1.0f, alpha_scalar);
cur_arc->set_transition(alpha);
}

View File

@ -189,10 +189,16 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
// handle alpha
if (_alpha_mode != PR_ALPHA_NONE) {
float alpha = cur_particle->get_parameterized_age();
if (_alpha_mode == PR_ALPHA_OUT)
alpha = 1.0f - alpha;
float 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;
}
head_color[3] = alpha;
tail_color[3] = alpha;

View File

@ -175,14 +175,24 @@ create_color(const BaseParticle *p) {
// handle alpha channel
if (!((_alpha_mode == PR_ALPHA_NONE) || (_alpha_mode == PR_ALPHA_USER))) {
if(_alpha_mode != PR_ALPHA_NONE) {
if (have_alpha_t == false)
alpha_linear_t = p->get_parameterized_age();
if (_alpha_mode == PR_ALPHA_OUT)
color[3] = 1.0f - alpha_linear_t;
else
color[3] = alpha_linear_t;
switch(_alpha_mode) {
case PR_ALPHA_OUT:
color[3] = 1.0f - alpha_linear_t;
break;
case PR_ALPHA_IN:
color[3] = alpha_linear_t;
break;
case PR_ALPHA_USER:
color[3] = get_user_alpha();
break;
}
}
return color;

View File

@ -200,10 +200,14 @@ render(vector< PT(PhysicsObject) >& po_vector, int ttl_particles) {
// handle alpha
if (_alpha_mode != PR_ALPHA_NONE) {
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;
}
center_color[3] = alpha;
edge_color[3] = alpha;