part->color[0] = ((((pcolor1 >> 16) & 0xFF) * l1 + ((pcolor2 >> 16) & 0xFF) * l2) >> 8) & 0xFF;
part->color[1] = ((((pcolor1 >> 8) & 0xFF) * l1 + ((pcolor2 >> 8) & 0xFF) * l2) >> 8) & 0xFF;
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->alpha = palpha;
part->alphafade = palphafade;
part->staintexnum = staintex;
if (cl_decals_newsystem.integer)
{
- R_DecalSystem_SplatEntities(org, normal, color[0]*(1.0f/255.0f), color[1]*(1.0f/255.0f), color[2]*(1.0f/255.0f), alpha*(1.0f/255.0f), particletexture[texnum].s1, particletexture[texnum].t1, particletexture[texnum].s2, particletexture[texnum].t2, size);
+ if (vid.sRGB3D)
+ R_DecalSystem_SplatEntities(org, normal, Image_LinearFloatFromsRGB(color[0]), Image_LinearFloatFromsRGB(color[1]), Image_LinearFloatFromsRGB(color[2]), alpha*(1.0f/255.0f), particletexture[texnum].s1, particletexture[texnum].t1, particletexture[texnum].s2, particletexture[texnum].t2, size);
+ else
+ R_DecalSystem_SplatEntities(org, normal, color[0]*(1.0f/255.0f), color[1]*(1.0f/255.0f), color[2]*(1.0f/255.0f), alpha*(1.0f/255.0f), particletexture[texnum].s1, particletexture[texnum].t1, particletexture[texnum].s2, particletexture[texnum].t2, size);
return;
}
decal->color[0] = color[0];
decal->color[1] = color[1];
decal->color[2] = color[2];
+ if (vid.sRGB3D)
+ {
+ decal->color[0] = (unsigned char)(Image_LinearFloatFromsRGB(decal->color[0]) * 256.0f);
+ decal->color[1] = (unsigned char)(Image_LinearFloatFromsRGB(decal->color[1]) * 256.0f);
+ decal->color[2] = (unsigned char)(Image_LinearFloatFromsRGB(decal->color[2]) * 256.0f);
+ }
decal->owner = hitent;
decal->clusterindex = -1000; // no vis culling unless we're sure
if (hitent)
// this math from http://www.opengl.org/registry/specs/EXT/texture_sRGB.txt
if (!image_linearfromsrgb[255])
for (i = 0;i < 256;i++)
- image_linearfromsrgb[i] = i < 11 ? (int)(i / 12.92f) : (int)(pow((i/256.0f + 0.055f)/1.0555f, 2.4f)*256.0f);
+ image_linearfromsrgb[i] = (unsigned char)(Image_LinearFloatFromsRGB(i) * 256.0f);
for (i = 0;i < numpixels;i++)
{
pout[i*4+0] = image_linearfromsrgb[pin[i*4+0]];
void Image_FixTransparentPixels_f(void);
extern cvar_t r_fixtrans_auto;
+#define Image_LinearFloatFromsRGB(c) (((c) < 11) ? (c) * 0.000302341331f : (float)pow(((c)*(1.0f/256.0f) + 0.055f)*(1.0f/1.0555f), 2.4f))
+
void Image_MakeLinearColorsFromsRGB(unsigned char *pout, const unsigned char *pin, int numpixels);
#endif
#include "quakedef.h"
#include "cl_collision.h"
+#include "image.h"
void CL_VM_UpdateDmgGlobals (int dmg_take, int dmg_save, vec3_t dmg_origin);
a2 = 1 / r_refdef.viewblend[3];
VectorScale(r_refdef.viewblend, a2, r_refdef.viewblend);
}
- r_refdef.viewblend[0] = bound(0.0f, r_refdef.viewblend[0] * (1.0f/255.0f), 1.0f);
- r_refdef.viewblend[1] = bound(0.0f, r_refdef.viewblend[1] * (1.0f/255.0f), 1.0f);
- r_refdef.viewblend[2] = bound(0.0f, r_refdef.viewblend[2] * (1.0f/255.0f), 1.0f);
+ r_refdef.viewblend[0] = bound(0.0f, r_refdef.viewblend[0], 255.0f);
+ r_refdef.viewblend[1] = bound(0.0f, r_refdef.viewblend[1], 255.0f);
+ r_refdef.viewblend[2] = bound(0.0f, r_refdef.viewblend[2], 255.0f);
r_refdef.viewblend[3] = bound(0.0f, r_refdef.viewblend[3] * gl_polyblend.value, 1.0f);
+ if (vid.sRGB3D)
+ {
+ r_refdef.viewblend[0] = Image_LinearFloatFromsRGB(r_refdef.viewblend[0]);
+ r_refdef.viewblend[1] = Image_LinearFloatFromsRGB(r_refdef.viewblend[1]);
+ r_refdef.viewblend[2] = Image_LinearFloatFromsRGB(r_refdef.viewblend[2]);
+ }
+ else
+ {
+ r_refdef.viewblend[0] *= (1.0f/256.0f);
+ r_refdef.viewblend[1] *= (1.0f/256.0f);
+ r_refdef.viewblend[2] *= (1.0f/256.0f);
+ }
// Samual: Ugly hack, I know. But it's the best we can do since
// there is no way to detect client states from the engine.