- pixelindex = ((tex[2]*resolution[1]+tex[1])*resolution[0]+tex[0]);
- pixel = pixels + 4 * pixelindex;
- highpixel = highpixels + 3 * pixelindex;
- // add to the high precision pixel color
- c[0] = highpixel[0] + (int)shotcolor[2];
- c[1] = highpixel[1] + (int)shotcolor[1];
- c[2] = highpixel[2] + (int)shotcolor[0];
- highpixel[0] = (unsigned short)min(c[0], 65535);
- highpixel[1] = (unsigned short)min(c[1], 65535);
- highpixel[2] = (unsigned short)min(c[2], 65535);
- // update the low precision pixel color
- pixel[0] = highpixel[0] >> 8;
- pixel[1] = highpixel[1] >> 8;
- pixel[2] = highpixel[2] >> 8;
- pixel[3] = 255;
+ splatcolor[0] = (int)shotcolor[2];
+ splatcolor[1] = (int)shotcolor[1];
+ splatcolor[2] = (int)shotcolor[0];
+ // calculate the lerp factors
+ if (r_shadow_bouncegrid_nolerpsplat.integer)
+ {
+ pixelindex[0] = (((tex[2] )*resolution[1]+tex[1] )*resolution[0]+tex[0] );
+ pixel = pixels + 4 * pixelindex[0];
+ highpixel = highpixels + 3 * pixelindex[0];
+ // add to the high precision pixel color
+ c[0] = highpixel[0] + splatcolor[0];
+ c[1] = highpixel[1] + splatcolor[1];
+ c[2] = highpixel[2] + splatcolor[2];
+ highpixel[0] = (unsigned short)min(c[0], 65535);
+ highpixel[1] = (unsigned short)min(c[1], 65535);
+ highpixel[2] = (unsigned short)min(c[2], 65535);
+ // update the low precision pixel color
+ pixel[0] = highpixel[0] >> 8;
+ pixel[1] = highpixel[1] >> 8;
+ pixel[2] = highpixel[2] >> 8;
+ pixel[3] = 255;
+ }
+ else
+ {
+ texlerp[1][0] &= 0xFF;
+ texlerp[1][1] &= 0xFF;
+ texlerp[1][2] &= 0xFF;
+ texlerp[0][0] = 256 - texlerp[1][0];
+ texlerp[0][1] = 256 - texlerp[1][1];
+ texlerp[0][2] = 256 - texlerp[1][2];
+ // calculate individual pixel indexes and weights
+ pixelindex[0] = (((tex[2] )*resolution[1]+tex[1] )*resolution[0]+tex[0] );pixelweight[0] = (texlerp[0][0]*texlerp[0][1]*texlerp[0][2]) >> 16;
+ pixelindex[1] = (((tex[2] )*resolution[1]+tex[1] )*resolution[0]+tex[0]+1);pixelweight[1] = (texlerp[1][0]*texlerp[0][1]*texlerp[0][2]) >> 16;
+ pixelindex[2] = (((tex[2] )*resolution[1]+tex[1]+1)*resolution[0]+tex[0] );pixelweight[2] = (texlerp[0][0]*texlerp[1][1]*texlerp[0][2]) >> 16;
+ pixelindex[3] = (((tex[2] )*resolution[1]+tex[1]+1)*resolution[0]+tex[0]+1);pixelweight[3] = (texlerp[1][0]*texlerp[1][1]*texlerp[0][2]) >> 16;
+ pixelindex[4] = (((tex[2]+1)*resolution[1]+tex[1] )*resolution[0]+tex[0] );pixelweight[4] = (texlerp[0][0]*texlerp[0][1]*texlerp[1][2]) >> 16;
+ pixelindex[5] = (((tex[2]+1)*resolution[1]+tex[1] )*resolution[0]+tex[0]+1);pixelweight[5] = (texlerp[1][0]*texlerp[0][1]*texlerp[1][2]) >> 16;
+ pixelindex[6] = (((tex[2]+1)*resolution[1]+tex[1]+1)*resolution[0]+tex[0] );pixelweight[6] = (texlerp[0][0]*texlerp[1][1]*texlerp[1][2]) >> 16;
+ pixelindex[7] = (((tex[2]+1)*resolution[1]+tex[1]+1)*resolution[0]+tex[0]+1);pixelweight[7] = (texlerp[1][0]*texlerp[1][1]*texlerp[1][2]) >> 16;
+ // update the 8 pixels...
+ for (corner = 0;corner < 8;corner++)
+ {
+ pixel = pixels + 4 * pixelindex[corner];
+ highpixel = highpixels + 3 * pixelindex[corner];
+ // add to the high precision pixel color
+ c[0] = highpixel[0] + ((splatcolor[0]*pixelweight[corner])>>8);
+ c[1] = highpixel[1] + ((splatcolor[1]*pixelweight[corner])>>8);
+ c[2] = highpixel[2] + ((splatcolor[2]*pixelweight[corner])>>8);
+ highpixel[0] = (unsigned short)min(c[0], 65535);
+ highpixel[1] = (unsigned short)min(c[1], 65535);
+ highpixel[2] = (unsigned short)min(c[2], 65535);
+ // update the low precision pixel color
+ pixel[0] = highpixel[0] >> 8;
+ pixel[1] = highpixel[1] >> 8;
+ pixel[2] = highpixel[2] >> 8;
+ pixel[3] = 255;
+ }
+ }