char *buf;
fs_offset_t filesize;
char texturename[MAX_QPATH];
+ skinframe_t *sf;
// a note: decals need to modulate (multiply) the background color to
// properly darken it (stain), and they need to be able to alpha fade,
Con_Printf("particles/particlefont.txt: texnum %i outside valid range (0 to %i)\n", i, MAX_PARTICLETEXTURES);
continue;
}
- particletexture[i].texture = R_SkinFrame_LoadExternal(texturename, TEXF_ALPHA | TEXF_FORCELINEAR | TEXF_RGBMULTIPLYBYALPHA, false)->base;
+ sf = R_SkinFrame_LoadExternal(texturename, TEXF_ALPHA | TEXF_FORCELINEAR | TEXF_RGBMULTIPLYBYALPHA, true);
+ if(!sf)
+ {
+ // R_SkinFrame_LoadExternal already complained
+ continue;
+ }
+ particletexture[i].texture = sf->base;
particletexture[i].s1 = s1;
particletexture[i].t1 = t1;
particletexture[i].s2 = s2;
c4f[3] = 0;
break;
case PBLEND_ALPHA:
- c4f[0] = alpha * p->color[0] * colormultiplier[0];
- c4f[1] = alpha * p->color[1] * colormultiplier[1];
- c4f[2] = alpha * p->color[2] * colormultiplier[2];
+ c4f[0] = p->color[0] * colormultiplier[0];
+ c4f[1] = p->color[1] * colormultiplier[1];
+ c4f[2] = p->color[2] * colormultiplier[2];
c4f[3] = alpha;
// note: lighting is not cheap!
if (particletype[p->typeindex].lighting)
{
- R_CompleteLightPoint(ambient, diffuse, diffusenormal, p->org, true, false);
+ R_CompleteLightPoint(ambient, diffuse, diffusenormal, p->org, LP_LIGHTMAP | LP_RTWORLD | LP_DYNLIGHT);
c4f[0] *= (ambient[0] + 0.5 * diffuse[0]);
c4f[1] *= (ambient[1] + 0.5 * diffuse[1]);
c4f[2] *= (ambient[2] + 0.5 * diffuse[2]);
c4f[1] = c4f[1] * fog + r_refdef.fogcolor[1] * ifog;
c4f[2] = c4f[2] * fog + r_refdef.fogcolor[2] * ifog;
}
+ // for premultiplied alpha we have to apply the alpha to the color (after fog of course)
+ VectorScale(c4f, alpha, c4f);
break;
}
// copy the color into the other three vertices