From 1e6e04bb72ba9bbb14bf9615252e7afcbc967180 Mon Sep 17 00:00:00 2001 From: divverent Date: Sun, 23 Oct 2011 15:53:12 +0000 Subject: [PATCH] fix a sRGB conversion in effectinfo handling git-svn-id: svn://svn.icculus.org/twilight/trunk/darkplaces@11464 d7cf8633-e32d-0410-b094-e92efae38249 --- cl_particles.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cl_particles.c b/cl_particles.c index 70e1b292..d1a337ee 100644 --- a/cl_particles.c +++ b/cl_particles.c @@ -651,9 +651,9 @@ particle_t *CL_NewParticle(const vec3_t sortorigin, unsigned short ptypeindex, i part->color[2] = ((((pcolor1 >> 0) & 0xFF) * l1 + ((pcolor2 >> 0) & 0xFF) * l2) >> 8) & 0xFF; if (vid.sRGB3D) { - part->color[0] = (unsigned char)(Image_LinearFloatFromsRGB(part->color[0]) * 256.0f); - part->color[1] = (unsigned char)(Image_LinearFloatFromsRGB(part->color[1]) * 256.0f); - part->color[2] = (unsigned char)(Image_LinearFloatFromsRGB(part->color[2]) * 256.0f); + part->color[0] = (unsigned char)floor(Image_LinearFloatFromsRGB(part->color[0]) * 255.0f + 0.5f); + part->color[1] = (unsigned char)floor(Image_LinearFloatFromsRGB(part->color[1]) * 255.0f + 0.5f); + part->color[2] = (unsigned char)floor(Image_LinearFloatFromsRGB(part->color[2]) * 255.0f + 0.5f); } part->alpha = palpha; part->alphafade = palphafade; @@ -2307,7 +2307,7 @@ static void R_InitParticleTexture (void) Con_Printf("particles/particlefont.txt: texnum %i outside valid range (0 to %i)\n", i, MAX_PARTICLETEXTURES); continue; } - sf = R_SkinFrame_LoadExternal(texturename, TEXF_ALPHA | TEXF_FORCELINEAR | TEXF_RGBMULTIPLYBYALPHA, true); + sf = R_SkinFrame_LoadExternal(texturename, TEXF_ALPHA | TEXF_FORCELINEAR | TEXF_RGBMULTIPLYBYALPHA, true); // note: this loads as sRGB if sRGB is active! if(!sf) { // R_SkinFrame_LoadExternal already complained -- 2.39.2