This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to annotated tag 1.5a
in repository iortcw.

commit 0e65f1e76e4e4f4968f9e0ca4095557b25cade12
Author: MAN-AT-ARMS <m4n4t4...@gmail.com>
Date:   Wed Oct 19 17:54:00 2016 -0400

    All: Rend2: Store vertex colors and hdr lightmaps/lightgrid as RGBA16
---
 MP/code/rend2/tr_backend.c    |  40 +++++-----
 MP/code/rend2/tr_bsp.c        |  95 ++++++++++++++--------
 MP/code/rend2/tr_curve.c      |   8 +-
 MP/code/rend2/tr_extensions.c |   7 --
 MP/code/rend2/tr_extramath.c  |  20 ++++-
 MP/code/rend2/tr_extramath.h  |   1 +
 MP/code/rend2/tr_flares.c     |  46 +++++------
 MP/code/rend2/tr_glsl.c       |   3 -
 MP/code/rend2/tr_image.c      | 181 ++++++++++++++----------------------------
 MP/code/rend2/tr_light.c      |  40 +++++++---
 MP/code/rend2/tr_local.h      |  15 ++--
 MP/code/rend2/tr_model_iqm.c  |  14 ++--
 MP/code/rend2/tr_shade_calc.c |   4 +-
 MP/code/rend2/tr_surface.c    |  62 ++++++++-------
 MP/code/rend2/tr_vbo.c        |  49 ++++--------
 MP/code/renderer/tr_light.c   |  19 ++++-
 SP/code/rend2/tr_backend.c    |  34 ++++----
 SP/code/rend2/tr_bsp.c        |  97 ++++++++++++++--------
 SP/code/rend2/tr_curve.c      |   8 +-
 SP/code/rend2/tr_extensions.c |   7 --
 SP/code/rend2/tr_extramath.c  |  20 ++++-
 SP/code/rend2/tr_extramath.h  |   1 +
 SP/code/rend2/tr_flares.c     |  46 +++++------
 SP/code/rend2/tr_glsl.c       |   3 -
 SP/code/rend2/tr_image.c      | 181 ++++++++++++++----------------------------
 SP/code/rend2/tr_light.c      |  41 ++++++----
 SP/code/rend2/tr_local.h      |  15 ++--
 SP/code/rend2/tr_model_iqm.c  |  14 ++--
 SP/code/rend2/tr_shade_calc.c |   4 +-
 SP/code/rend2/tr_surface.c    |  62 ++++++++-------
 SP/code/rend2/tr_vbo.c        |  49 ++++--------
 SP/code/renderer/tr_light.c   |  19 ++++-
 32 files changed, 584 insertions(+), 621 deletions(-)

diff --git a/MP/code/rend2/tr_backend.c b/MP/code/rend2/tr_backend.c
index 8662635..aade234 100644
--- a/MP/code/rend2/tr_backend.c
+++ b/MP/code/rend2/tr_backend.c
@@ -956,14 +956,14 @@ const void *RB_StretchPic( const void *data ) {
        tess.indexes[ numIndexes + 5 ] = numVerts + 1;
 
        {
-               vec4_t color;
+               uint16_t color[4];
 
-               VectorScale4(backEnd.color2D, 1.0f / 255.0f, color);
+               VectorScale4(backEnd.color2D, 257, color);
 
-               VectorCopy4(color, tess.vertexColors[ numVerts ]);
-               VectorCopy4(color, tess.vertexColors[ numVerts + 1]);
-               VectorCopy4(color, tess.vertexColors[ numVerts + 2]);
-               VectorCopy4(color, tess.vertexColors[ numVerts + 3 ]);
+               VectorCopy4(color, tess.color[ numVerts ]);
+               VectorCopy4(color, tess.color[ numVerts + 1]);
+               VectorCopy4(color, tess.color[ numVerts + 2]);
+               VectorCopy4(color, tess.color[ numVerts + 3 ]);
        }
 
        tess.xyz[ numVerts ][0] = cmd->x;
@@ -1051,14 +1051,14 @@ const void *RB_RotatedPic( const void *data ) {
        tess.indexes[ numIndexes + 5 ] = numVerts + 1;
 
        {
-               vec4_t color;
+               uint16_t color[4];
 
-               VectorScale4(backEnd.color2D, 1.0f / 255.0f, color);
+               VectorScale4(backEnd.color2D, 257, color);
 
-               VectorCopy4(color, tess.vertexColors[ numVerts ]);
-               VectorCopy4(color, tess.vertexColors[ numVerts + 1]);
-               VectorCopy4(color, tess.vertexColors[ numVerts + 2]);
-               VectorCopy4(color, tess.vertexColors[ numVerts + 3 ]);
+               VectorCopy4(color, tess.color[ numVerts ]);
+               VectorCopy4(color, tess.color[ numVerts + 1]);
+               VectorCopy4(color, tess.color[ numVerts + 2]);
+               VectorCopy4(color, tess.color[ numVerts + 3 ]);
        }
 
        angle = cmd->angle * pi2;
@@ -1147,16 +1147,16 @@ const void *RB_StretchPicGradient( const void *data ) {
        tess.indexes[ numIndexes + 4 ] = numVerts + 0;
        tess.indexes[ numIndexes + 5 ] = numVerts + 1;
 
-//     *(int *)tess.vertexColors[ numVerts ] =
-//             *(int *)tess.vertexColors[ numVerts + 1 ] =
-//             *(int *)tess.vertexColors[ numVerts + 2 ] =
-//             *(int *)tess.vertexColors[ numVerts + 3 ] = *(int 
*)backEnd.color2D;
+//     *(int *)tess.color[ numVerts ] =
+//             *(int *)tess.color[ numVerts + 1 ] =
+//             *(int *)tess.color[ numVerts + 2 ] =
+//             *(int *)tess.color[ numVerts + 3 ] = *(int *)backEnd.color2D;
 
-       *(int *)tess.vertexColors[ numVerts ] =
-               *(int *)tess.vertexColors[ numVerts + 1 ] = *(int 
*)backEnd.color2D;
+       *(int *)tess.color[ numVerts ] =
+               *(int *)tess.color[ numVerts + 1 ] = *(int *)backEnd.color2D;
 
-       *(int *)tess.vertexColors[ numVerts + 2 ] =
-               *(int *)tess.vertexColors[ numVerts + 3 ] = *(int 
*)cmd->gradientColor;
+       *(int *)tess.color[ numVerts + 2 ] =
+               *(int *)tess.color[ numVerts + 3 ] = *(int *)cmd->gradientColor;
 
        tess.xyz[ numVerts ][0] = cmd->x;
        tess.xyz[ numVerts ][1] = cmd->y;
diff --git a/MP/code/rend2/tr_bsp.c b/MP/code/rend2/tr_bsp.c
index a22d8f4..c4b7984 100644
--- a/MP/code/rend2/tr_bsp.c
+++ b/MP/code/rend2/tr_bsp.c
@@ -141,11 +141,11 @@ R_ColorShiftLightingFloats
 
 ===============
 */
-static void R_ColorShiftLightingFloats(float in[4], float out[4], float scale )
+static void R_ColorShiftLightingFloats(float in[4], float out[4])
 {
        float   r, g, b;
 
-       scale *= 1 << (r_mapOverBrightBits->integer - tr.overbrightBits);
+       float   scale = (1 << (r_mapOverBrightBits->integer - 
tr.overbrightBits)) / 255.0f;
 
        r = in[0] * scale;
        g = in[1] * scale;
@@ -192,12 +192,11 @@ void ColorToRGBM(const vec3_t color, unsigned char 
rgbm[4])
 }
 
 
-void ColorToRGBA16F(const vec3_t color, unsigned short rgba16f[4])
+void ColorToRGB16(const vec3_t color, uint16_t rgb16[3])
 {
-       rgba16f[0] = FloatToHalf(color[0]);
-       rgba16f[1] = FloatToHalf(color[1]);
-       rgba16f[2] = FloatToHalf(color[2]);
-       rgba16f[3] = FloatToHalf(1.0f);
+       rgb16[0] = color[0] * 65535.0f + 0.5f;
+       rgb16[1] = color[1] * 65535.0f + 0.5f;
+       rgb16[2] = color[2] * 65535.0f + 0.5f;
 }
 
 /*
@@ -283,10 +282,16 @@ static    void R_LoadLightmaps( lump_t *l, lump_t *surfs 
) {
        if (tr.worldDeluxeMapping)
                tr.deluxemaps = ri.Hunk_Alloc( tr.numLightmaps * sizeof(image_t 
*), h_low );
 
-       if (glRefConfig.floatLightmap)
-               textureInternalFormat = GL_RGBA16F_ARB;
-       else
-               textureInternalFormat = GL_RGBA8;
+       textureInternalFormat = GL_RGBA8;
+       if (r_hdr->integer)
+       {
+               // Check for the first hdr lightmap, if it exists, use 
GL_RGBA16 for textures.
+               char filename[MAX_QPATH];
+
+               Com_sprintf(filename, sizeof(filename), "maps/%s/lm_0000.hdr", 
s_worldData.baseName);
+               if (ri.FS_FileExists(filename))
+                       textureInternalFormat = GL_RGBA16;
+       }
 
        if (r_mergeLightmaps->integer)
        {
@@ -324,7 +329,7 @@ static      void R_LoadLightmaps( lump_t *l, lump_t *surfs 
) {
                        int size = 0;
 
                        // look for hdr lightmaps
-                       if (r_hdr->integer)
+                       if (textureInternalFormat == GL_RGBA16)
                        {
                                Com_sprintf( filename, sizeof( filename ), 
"maps/%s/lm_%04d.hdr", s_worldData.baseName, i * (tr.worldDeluxeMapping ? 2 : 
1) );
                                //ri.Printf(PRINT_ALL, "looking for %s\n", 
filename);
@@ -387,14 +392,12 @@ static    void R_LoadLightmaps( lump_t *l, lump_t *surfs 
) {
 #endif
                                        color[3] = 1.0f;
 
-                                       R_ColorShiftLightingFloats(color, 
color, 1.0f/255.0f);
+                                       R_ColorShiftLightingFloats(color, 
color);
 
-                                       if (glRefConfig.floatLightmap)
-                                               ColorToRGBA16F(color, (unsigned 
short *)(&image[j*8]));
-                                       else
-                                               ColorToRGBM(color, &image[j*4]);
+                                       ColorToRGB16(color, (uint16_t 
*)(&image[j * 8]));
+                                       ((uint16_t *)(&image[j * 8]))[3] = 
65535;
                                }
-                               else if (glRefConfig.floatLightmap)
+                               else if (textureInternalFormat == GL_RGBA16)
                                {
                                        vec4_t color;
 
@@ -414,9 +417,10 @@ static     void R_LoadLightmaps( lump_t *l, lump_t *surfs 
) {
                                        }
                                        color[3] = 1.0f;
 
-                                       R_ColorShiftLightingFloats(color, 
color, 1.0f/255.0f);
-
-                                       ColorToRGBA16F(color, (unsigned short 
*)(&image[j*8]));
+                                       R_ColorShiftLightingFloats(color, 
color);
+ 
+                                       ColorToRGB16(color, (uint16_t 
*)(&image[j * 8]));
+                                       ((uint16_t *)(&image[j * 8]))[3] = 
65535;
                                }
                                else
                                {
@@ -726,7 +730,8 @@ void LoadDrawVertToSrfVert(srfVert_t *s, drawVert_t *d, int 
realLightmapNum, flo
        }
        v[3] = d->color[3] / 255.0f;
 
-       R_ColorShiftLightingFloats(v, s->vertexColors, 1.0f / 255.0f);
+       R_ColorShiftLightingFloats(v, v);
+       R_VaoPackColor(s->color, v);
 }
 
 
@@ -1970,7 +1975,7 @@ static void CopyVert(const srfVert_t * in, srfVert_t * 
out)
        VectorCopy2(in->st,       out->st);
        VectorCopy2(in->lightmap, out->lightmap);
 
-       VectorCopy4(in->vertexColors, out->vertexColors);
+       VectorCopy4(in->color,    out->color);
 }
 
 
@@ -2985,25 +2990,47 @@ void R_LoadLightGrid( lump_t *l ) {
 
                if (hdrLightGrid)
                {
-                       float lightScale = 1 << (r_mapOverBrightBits->integer - 
tr.overbrightBits);
-
                        //ri.Printf(PRINT_ALL, "found!\n");
 
                        if (size != sizeof(float) * 6 * numGridPoints)
-                       {
                                ri.Error(ERR_DROP, "Bad size for %s (%i, 
expected %i)!", filename, size, (int)(sizeof(float)) * 6 * numGridPoints);
-                       }
 
-                       w->hdrLightGrid = ri.Hunk_Alloc(size, h_low);
+                       w->lightGrid16 = ri.Hunk_Alloc(sizeof(w->lightGrid16) * 
6 * numGridPoints, h_low);
 
                        for (i = 0; i < numGridPoints ; i++)
                        {
-                               w->hdrLightGrid[i * 6    ] = hdrLightGrid[i * 6 
   ] * lightScale;
-                               w->hdrLightGrid[i * 6 + 1] = hdrLightGrid[i * 6 
+ 1] * lightScale;
-                               w->hdrLightGrid[i * 6 + 2] = hdrLightGrid[i * 6 
+ 2] * lightScale;
-                               w->hdrLightGrid[i * 6 + 3] = hdrLightGrid[i * 6 
+ 3] * lightScale;
-                               w->hdrLightGrid[i * 6 + 4] = hdrLightGrid[i * 6 
+ 4] * lightScale;
-                               w->hdrLightGrid[i * 6 + 5] = hdrLightGrid[i * 6 
+ 5] * lightScale;
+                               vec4_t c;
+
+                               c[0] = hdrLightGrid[i * 6];
+                               c[1] = hdrLightGrid[i * 6 + 1];
+                               c[2] = hdrLightGrid[i * 6 + 2];
+                               c[3] = 1.0f;
+
+                               R_ColorShiftLightingFloats(c, c);
+                               ColorToRGB16(c, &w->lightGrid16[i * 6]);
+
+                               c[0] = hdrLightGrid[i * 6 + 3];
+                               c[1] = hdrLightGrid[i * 6 + 4];
+                               c[2] = hdrLightGrid[i * 6 + 5];
+                               c[3] = 1.0f;
+
+                               R_ColorShiftLightingFloats(c, c);
+                               ColorToRGB16(c, &w->lightGrid16[i * 6 + 3]);
+                       }
+               }
+               else if (0)
+               {
+                       // promote 8-bit lightgrid to 16-bit
+                       w->lightGrid16 = ri.Hunk_Alloc(sizeof(w->lightGrid16) * 
6 * numGridPoints, h_low);
+
+                       for (i = 0; i < numGridPoints; i++)
+                       {
+                               w->lightGrid16[i * 6]     = w->lightGridData[i 
* 8] * 257;
+                               w->lightGrid16[i * 6 + 1] = w->lightGridData[i 
* 8 + 1] * 257;
+                               w->lightGrid16[i * 6 + 2] = w->lightGridData[i 
* 8 + 2] * 257;
+                               w->lightGrid16[i * 6 + 3] = w->lightGridData[i 
* 8 + 3] * 257;
+                               w->lightGrid16[i * 6 + 4] = w->lightGridData[i 
* 8 + 4] * 257;
+                               w->lightGrid16[i * 6 + 5] = w->lightGridData[i 
* 8 + 5] * 257;
                        }
                }
 
diff --git a/MP/code/rend2/tr_curve.c b/MP/code/rend2/tr_curve.c
index 3a0acae..4bb0d76 100644
--- a/MP/code/rend2/tr_curve.c
+++ b/MP/code/rend2/tr_curve.c
@@ -61,10 +61,10 @@ static void LerpDrawVert( srfVert_t *a, srfVert_t *b, 
srfVert_t *out ) {
        out->lightmap[0] = 0.5f * ( a->lightmap[0] + b->lightmap[0] );
        out->lightmap[1] = 0.5f * ( a->lightmap[1] + b->lightmap[1] );
 
-       out->vertexColors[0] = 0.5f * (a->vertexColors[0] + b->vertexColors[0]);
-       out->vertexColors[1] = 0.5f * (a->vertexColors[1] + b->vertexColors[1]);
-       out->vertexColors[2] = 0.5f * (a->vertexColors[2] + b->vertexColors[2]);
-       out->vertexColors[3] = 0.5f * (a->vertexColors[3] + b->vertexColors[3]);
+       out->color[0] = ((int)a->color[0] + (int)b->color[0]) >> 1;
+       out->color[1] = ((int)a->color[1] + (int)b->color[1]) >> 1;
+       out->color[2] = ((int)a->color[2] + (int)b->color[2]) >> 1;
+       out->color[3] = ((int)a->color[3] + (int)b->color[3]) >> 1;
 }
 
 /*
diff --git a/MP/code/rend2/tr_extensions.c b/MP/code/rend2/tr_extensions.c
index 6c0b8ca..9be4800 100644
--- a/MP/code/rend2/tr_extensions.c
+++ b/MP/code/rend2/tr_extensions.c
@@ -295,9 +295,6 @@ void GLimp_InitExtraExtensions()
                ri.Printf(PRINT_ALL, result[2], extension);
        }
 
-       // use float lightmaps?
-       glRefConfig.floatLightmap = (glRefConfig.textureFloat && 
glRefConfig.halfFloatPixel && r_floatLightmap->integer && r_hdr->integer);
-
        // GL_ARB_vertex_array_object
        extension = "GL_ARB_vertex_array_object";
        glRefConfig.vertexArrayObject = qfalse;
@@ -318,8 +315,6 @@ void GLimp_InitExtraExtensions()
        extension = "GL_ARB_half_float_vertex";
        glRefConfig.packedTexcoordDataType = GL_FLOAT;
        glRefConfig.packedTexcoordDataSize = sizeof(float) * 2;
-       glRefConfig.packedColorDataType    = GL_FLOAT;
-       glRefConfig.packedColorDataSize    = sizeof(float) * 4;
        if( GLimp_HaveExtension( extension ) )
        {
                qboolean useExt = !!r_arb_half_float_vertex->integer;
@@ -328,8 +323,6 @@ void GLimp_InitExtraExtensions()
                {
                        glRefConfig.packedTexcoordDataType = GL_HALF_FLOAT;
                        glRefConfig.packedTexcoordDataSize = sizeof(uint16_t) * 
2;
-                       glRefConfig.packedColorDataType    = GL_HALF_FLOAT;
-                       glRefConfig.packedColorDataSize    = sizeof(uint16_t) * 
4;
                }
 
                ri.Printf(PRINT_ALL, result[useExt], extension);
diff --git a/MP/code/rend2/tr_extramath.c b/MP/code/rend2/tr_extramath.c
index bded757..a6c2a0d 100644
--- a/MP/code/rend2/tr_extramath.c
+++ b/MP/code/rend2/tr_extramath.c
@@ -201,7 +201,7 @@ int NextPowerOfTwo(int in)
 
 union f32_u {
        float f;
-       uint32_t i;
+       uint32_t ui;
        struct {
                unsigned int fraction:23;
                unsigned int exponent:8;
@@ -210,7 +210,7 @@ union f32_u {
 };
 
 union f16_u {
-       uint16_t i;
+       uint16_t ui;
        struct {
                unsigned int fraction:10;
                unsigned int exponent:5;
@@ -229,5 +229,19 @@ uint16_t FloatToHalf(float in)
        f16.pack.fraction = f32.pack.fraction >> 13;
        f16.pack.sign     = f32.pack.sign;
 
-       return f16.i;
+       return f16.ui;
+}
+
+float HalfToFloat(uint16_t in)
+{
+       union f32_u f32;
+       union f16_u f16;
+
+       f16.ui = in;
+
+       f32.pack.exponent = (int)(f16.pack.exponent) + 112;
+       f32.pack.fraction = f16.pack.fraction << 13;
+       f32.pack.sign = f16.pack.sign;
+
+       return f32.f;
 }
diff --git a/MP/code/rend2/tr_extramath.h b/MP/code/rend2/tr_extramath.h
index 9327153..d9ce170 100644
--- a/MP/code/rend2/tr_extramath.h
+++ b/MP/code/rend2/tr_extramath.h
@@ -98,5 +98,6 @@ void BoundingSphereOfSpheres(vec3_t origin1, float radius1, 
vec3_t origin2, floa
 
 int NextPowerOfTwo(int in);
 unsigned short FloatToHalf(float in);
+float HalfToFloat(unsigned short in);
 
 #endif
diff --git a/MP/code/rend2/tr_flares.c b/MP/code/rend2/tr_flares.c
index d4f6a5c..e7827c0 100644
--- a/MP/code/rend2/tr_flares.c
+++ b/MP/code/rend2/tr_flares.c
@@ -465,9 +465,9 @@ void RB_RenderFlare( flare_t *f ) {
                        return;
        }
 
-       iColor[0] = color[0] * fogFactors[0];
-       iColor[1] = color[1] * fogFactors[1];
-       iColor[2] = color[2] * fogFactors[2];
+       iColor[0] = color[0] * fogFactors[0] * 257;
+       iColor[1] = color[1] * fogFactors[1] * 257;
+       iColor[2] = color[2] * fogFactors[2] * 257;
 
        RB_BeginSurface( tr.flareShader, f->fogNum, 0 );
 
@@ -476,44 +476,44 @@ void RB_RenderFlare( flare_t *f ) {
        tess.xyz[tess.numVertexes][1] = f->windowY - size;
        tess.texCoords[tess.numVertexes][0][0] = 0;
        tess.texCoords[tess.numVertexes][0][1] = 0;
-       tess.vertexColors[tess.numVertexes][0] = iColor[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = iColor[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = iColor[2] / 255.0f;
-       tess.vertexColors[tess.numVertexes][3] = f->drawIntensity;      
//----(SA)      mod for alpha blend rather than additive
-//     tess.vertexColors[tess.numVertexes][3] = 1.0f;          // rend2
+       tess.color[tess.numVertexes][0] = iColor[0];
+       tess.color[tess.numVertexes][1] = iColor[1];
+       tess.color[tess.numVertexes][2] = iColor[2];
+//     tess.color[tess.numVertexes][3] = 65535;                        // rend2
+       tess.color[tess.numVertexes][3] = f->drawIntensity * 65535;     
//----(SA)      mod for alpha blend rather than additive
        tess.numVertexes++;
 
        tess.xyz[tess.numVertexes][0] = f->windowX - size;
        tess.xyz[tess.numVertexes][1] = f->windowY + size;
        tess.texCoords[tess.numVertexes][0][0] = 0;
        tess.texCoords[tess.numVertexes][0][1] = 1;
-       tess.vertexColors[tess.numVertexes][0] = iColor[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = iColor[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = iColor[2] / 255.0f;
-       tess.vertexColors[tess.numVertexes][3] = f->drawIntensity;      
//----(SA)      mod for alpha blend rather than additive
-//     tess.vertexColors[tess.numVertexes][3] = 1.0f;          // rend2
+       tess.color[tess.numVertexes][0] = iColor[0];
+       tess.color[tess.numVertexes][1] = iColor[1];
+       tess.color[tess.numVertexes][2] = iColor[2];
+//     tess.color[tess.numVertexes][3] = 65535;                        // rend2
+       tess.color[tess.numVertexes][3] = f->drawIntensity * 65535;     
//----(SA)      mod for alpha blend rather than additive
        tess.numVertexes++;
 
        tess.xyz[tess.numVertexes][0] = f->windowX + size;
        tess.xyz[tess.numVertexes][1] = f->windowY + size;
        tess.texCoords[tess.numVertexes][0][0] = 1;
        tess.texCoords[tess.numVertexes][0][1] = 1;
-       tess.vertexColors[tess.numVertexes][0] = iColor[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = iColor[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = iColor[2] / 255.0f;
-       tess.vertexColors[tess.numVertexes][3] = f->drawIntensity;      
//----(SA)      mod for alpha blend rather than additive
-//     tess.vertexColors[tess.numVertexes][3] = 1.0f;          // rend2
+       tess.color[tess.numVertexes][0] = iColor[0];
+       tess.color[tess.numVertexes][1] = iColor[1];
+       tess.color[tess.numVertexes][2] = iColor[2];
+//     tess.color[tess.numVertexes][3] = 65535;                        // rend2
+       tess.color[tess.numVertexes][3] = f->drawIntensity * 65535;     
//----(SA)      mod for alpha blend rather than additive
        tess.numVertexes++;
 
        tess.xyz[tess.numVertexes][0] = f->windowX + size;
        tess.xyz[tess.numVertexes][1] = f->windowY - size;
        tess.texCoords[tess.numVertexes][0][0] = 1;
        tess.texCoords[tess.numVertexes][0][1] = 0;
-       tess.vertexColors[tess.numVertexes][0] = iColor[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = iColor[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = iColor[2] / 255.0f;
-       tess.vertexColors[tess.numVertexes][3] = f->drawIntensity;      
//----(SA)      mod for alpha blend rather than additive
-//     tess.vertexColors[tess.numVertexes][3] = 1.0f;          // rend2
+       tess.color[tess.numVertexes][0] = iColor[0];
+       tess.color[tess.numVertexes][1] = iColor[1];
+       tess.color[tess.numVertexes][2] = iColor[2];
+//     tess.color[tess.numVertexes][3] = 65535;                        // rend2
+       tess.color[tess.numVertexes][3] = f->drawIntensity * 65535;     
//----(SA)      mod for alpha blend rather than additive
        tess.numVertexes++;
 
        tess.indexes[tess.numIndexes++] = 0;
diff --git a/MP/code/rend2/tr_glsl.c b/MP/code/rend2/tr_glsl.c
index 545f809..1709b6f 100644
--- a/MP/code/rend2/tr_glsl.c
+++ b/MP/code/rend2/tr_glsl.c
@@ -1046,9 +1046,6 @@ void GLSL_InitGPUShaders(void)
                if (glRefConfig.swizzleNormalmap)
                        Q_strcat(extradefines, 1024, "#define 
SWIZZLE_NORMALMAP\n");
 
-               if (r_hdr->integer && !glRefConfig.floatLightmap)
-                       Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n");
-
                if (lightType)
                {
                        Q_strcat(extradefines, 1024, "#define USE_LIGHT\n");
diff --git a/MP/code/rend2/tr_image.c b/MP/code/rend2/tr_image.c
index 4e8b56f..37c98de 100644
--- a/MP/code/rend2/tr_image.c
+++ b/MP/code/rend2/tr_image.c
@@ -164,16 +164,15 @@ R_ImageList_f
 ===============
 */
 void R_ImageList_f( void ) {
-#if 1
        int i;
        int estTotalSize = 0;
 
-       ri.Printf(PRINT_ALL, "\n      -w-- -h-- type  -size- --name-------\n");
+       ri.Printf(PRINT_ALL, "\n      -w-- -h-- -type-- -size- 
--name-------\n");
 
        for ( i = 0 ; i < tr.numImages ; i++ )
        {
                image_t *image = tr.images[i];
-               char *format = "???? ";
+               char *format = "????   ";
                char *sizeSuffix;
                int estSize;
                int displaySize;
@@ -183,95 +182,121 @@ void R_ImageList_f( void ) {
                switch(image->internalFormat)
                {
                        case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
-                               format = "sDXT1";
+                               format = "sDXT1  ";
                                // 64 bits per 16 pixels, so 4 bits per pixel
                                estSize /= 2;
                                break;
                        case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-                               format = "sDXT5";
+                               format = "sDXT5  ";
                                // 128 bits per 16 pixels, so 1 byte per pixel
                                break;
                        case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB:
-                               format = "sBPTC";
+                               format = "sBPTC  ";
                                // 128 bits per 16 pixels, so 1 byte per pixel
                                break;
                        case GL_COMPRESSED_RG_RGTC2:
-                               format = "RGTC2";
+                               format = "RGTC2  ";
                                // 128 bits per 16 pixels, so 1 byte per pixel
                                break;
                        case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-                               format = "DXT1 ";
+                               format = "DXT1   ";
                                // 64 bits per 16 pixels, so 4 bits per pixel
                                estSize /= 2;
                                break;
                        case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-                               format = "DXT1a";
+                               format = "DXT1a  ";
                                // 64 bits per 16 pixels, so 4 bits per pixel
                                estSize /= 2;
                                break;
                        case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-                               format = "DXT5 ";
+                               format = "DXT5   ";
                                // 128 bits per 16 pixels, so 1 byte per pixel
                                break;
                        case GL_COMPRESSED_RGBA_BPTC_UNORM_ARB:
-                               format = "BPTC ";
+                               format = "BPTC   ";
                                // 128 bits per 16 pixels, so 1 byte per pixel
                                break;
                        case GL_RGB4_S3TC:
-                               format = "S3TC ";
+                               format = "S3TC   ";
                                // same as DXT1?
                                estSize /= 2;
                                break;
+                       case GL_RGBA16F:
+                               format = "RGBA16F";
+                               // 8 bytes per pixel
+                               estSize *= 8;
+                               break;
+                       case GL_RGBA16:
+                               format = "RGBA16 ";
+                               // 8 bytes per pixel
+                               estSize *= 8;
+                               break;
                        case GL_RGBA4:
                        case GL_RGBA8:
                        case GL_RGBA:
-                               format = "RGBA ";
+                               format = "RGBA   ";
                                // 4 bytes per pixel
                                estSize *= 4;
                                break;
                        case GL_LUMINANCE8:
                        case GL_LUMINANCE16:
                        case GL_LUMINANCE:
-                               format = "L    ";
+                               format = "L      ";
                                // 1 byte per pixel?
                                break;
                        case GL_RGB5:
                        case GL_RGB8:
                        case GL_RGB:
-                               format = "RGB  ";
+                               format = "RGB    ";
                                // 3 bytes per pixel?
                                estSize *= 3;
                                break;
                        case GL_LUMINANCE8_ALPHA8:
                        case GL_LUMINANCE16_ALPHA16:
                        case GL_LUMINANCE_ALPHA:
-                               format = "LA   ";
+                               format = "LA     ";
                                // 2 bytes per pixel?
                                estSize *= 2;
                                break;
                        case GL_SRGB_EXT:
                        case GL_SRGB8_EXT:
-                               format = "sRGB ";
+                               format = "sRGB   ";
                                // 3 bytes per pixel?
                                estSize *= 3;
                                break;
                        case GL_SRGB_ALPHA_EXT:
                        case GL_SRGB8_ALPHA8_EXT:
-                               format = "sRGBA";
+                               format = "sRGBA  ";
                                // 4 bytes per pixel?
                                estSize *= 4;
                                break;
                        case GL_SLUMINANCE_EXT:
                        case GL_SLUMINANCE8_EXT:
-                               format = "sL   ";
+                               format = "sL     ";
                                // 1 byte per pixel?
                                break;
                        case GL_SLUMINANCE_ALPHA_EXT:
                        case GL_SLUMINANCE8_ALPHA8_EXT:
-                               format = "sLA  ";
+                               format = "sLA    ";
                                // 2 byte per pixel?
                                estSize *= 2;
                                break;
+                       case GL_DEPTH_COMPONENT16:
+                               format = "Depth16";
+                               // 2 bytes per pixel
+                               estSize *= 2;
+                               break;
+                       case GL_DEPTH_COMPONENT24:
+                               format = "Depth24";
+                               // 3 bytes per pixel
+                               estSize *= 3;
+                               break;
+                       case GL_DEPTH_COMPONENT:
+                       case GL_DEPTH_COMPONENT32:
+                               format = "Depth32";
+                               // 4 bytes per pixel
+                               estSize *= 4;
+                               break;
                }
 
                // mipmap adds about 50%
@@ -306,107 +331,6 @@ void R_ImageList_f( void ) {
        ri.Printf (PRINT_ALL, " ---------\n");
        ri.Printf (PRINT_ALL, " approx %i bytes\n", estTotalSize);
        ri.Printf (PRINT_ALL, " %i total images\n\n", tr.numImages );
-#else
-       int i;
-       image_t *image;
-       int texels;
-       const char *yesno[] = {
-               "no ", "yes"
-       };
-
-       ri.Printf( PRINT_ALL, "\n      -w-- -h-- -mm- -TMU- -if-- wrap 
--name-------\n" );
-       texels = 0;
-
-       for ( i = 0 ; i < tr.numImages ; i++ ) {
-               image = tr.images[ i ];
-
-               texels += image->uploadWidth * image->uploadHeight;
-               ri.Printf( PRINT_ALL,  "%4i: %4i %4i  %s   %d   ",
-                       i, image->uploadWidth, image->uploadHeight, 
yesno[(image->flags & IMGFLAG_MIPMAP) ? 1 : 0], image->TMU );
-               switch ( image->internalFormat ) {
-               case 1:
-                       ri.Printf( PRINT_ALL, "I    " );
-                       break;
-               case 2:
-                       ri.Printf( PRINT_ALL, "IA   " );
-                       break;
-               case 3:
-                       ri.Printf( PRINT_ALL, "RGB  " );
-                       break;
-               case 4:
-                       ri.Printf( PRINT_ALL, "RGBA " );
-                       break;
-               case GL_RGBA8:
-                       ri.Printf( PRINT_ALL, "RGBA8" );
-                       break;
-               case GL_RGB8:
-                       ri.Printf( PRINT_ALL, "RGB8" );
-                       break;
-               case GL_RGB4_S3TC:
-                       ri.Printf( PRINT_ALL, "S3TC4" );
-                       break;
-               case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-                       ri.Printf( PRINT_ALL, "DXT1 " );
-                       break;
-               case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-                       ri.Printf( PRINT_ALL, "DXT5 " );
-                       break;
-               case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
-                       ri.Printf( PRINT_ALL, "LATC " );
-                       break;
-               case GL_RGBA4:
-                       ri.Printf( PRINT_ALL, "RGBA4" );
-                       break;
-               case GL_RGB5:
-                       ri.Printf( PRINT_ALL, "RGB5 " );
-                       break;
-               case GL_SRGB_EXT:
-                       ri.Printf( PRINT_ALL, "sRGB " );
-                       break;
-               case GL_SRGB8_EXT:
-                       ri.Printf( PRINT_ALL, "sRGB8" );
-                       break;
-               case GL_SRGB_ALPHA_EXT:
-               case GL_SRGB8_ALPHA8_EXT:
-                       ri.Printf( PRINT_ALL, "sRGBA" );
-                       break;
-                       /*
-               case GL_SLUMINANCE_EXT:
-                       break;
-               case GL_SLUMINANCE8_EXT:
-                       break;
-               case GL_SLUMINANCE_ALPHA_EXT:
-                       break;
-               case GL_SLUMINANCE8_ALPHA8_EXT:
-                       break;
-                       */
-               case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
-                       ri.Printf( PRINT_ALL, "sDXT1" );
-                       break;
-               case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-                       ri.Printf( PRINT_ALL, "sDXT5" );
-                       break;
-               case GL_COMPRESSED_RGBA_BPTC_UNORM_ARB:
-                       ri.Printf( PRINT_ALL, "BPTC " );
-                       break;
-               case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB:
-                       ri.Printf( PRINT_ALL, "sBPTC" );
-                       break;
-               default:
-                       ri.Printf( PRINT_ALL, "???? " );
-               }
-
-               if (image->flags & IMGFLAG_CLAMPTOEDGE)
-                       ri.Printf( PRINT_ALL, "clmp " );
-               else
-                       ri.Printf( PRINT_ALL, "rept " );
-
-               ri.Printf( PRINT_ALL, " %s\n", image->imgName );
-       }
-       ri.Printf( PRINT_ALL, " ---------\n" );
-       ri.Printf( PRINT_ALL, " %i total texels (not including mipmaps)\n", 
texels );
-       ri.Printf( PRINT_ALL, " %i total images\n\n", tr.numImages );
-#endif
 }
 
 //=======================================================================
@@ -2109,7 +2033,20 @@ static void RawImage_UploadTexture(GLuint texture, byte 
*data, int x, int y, int
        dataFormat = PixelDataFormatFromInternalFormat(internalFormat);
 
        // FIXME: This is an old hack to use half floats with lightmaps, use 
picFormat to determine this instead.
-       dataType = (internalFormat == GL_RGBA16F_ARB) ? GL_HALF_FLOAT_ARB : 
GL_UNSIGNED_BYTE;
+       switch (internalFormat)
+       {
+               case GL_RGBA16F_ARB:
+                       dataType = GL_HALF_FLOAT_ARB;
+                       break;
+
+               case GL_RGBA16:
+                       dataType = GL_UNSIGNED_SHORT;
+                       break;
+
+               default:
+                       dataType = GL_UNSIGNED_BYTE;
+                       break;
+       }
 
        miplevel = 0;
        do
diff --git a/MP/code/rend2/tr_light.c b/MP/code/rend2/tr_light.c
index fc892c2..081d724 100644
--- a/MP/code/rend2/tr_light.c
+++ b/MP/code/rend2/tr_light.c
@@ -195,6 +195,9 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent, 
world_t *world ) {
                byte    *data;
                int lat, lng;
                vec3_t normal;
+               #if idppc
+               float d0, d1, d2, d3, d4, d5;
+               #endif
                factor = 1.0;
                data = gridData;
                for ( j = 0 ; j < 3 ; j++ ) {
@@ -212,10 +215,10 @@ static void R_SetupEntityLightingGrid( trRefEntity_t 
*ent, world_t *world ) {
                if ( j != 3 )
                        continue;
 
-               if (world->hdrLightGrid)
+               if (world->lightGrid16)
                {
-                       float *hdrData = world->hdrLightGrid + (int)(data - 
world->lightGridData) / 8 * 6;
-                       if 
(!(hdrData[0]+hdrData[1]+hdrData[2]+hdrData[3]+hdrData[4]+hdrData[5]) ) {
+                       uint16_t *data16 = world->lightGrid16 + (int)(data - 
world->lightGridData) / 8 * 6;
+                       if 
(!(data16[0]+data16[1]+data16[2]+data16[3]+data16[4]+data16[5])) {
                                continue;       // ignore samples in walls
                        }
                }
@@ -226,19 +229,30 @@ static void R_SetupEntityLightingGrid( trRefEntity_t 
*ent, world_t *world ) {
                        }
                }
                totalFactor += factor;
-
-               if (world->hdrLightGrid)
+               #if idppc
+               d0 = data[0]; d1 = data[1]; d2 = data[2];
+               d3 = data[3]; d4 = data[4]; d5 = data[5];
+
+               ent->ambientLight[0] += factor * d0;
+               ent->ambientLight[1] += factor * d1;
+               ent->ambientLight[2] += factor * d2;
+
+               ent->directedLight[0] += factor * d3;
+               ent->directedLight[1] += factor * d4;
+               ent->directedLight[2] += factor * d5;
+               #else
+               if (world->lightGrid16)
                {
                        // FIXME: this is hideous
-                       float *hdrData = world->hdrLightGrid + (int)(data - 
world->lightGridData) / 8 * 6;
+                       uint16_t *data16 = world->lightGrid16 + (int)(data - 
world->lightGridData) / 8 * 6;
 
-                       ent->ambientLight[0] += factor * hdrData[0];
-                       ent->ambientLight[1] += factor * hdrData[1];
-                       ent->ambientLight[2] += factor * hdrData[2];
+                       ent->ambientLight[0] += factor * data16[0] / 257.0f;
+                       ent->ambientLight[1] += factor * data16[1] / 257.0f;
+                       ent->ambientLight[2] += factor * data16[2] / 257.0f;
 
-                       ent->directedLight[0] += factor * hdrData[3];
-                       ent->directedLight[1] += factor * hdrData[4];
-                       ent->directedLight[2] += factor * hdrData[5];
+                       ent->directedLight[0] += factor * data16[3] / 257.0f;
+                       ent->directedLight[1] += factor * data16[4] / 257.0f;
+                       ent->directedLight[2] += factor * data16[5] / 257.0f;
                }
                else
                {
@@ -250,7 +264,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent, 
world_t *world ) {
                        ent->directedLight[1] += factor * data[4];
                        ent->directedLight[2] += factor * data[5];
                }
-
+               #endif
                lat = data[7];
                lng = data[6];
                lat *= ( FUNCTABLE_SIZE / 256 );
diff --git a/MP/code/rend2/tr_local.h b/MP/code/rend2/tr_local.h
index a766b21..266458b 100644
--- a/MP/code/rend2/tr_local.h
+++ b/MP/code/rend2/tr_local.h
@@ -267,8 +267,8 @@ typedef enum {
        CGEN_IDENTITY,          // always (1,1,1,1)
        CGEN_ENTITY,            // grabbed from entity's modulate field
        CGEN_ONE_MINUS_ENTITY,  // grabbed from 1 - entity.modulate
-       CGEN_EXACT_VERTEX,      // tess.vertexColors
-       CGEN_VERTEX,            // tess.vertexColors * tr.identityLight
+       CGEN_EXACT_VERTEX,      // tess.color
+       CGEN_VERTEX,            // tess.color * tr.identityLight
        CGEN_EXACT_VERTEX_LIT,  // like CGEN_EXACT_VERTEX but takes a light 
direction from the lightgrid
        CGEN_VERTEX_LIT,        // like CGEN_VERTEX but takes a light direction 
from the lightgrid
        CGEN_ONE_MINUS_VERTEX,
@@ -1006,7 +1006,7 @@ typedef struct
        int16_t         normal[4];
        int16_t         tangent[4];
        int16_t         lightdir[4];
-       vec4_t                  vertexColors;
+       uint16_t        color[4];
 
 #if DEBUG_OPTIMIZEVERTICES
        unsigned int    id;
@@ -1265,7 +1265,7 @@ typedef struct {
        vec3_t lightGridInverseSize;
        int lightGridBounds[3];
        byte        *lightGridData;
-       float           *hdrLightGrid;
+       uint16_t        *lightGrid16;
 
        int numClusters;
        int clusterBytes;
@@ -1530,11 +1530,8 @@ typedef struct {
        qboolean seamlessCubeMap;
 
        GLenum packedTexcoordDataType;
-       GLenum packedColorDataType;
        int packedTexcoordDataSize;
-       int packedColorDataSize;
 
-       qboolean floatLightmap;
        qboolean vertexArrayObject;
        qboolean directStateAccess;
 } glRefConfig_t;
@@ -2231,7 +2228,7 @@ typedef struct shaderCommands_s
        int16_t         normal[SHADER_MAX_VERTEXES][4] QALIGN(16);
        int16_t         tangent[SHADER_MAX_VERTEXES][4] QALIGN(16);
        vec2_t          texCoords[SHADER_MAX_VERTEXES][2] QALIGN(16);
-       vec4_t          vertexColors[SHADER_MAX_VERTEXES] QALIGN(16);
+       uint16_t        color[SHADER_MAX_VERTEXES][4] QALIGN(16);
        int16_t         lightdir[SHADER_MAX_VERTEXES][4] QALIGN(16);
        //int                   vertexDlightBits[SHADER_MAX_VERTEXES] 
QALIGN(16);
 
@@ -2398,7 +2395,7 @@ VERTEX BUFFER OBJECTS
 void R_VaoPackTangent(int16_t *out, vec4_t v);
 void R_VaoPackNormal(int16_t *out, vec3_t v);
 int R_VaoPackTexCoord(byte *out, vec2_t st);
-int R_VaoPackColors(byte *out, vec4_t color);
+void R_VaoPackColor(uint16_t *out, vec4_t c);
 void R_VaoUnpackTangent(vec4_t v, int16_t *pack);
 void R_VaoUnpackNormal(vec3_t v, int16_t *pack);
 
diff --git a/MP/code/rend2/tr_model_iqm.c b/MP/code/rend2/tr_model_iqm.c
index e9c2177..5d5de9a 100644
--- a/MP/code/rend2/tr_model_iqm.c
+++ b/MP/code/rend2/tr_model_iqm.c
@@ -1027,7 +1027,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
        int16_t *outNormal;
        int16_t *outTangent;
        vec2_t          (*outTexCoord)[2];
-       vec4_t  *outColor;
+       uint16_t *outColor;
 
        int     frame = data->num_frames ? backEnd.currentEntity->e.frame % 
data->num_frames : 0;
        int     oldframe = data->num_frames ? backEnd.currentEntity->e.oldframe 
% data->num_frames : 0;
@@ -1043,7 +1043,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
        outNormal = tess.normal[tess.numVertexes];
        outTangent = tess.tangent[tess.numVertexes];
        outTexCoord = &tess.texCoords[tess.numVertexes];
-       outColor = &tess.vertexColors[tess.numVertexes];
+       outColor = tess.color[tess.numVertexes];
 
        // compute interpolated joint matrices
        if ( data->num_poses > 0 ) {
@@ -1052,7 +1052,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
 
        // transform vertexes and fill other data
        for( i = 0; i < surf->num_vertexes;
-               i++, outXYZ++, outNormal+=4, outTexCoord++, outColor++ ) {
+               i++, outXYZ++, outNormal+=4, outTexCoord++, outColor+=4 ) {
                int     j, k;
                float   vtxMat[12];
                float   nrmMat[9];
@@ -1137,10 +1137,10 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
                        outTangent+=4;
                }
 
-               (*outColor)[0] = data->colors[4*vtx+0] / 255.0f;
-               (*outColor)[1] = data->colors[4*vtx+1] / 255.0f;
-               (*outColor)[2] = data->colors[4*vtx+2] / 255.0f;
-               (*outColor)[3] = data->colors[4*vtx+3] / 255.0f;
+               outColor[0] = data->colors[4*vtx+0] * 257;
+               outColor[1] = data->colors[4*vtx+1] * 257;
+               outColor[2] = data->colors[4*vtx+2] * 257;
+               outColor[3] = data->colors[4*vtx+3] * 257;
        }
 
        tri = data->triangles + 3 * surf->first_triangle;
diff --git a/MP/code/rend2/tr_shade_calc.c b/MP/code/rend2/tr_shade_calc.c
index 20b1ead..452476d 100644
--- a/MP/code/rend2/tr_shade_calc.c
+++ b/MP/code/rend2/tr_shade_calc.c
@@ -439,6 +439,7 @@ static void AutospriteDeform( void ) {
        }
 
        for ( i = 0 ; i < oldVerts ; i += 4 ) {
+               vec4_t color;
                // find the midpoint
                xyz = tess.xyz[i];
 
@@ -469,7 +470,8 @@ static void AutospriteDeform( void ) {
                        VectorScale( up, axisLength, up );
                }
 
-               RB_AddQuadStamp( mid, left, up, tess.vertexColors[i] );
+               VectorScale4(tess.color[i], 1.0f / 65535.0f, color);
+               RB_AddQuadStamp( mid, left, up, color );
        }
 }
 
diff --git a/MP/code/rend2/tr_surface.c b/MP/code/rend2/tr_surface.c
index c8220cb..19a1717 100644
--- a/MP/code/rend2/tr_surface.c
+++ b/MP/code/rend2/tr_surface.c
@@ -95,6 +95,7 @@ RB_AddQuadStampExt
 void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, float 
color[4], float s1, float t1, float s2, float t2 ) {
        vec3_t normal;
        int16_t     iNormal[4];
+       uint16_t    iColor[4];
        int ndx;
 
        RB_CheckVao(tess.vao);
@@ -154,10 +155,13 @@ void RB_AddQuadStampExt( vec3_t origin, vec3_t left, 
vec3_t up, float color[4],
 
        // constant color all the way around
        // should this be identity and let the shader specify from entity?
-       VectorCopy4(color, tess.vertexColors[ndx]);
-       VectorCopy4(color, tess.vertexColors[ndx+1]);
-       VectorCopy4(color, tess.vertexColors[ndx+2]);
-       VectorCopy4(color, tess.vertexColors[ndx+3]);
+
+       R_VaoPackColor(iColor, color);
+
+       VectorCopy4(iColor, tess.color[ndx]);
+       VectorCopy4(iColor, tess.color[ndx + 1]);
+       VectorCopy4(iColor, tess.color[ndx + 2]);
+       VectorCopy4(iColor, tess.color[ndx + 3]);
 
        tess.numVertexes += 4;
        tess.numIndexes += 6;
@@ -324,10 +328,10 @@ static void RB_SurfacePolychain( srfPoly_t *p ) {
                VectorCopy( p->verts[i].xyz, tess.xyz[numv] );
                tess.texCoords[numv][0][0] = p->verts[i].st[0];
                tess.texCoords[numv][0][1] = p->verts[i].st[1];
-               tess.vertexColors[numv][0] = p->verts[ i ].modulate[0] / 255.0f;
-               tess.vertexColors[numv][1] = p->verts[ i ].modulate[1] / 255.0f;
-               tess.vertexColors[numv][2] = p->verts[ i ].modulate[2] / 255.0f;
-               tess.vertexColors[numv][3] = p->verts[ i ].modulate[3] / 255.0f;
+               tess.color[numv][0] = (int)p->verts[i].modulate[0] * 257;
+               tess.color[numv][1] = (int)p->verts[i].modulate[1] * 257;
+               tess.color[numv][2] = (int)p->verts[i].modulate[2] * 257;
+               tess.color[numv][3] = (int)p->verts[i].modulate[3] * 257;
 
                numv++;
        }
@@ -353,7 +357,7 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, 
srfVert_t *verts, int numIn
        int16_t        *normal;
        int16_t        *tangent;
        glIndex_t      *outIndex;
-       float           *color;
+       uint16_t       *color;
 
        RB_CheckVao(tess.vao);
 
@@ -409,9 +413,9 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, 
srfVert_t *verts, int numIn
        if ( tess.shader->vertexAttribs & ATTR_COLOR )
        {
                dv = verts;
-               color = tess.vertexColors[ tess.numVertexes ];
+               color = tess.color[ tess.numVertexes ];
                for ( i = 0 ; i < numVerts ; i++, dv++, color+=4 )
-                       VectorCopy4(dv->vertexColors, color);
+                       VectorCopy4(dv->color, color);
        }
 
        if ( tess.shader->vertexAttribs & ATTR_LIGHTDIRECTION )
@@ -666,34 +670,34 @@ static void DoRailCore( const vec3_t start, const vec3_t 
end, const vec3_t up, f
        VectorMA( start, spanWidth, up, tess.xyz[tess.numVertexes] );
        tess.texCoords[tess.numVertexes][0][0] = 0;
        tess.texCoords[tess.numVertexes][0][1] = 0;
-       tess.vertexColors[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 0.25 / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 0.25 / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 0.25 / 255.0f;
+       tess.color[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 0.25f * 257.0f;
+       tess.color[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 0.25f * 257.0f;
+       tess.color[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 0.25f * 257.0f;
        tess.numVertexes++;
 
        VectorMA( start, spanWidth2, up, tess.xyz[tess.numVertexes] );
        tess.texCoords[tess.numVertexes][0][0] = 0;
        tess.texCoords[tess.numVertexes][0][1] = 1;
-       tess.vertexColors[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] / 255.0f;
+       tess.color[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 257;
+       tess.color[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 257;
+       tess.color[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 257;
        tess.numVertexes++;
 
        VectorMA( end, spanWidth, up, tess.xyz[tess.numVertexes] );
 
        tess.texCoords[tess.numVertexes][0][0] = t;
        tess.texCoords[tess.numVertexes][0][1] = 0;
-       tess.vertexColors[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] / 255.0f;
+       tess.color[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 257;
+       tess.color[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 257;
+       tess.color[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 257;
        tess.numVertexes++;
 
        VectorMA( end, spanWidth2, up, tess.xyz[tess.numVertexes] );
        tess.texCoords[tess.numVertexes][0][0] = t;
        tess.texCoords[tess.numVertexes][0][1] = 1;
-       tess.vertexColors[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] / 255.0f;
+       tess.color[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 257;
+       tess.color[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 257;
+       tess.color[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 257;
        tess.numVertexes++;
 
        tess.indexes[tess.numIndexes++] = vbase;
@@ -750,9 +754,9 @@ static void DoRailDiscs( int numSegs, const vec3_t start, 
const vec3_t dir, cons
                        VectorCopy( pos[j], tess.xyz[tess.numVertexes] );
                        tess.texCoords[tess.numVertexes][0][0] = ( j < 2 );
                        tess.texCoords[tess.numVertexes][0][1] = ( j && j != 3 
);
-                       tess.vertexColors[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] / 255.0f;
-                       tess.vertexColors[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] / 255.0f;
-                       tess.vertexColors[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] / 255.0f;
+                       tess.color[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 257;
+                       tess.color[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 257;
+                       tess.color[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 257;
                        tess.numVertexes++;
 
                        VectorAdd( pos[j], dir, pos[j] );
@@ -1043,7 +1047,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
        float   *texCoords, *lightCoords;
        int16_t *normal;
        int16_t *tangent;
-       float   *color;
+       uint16_t *color;
        int16_t *lightdir;
        srfVert_t       *dv;
        int rows, irows, vrows;
@@ -1133,7 +1137,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
                tangent = tess.tangent[numVertexes];
                texCoords = tess.texCoords[numVertexes][0];
                lightCoords = tess.texCoords[numVertexes][1];
-               color = tess.vertexColors[numVertexes];
+               color = tess.color[numVertexes];
                lightdir = tess.lightdir[numVertexes];
                //vDlightBits = &tess.vertexDlightBits[numVertexes];
 
@@ -1174,7 +1178,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
 
                                if ( tess.shader->vertexAttribs & ATTR_COLOR )
                                {
-                                       VectorCopy4(dv->vertexColors, color);
+                                       VectorCopy4(dv->color, color);
                                        color += 4;
                                }
 
diff --git a/MP/code/rend2/tr_vbo.c b/MP/code/rend2/tr_vbo.c
index 4a2ddf8..0028094 100644
--- a/MP/code/rend2/tr_vbo.c
+++ b/MP/code/rend2/tr_vbo.c
@@ -61,30 +61,12 @@ int R_VaoPackTexCoord(byte *out, vec2_t st)
        }
 }
 
-int R_VaoPackColors(byte *out, vec4_t color)
+void R_VaoPackColor(uint16_t *out, vec4_t c)
 {
-       if (glRefConfig.packedTexcoordDataType == GL_HALF_FLOAT)
-       {
-               uint16_t *num = (uint16_t *)out;
-
-               *num++ = FloatToHalf(color[0]);
-               *num++ = FloatToHalf(color[1]);
-               *num++ = FloatToHalf(color[2]);
-               *num++ = FloatToHalf(color[3]);
-
-               return sizeof(*num) * 4;
-       }
-       else
-       {
-               float *num = (float *)out;
-
-               *num++ = color[0];
-               *num++ = color[1];
-               *num++ = color[2];
-               *num++ = color[3];
-
-               return sizeof(*num) * 4;
-       }
+       out[0] = c[0] * 65535.0f + 0.5f;
+       out[1] = c[1] * 65535.0f + 0.5f;
+       out[2] = c[2] * 65535.0f + 0.5f;
+       out[3] = c[3] * 65535.0f + 0.5f;
 }
 
 void R_VaoUnpackTangent(vec4_t v, int16_t *pack)
@@ -267,7 +249,7 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, 
srfVert_t *verts, int num
        vao->attribs[ATTR_INDEX_TANGENT       ].type = GL_SHORT;
        vao->attribs[ATTR_INDEX_TEXCOORD      ].type = 
glRefConfig.packedTexcoordDataType;
        vao->attribs[ATTR_INDEX_LIGHTCOORD    ].type = 
glRefConfig.packedTexcoordDataType;
-       vao->attribs[ATTR_INDEX_COLOR         ].type = 
glRefConfig.packedColorDataType;
+       vao->attribs[ATTR_INDEX_COLOR         ].type = GL_UNSIGNED_SHORT;
        vao->attribs[ATTR_INDEX_LIGHTDIRECTION].type = GL_SHORT;
 
        vao->attribs[ATTR_INDEX_POSITION      ].normalized = GL_FALSE;
@@ -275,7 +257,7 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, 
srfVert_t *verts, int num
        vao->attribs[ATTR_INDEX_TANGENT       ].normalized = GL_TRUE;
        vao->attribs[ATTR_INDEX_TEXCOORD      ].normalized = GL_FALSE;
        vao->attribs[ATTR_INDEX_LIGHTCOORD    ].normalized = GL_FALSE;
-       vao->attribs[ATTR_INDEX_COLOR         ].normalized = GL_FALSE;
+       vao->attribs[ATTR_INDEX_COLOR         ].normalized = GL_TRUE;
        vao->attribs[ATTR_INDEX_LIGHTDIRECTION].normalized = GL_TRUE;
 
        vao->attribs[ATTR_INDEX_POSITION      ].offset = 0;        dataSize  = 
sizeof(verts[0].xyz);
@@ -283,7 +265,7 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, 
srfVert_t *verts, int num
        vao->attribs[ATTR_INDEX_TANGENT       ].offset = dataSize; dataSize += 
sizeof(verts[0].tangent);
        vao->attribs[ATTR_INDEX_TEXCOORD      ].offset = dataSize; dataSize += 
glRefConfig.packedTexcoordDataSize;
        vao->attribs[ATTR_INDEX_LIGHTCOORD    ].offset = dataSize; dataSize += 
glRefConfig.packedTexcoordDataSize;
-       vao->attribs[ATTR_INDEX_COLOR         ].offset = dataSize; dataSize += 
glRefConfig.packedColorDataSize;
+       vao->attribs[ATTR_INDEX_COLOR         ].offset = dataSize; dataSize += 
sizeof(verts[0].color);
        vao->attribs[ATTR_INDEX_LIGHTDIRECTION].offset = dataSize; dataSize += 
sizeof(verts[0].lightdir);
 
        vao->attribs[ATTR_INDEX_POSITION      ].stride = dataSize;
@@ -328,7 +310,8 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, 
srfVert_t *verts, int num
                dataOfs += R_VaoPackTexCoord(data + dataOfs, verts[i].lightmap);
 
                // colors
-               dataOfs += R_VaoPackColors(data + dataOfs, 
verts[i].vertexColors);
+               memcpy(data + dataOfs, &verts[i].color, sizeof(verts[i].color));
+               dataOfs += sizeof(verts[i].color);
 
                // light directions
                memcpy(data + dataOfs, &verts[i].lightdir, 
sizeof(verts[i].lightdir));
@@ -464,7 +447,7 @@ void R_InitVaos(void)
        vertexesSize  = sizeof(tess.xyz[0]);
        vertexesSize += sizeof(tess.normal[0]);
        vertexesSize += sizeof(tess.tangent[0]);
-       vertexesSize += sizeof(tess.vertexColors[0]);
+       vertexesSize += sizeof(tess.color[0]);
        vertexesSize += sizeof(tess.texCoords[0][0]) * 2;
        vertexesSize += sizeof(tess.lightdir[0]);
        vertexesSize *= SHADER_MAX_VERTEXES;
@@ -496,7 +479,7 @@ void R_InitVaos(void)
        tess.vao->attribs[ATTR_INDEX_TANGENT       ].type = GL_SHORT;
        tess.vao->attribs[ATTR_INDEX_TEXCOORD      ].type = GL_FLOAT;
        tess.vao->attribs[ATTR_INDEX_LIGHTCOORD    ].type = GL_FLOAT;
-       tess.vao->attribs[ATTR_INDEX_COLOR         ].type = GL_FLOAT;
+       tess.vao->attribs[ATTR_INDEX_COLOR         ].type = GL_UNSIGNED_SHORT;
        tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].type = GL_SHORT;
 
        tess.vao->attribs[ATTR_INDEX_POSITION      ].normalized = GL_FALSE;
@@ -504,7 +487,7 @@ void R_InitVaos(void)
        tess.vao->attribs[ATTR_INDEX_TANGENT       ].normalized = GL_TRUE;
        tess.vao->attribs[ATTR_INDEX_TEXCOORD      ].normalized = GL_FALSE;
        tess.vao->attribs[ATTR_INDEX_LIGHTCOORD    ].normalized = GL_FALSE;
-       tess.vao->attribs[ATTR_INDEX_COLOR         ].normalized = GL_FALSE;
+       tess.vao->attribs[ATTR_INDEX_COLOR         ].normalized = GL_TRUE;
        tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].normalized = GL_TRUE;
 
        tess.vao->attribs[ATTR_INDEX_POSITION      ].offset = offset; offset += 
sizeof(tess.xyz[0])              * SHADER_MAX_VERTEXES;
@@ -515,13 +498,13 @@ void R_InitVaos(void)
        tess.vao->attribs[ATTR_INDEX_LIGHTCOORD    ].offset = offset + 
sizeof(tess.texCoords[0][0]);
                                                                      offset += 
sizeof(tess.texCoords[0][0]) * 2 * SHADER_MAX_VERTEXES;
 
-       tess.vao->attribs[ATTR_INDEX_COLOR         ].offset = offset; offset += 
sizeof(tess.vertexColors[0])     * SHADER_MAX_VERTEXES;
+       tess.vao->attribs[ATTR_INDEX_COLOR         ].offset = offset; offset += 
sizeof(tess.color[0])            * SHADER_MAX_VERTEXES;
        tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].offset = offset;
 
        tess.vao->attribs[ATTR_INDEX_POSITION      ].stride = 
sizeof(tess.xyz[0]);
        tess.vao->attribs[ATTR_INDEX_NORMAL        ].stride = 
sizeof(tess.normal[0]);
        tess.vao->attribs[ATTR_INDEX_TANGENT       ].stride = 
sizeof(tess.tangent[0]);
-       tess.vao->attribs[ATTR_INDEX_COLOR         ].stride = 
sizeof(tess.vertexColors[0]);
+       tess.vao->attribs[ATTR_INDEX_COLOR         ].stride = 
sizeof(tess.color[0]);
        tess.vao->attribs[ATTR_INDEX_TEXCOORD      ].stride = 
sizeof(tess.texCoords[0][0]) * 2;
        tess.vao->attribs[ATTR_INDEX_LIGHTCOORD    ].stride = 
sizeof(tess.texCoords[0][0]) * 2;
        tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].stride = 
sizeof(tess.lightdir[0]);
@@ -530,7 +513,7 @@ void R_InitVaos(void)
        tess.attribPointers[ATTR_INDEX_TEXCOORD]       = tess.texCoords;
        tess.attribPointers[ATTR_INDEX_NORMAL]         = tess.normal;
        tess.attribPointers[ATTR_INDEX_TANGENT]        = tess.tangent;
-       tess.attribPointers[ATTR_INDEX_COLOR]          = tess.vertexColors;
+       tess.attribPointers[ATTR_INDEX_COLOR]          = tess.color;
        tess.attribPointers[ATTR_INDEX_LIGHTDIRECTION] = tess.lightdir;
 
        Vao_SetVertexPointers(tess.vao);
diff --git a/MP/code/renderer/tr_light.c b/MP/code/renderer/tr_light.c
index 179ae7c..1d2c393 100644
--- a/MP/code/renderer/tr_light.c
+++ b/MP/code/renderer/tr_light.c
@@ -190,7 +190,9 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) 
{
                byte    *data;
                int lat, lng;
                vec3_t normal;
-
+               #if idppc
+               float d0, d1, d2, d3, d4, d5;
+               #endif
                factor = 1.0;
                data = gridData;
                for ( j = 0 ; j < 3 ; j++ ) {
@@ -212,7 +214,18 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent 
) {
                        continue;   // ignore samples in walls
                }
                totalFactor += factor;
-
+               #if idppc
+               d0 = data[0]; d1 = data[1]; d2 = data[2];
+               d3 = data[3]; d4 = data[4]; d5 = data[5];
+
+               ent->ambientLight[0] += factor * d0;
+               ent->ambientLight[1] += factor * d1;
+               ent->ambientLight[2] += factor * d2;
+
+               ent->directedLight[0] += factor * d3;
+               ent->directedLight[1] += factor * d4;
+               ent->directedLight[2] += factor * d5;
+               #else
                ent->ambientLight[0] += factor * data[0];
                ent->ambientLight[1] += factor * data[1];
                ent->ambientLight[2] += factor * data[2];
@@ -220,7 +233,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) 
{
                ent->directedLight[0] += factor * data[3];
                ent->directedLight[1] += factor * data[4];
                ent->directedLight[2] += factor * data[5];
-
+               #endif
                lat = data[7];
                lng = data[6];
                lat *= ( FUNCTABLE_SIZE / 256 );
diff --git a/SP/code/rend2/tr_backend.c b/SP/code/rend2/tr_backend.c
index e264247..764bf45 100644
--- a/SP/code/rend2/tr_backend.c
+++ b/SP/code/rend2/tr_backend.c
@@ -707,7 +707,7 @@ void RB_ZombieFXShowFleshHits( trZombieFleshHitverts_t 
*fleshHitVerts, int oldNu
        unsigned short *vertHits;
        int i;
 
-       vertColors = (byte *)tess.vertexColors[oldNumVerts];
+       vertColors = (byte *)tess.color[oldNumVerts];
        vertHits = fleshHitVerts->vertHits;
 
        // for each hit entry, adjust that verts alpha component
@@ -728,7 +728,7 @@ void RB_ZombieFXDecompose( int oldNumVerts, int 
numSurfVerts, float deltaTimeSca
        int i;
        float alpha;
 
-       vertColors = (byte *)tess.vertexColors[oldNumVerts];
+       vertColors = (byte *)tess.color[oldNumVerts];
        xyz = tess.xyz[oldNumVerts];
        norm = tess.normal[oldNumVerts];
 
@@ -754,7 +754,7 @@ void RB_ZombieFXFullAlpha( int oldNumVerts, int 
numSurfVerts ) {
        byte *vertColors;
        int i;
 
-       vertColors = (byte *)tess.vertexColors[oldNumVerts];
+       vertColors = (byte *)tess.color[oldNumVerts];
 
        for ( i = 0; i < numSurfVerts; i++, vertColors += 4 ) {
                vertColors[3] = 255;
@@ -1306,14 +1306,14 @@ const void *RB_StretchPic( const void *data ) {
        tess.indexes[ numIndexes + 5 ] = numVerts + 1;
 
        {
-               vec4_t color;
+               uint16_t color[4];
 
-               VectorScale4(backEnd.color2D, 1.0f / 255.0f, color);
+               VectorScale4(backEnd.color2D, 257, color);
 
-               VectorCopy4(color, tess.vertexColors[ numVerts ]);
-               VectorCopy4(color, tess.vertexColors[ numVerts + 1]);
-               VectorCopy4(color, tess.vertexColors[ numVerts + 2]);
-               VectorCopy4(color, tess.vertexColors[ numVerts + 3 ]);
+               VectorCopy4(color, tess.color[ numVerts ]);
+               VectorCopy4(color, tess.color[ numVerts + 1]);
+               VectorCopy4(color, tess.color[ numVerts + 2]);
+               VectorCopy4(color, tess.color[ numVerts + 3 ]);
        }
 
        tess.xyz[ numVerts ][0] = cmd->x;
@@ -1397,16 +1397,16 @@ const void *RB_StretchPicGradient( const void *data ) {
        tess.indexes[ numIndexes + 4 ] = numVerts + 0;
        tess.indexes[ numIndexes + 5 ] = numVerts + 1;
 
-//     *(int *)tess.vertexColors[ numVerts ] =
-//             *(int *)tess.vertexColors[ numVerts + 1 ] =
-//             *(int *)tess.vertexColors[ numVerts + 2 ] =
-//             *(int *)tess.vertexColors[ numVerts + 3 ] = *(int 
*)backEnd.color2D;
+//     *(int *)tess.color[ numVerts ] =
+//             *(int *)tess.color[ numVerts + 1 ] =
+//             *(int *)tess.color[ numVerts + 2 ] =
+//             *(int *)tess.color[ numVerts + 3 ] = *(int *)backEnd.color2D;
 
-       *(int *)tess.vertexColors[ numVerts ] =
-               *(int *)tess.vertexColors[ numVerts + 1 ] = *(int 
*)backEnd.color2D;
+       *(int *)tess.color[ numVerts ] =
+               *(int *)tess.color[ numVerts + 1 ] = *(int *)backEnd.color2D;
 
-       *(int *)tess.vertexColors[ numVerts + 2 ] =
-               *(int *)tess.vertexColors[ numVerts + 3 ] = *(int 
*)cmd->gradientColor;
+       *(int *)tess.color[ numVerts + 2 ] =
+               *(int *)tess.color[ numVerts + 3 ] = *(int *)cmd->gradientColor;
 
        tess.xyz[ numVerts ][0] = cmd->x;
        tess.xyz[ numVerts ][1] = cmd->y;
diff --git a/SP/code/rend2/tr_bsp.c b/SP/code/rend2/tr_bsp.c
index d5c4858..480744b 100644
--- a/SP/code/rend2/tr_bsp.c
+++ b/SP/code/rend2/tr_bsp.c
@@ -141,11 +141,11 @@ R_ColorShiftLightingFloats
 
 ===============
 */
-static void R_ColorShiftLightingFloats(float in[4], float out[4], float scale )
+static void R_ColorShiftLightingFloats(float in[4], float out[4])
 {
        float   r, g, b;
 
-       scale *= 1 << (r_mapOverBrightBits->integer - tr.overbrightBits);
+       float   scale = (1 << (r_mapOverBrightBits->integer - 
tr.overbrightBits)) / 255.0f;
 
        r = in[0] * scale;
        g = in[1] * scale;
@@ -192,12 +192,11 @@ void ColorToRGBM(const vec3_t color, unsigned char 
rgbm[4])
 }
 
 
-void ColorToRGBA16F(const vec3_t color, unsigned short rgba16f[4])
+void ColorToRGB16(const vec3_t color, uint16_t rgb16[3])
 {
-       rgba16f[0] = FloatToHalf(color[0]);
-       rgba16f[1] = FloatToHalf(color[1]);
-       rgba16f[2] = FloatToHalf(color[2]);
-       rgba16f[3] = FloatToHalf(1.0f);
+       rgb16[0] = color[0] * 65535.0f + 0.5f;
+       rgb16[1] = color[1] * 65535.0f + 0.5f;
+       rgb16[2] = color[2] * 65535.0f + 0.5f;
 }
 
 /*
@@ -282,10 +281,16 @@ static    void R_LoadLightmaps( lump_t *l, lump_t *surfs 
) {
        if (tr.worldDeluxeMapping)
                tr.deluxemaps = ri.Hunk_Alloc( tr.numLightmaps * sizeof(image_t 
*), h_low );
 
-       if (glRefConfig.floatLightmap)
-               textureInternalFormat = GL_RGBA16F_ARB;
-       else
-               textureInternalFormat = GL_RGBA8;
+       textureInternalFormat = GL_RGBA8;
+       if (r_hdr->integer)
+       {
+               // Check for the first hdr lightmap, if it exists, use 
GL_RGBA16 for textures.
+               char filename[MAX_QPATH];
+
+               Com_sprintf(filename, sizeof(filename), "maps/%s/lm_0000.hdr", 
s_worldData.baseName);
+               if (ri.FS_FileExists(filename))
+                       textureInternalFormat = GL_RGBA16;
+       }
 
        if (r_mergeLightmaps->integer)
        {
@@ -322,7 +327,7 @@ static      void R_LoadLightmaps( lump_t *l, lump_t *surfs 
) {
                        int size = 0;
 
                        // look for hdr lightmaps
-                       if (r_hdr->integer)
+                       if (textureInternalFormat == GL_RGBA16)
                        {
                                Com_sprintf( filename, sizeof( filename ), 
"maps/%s/lm_%04d.hdr", s_worldData.baseName, i * (tr.worldDeluxeMapping ? 2 : 
1) );
                                //ri.Printf(PRINT_ALL, "looking for %s\n", 
filename);
@@ -385,14 +390,12 @@ static    void R_LoadLightmaps( lump_t *l, lump_t *surfs 
) {
 #endif
                                        color[3] = 1.0f;
 
-                                       R_ColorShiftLightingFloats(color, 
color, 1.0f/255.0f);
-
-                                       if (glRefConfig.floatLightmap)
-                                               ColorToRGBA16F(color, (unsigned 
short *)(&image[j*8]));
-                                       else
-                                               ColorToRGBM(color, &image[j*4]);
+                                       R_ColorShiftLightingFloats(color, 
color);
+ 
+                                       ColorToRGB16(color, (uint16_t 
*)(&image[j * 8]));
+                                       ((uint16_t *)(&image[j * 8]))[3] = 
65535;
                                }
-                               else if (glRefConfig.floatLightmap)
+                               else if (textureInternalFormat == GL_RGBA16)
                                {
                                        vec4_t color;
 
@@ -412,9 +415,10 @@ static     void R_LoadLightmaps( lump_t *l, lump_t *surfs 
) {
                                        }
                                        color[3] = 1.0f;
 
-                                       R_ColorShiftLightingFloats(color, 
color, 1.0f/255.0f);
-
-                                       ColorToRGBA16F(color, (unsigned short 
*)(&image[j*8]));
+                                       R_ColorShiftLightingFloats(color, 
color);
+ 
+                                       ColorToRGB16(color, (uint16_t 
*)(&image[j * 8]));
+                                       ((uint16_t *)(&image[j * 8]))[3] = 
65535;
                                }
                                else
                                {
@@ -723,7 +727,8 @@ void LoadDrawVertToSrfVert(srfVert_t *s, drawVert_t *d, int 
realLightmapNum, flo
        }
        v[3] = d->color[3] / 255.0f;
 
-       R_ColorShiftLightingFloats(v, s->vertexColors, 1.0f / 255.0f);
+       R_ColorShiftLightingFloats(v, v);
+       R_VaoPackColor(s->color, v);
 }
 
 
@@ -1959,7 +1964,7 @@ static void CopyVert(const srfVert_t * in, srfVert_t * 
out)
        VectorCopy2(in->st,       out->st);
        VectorCopy2(in->lightmap, out->lightmap);
 
-       VectorCopy4(in->vertexColors, out->vertexColors);
+       VectorCopy4(in->color,    out->color);
 }
 
 
@@ -2974,25 +2979,47 @@ void R_LoadLightGrid( lump_t *l ) {
 
                if (hdrLightGrid)
                {
-                       float lightScale = 1 << (r_mapOverBrightBits->integer - 
tr.overbrightBits);
-
                        //ri.Printf(PRINT_ALL, "found!\n");
 
                        if (size != sizeof(float) * 6 * numGridPoints)
-                       {
                                ri.Error(ERR_DROP, "Bad size for %s (%i, 
expected %i)!", filename, size, (int)(sizeof(float)) * 6 * numGridPoints);
-                       }
 
-                       w->hdrLightGrid = ri.Hunk_Alloc(size, h_low);
+                       w->lightGrid16 = ri.Hunk_Alloc(sizeof(w->lightGrid16) * 
6 * numGridPoints, h_low);
 
                        for (i = 0; i < numGridPoints ; i++)
                        {
-                               w->hdrLightGrid[i * 6    ] = hdrLightGrid[i * 6 
   ] * lightScale;
-                               w->hdrLightGrid[i * 6 + 1] = hdrLightGrid[i * 6 
+ 1] * lightScale;
-                               w->hdrLightGrid[i * 6 + 2] = hdrLightGrid[i * 6 
+ 2] * lightScale;
-                               w->hdrLightGrid[i * 6 + 3] = hdrLightGrid[i * 6 
+ 3] * lightScale;
-                               w->hdrLightGrid[i * 6 + 4] = hdrLightGrid[i * 6 
+ 4] * lightScale;
-                               w->hdrLightGrid[i * 6 + 5] = hdrLightGrid[i * 6 
+ 5] * lightScale;
+                               vec4_t c;
+
+                               c[0] = hdrLightGrid[i * 6];
+                               c[1] = hdrLightGrid[i * 6 + 1];
+                               c[2] = hdrLightGrid[i * 6 + 2];
+                               c[3] = 1.0f;
+
+                               R_ColorShiftLightingFloats(c, c);
+                               ColorToRGB16(c, &w->lightGrid16[i * 6]);
+
+                               c[0] = hdrLightGrid[i * 6 + 3];
+                               c[1] = hdrLightGrid[i * 6 + 4];
+                               c[2] = hdrLightGrid[i * 6 + 5];
+                               c[3] = 1.0f;
+
+                               R_ColorShiftLightingFloats(c, c);
+                               ColorToRGB16(c, &w->lightGrid16[i * 6 + 3]);
+                       }
+               }
+               else if (0)
+               {
+                       // promote 8-bit lightgrid to 16-bit
+                       w->lightGrid16 = ri.Hunk_Alloc(sizeof(w->lightGrid16) * 
6 * numGridPoints, h_low);
+
+                       for (i = 0; i < numGridPoints; i++)
+                       {
+                               w->lightGrid16[i * 6]     = w->lightGridData[i 
* 8] * 257;
+                               w->lightGrid16[i * 6 + 1] = w->lightGridData[i 
* 8 + 1] * 257;
+                               w->lightGrid16[i * 6 + 2] = w->lightGridData[i 
* 8 + 2] * 257;
+                               w->lightGrid16[i * 6 + 3] = w->lightGridData[i 
* 8 + 3] * 257;
+                               w->lightGrid16[i * 6 + 4] = w->lightGridData[i 
* 8 + 4] * 257;
+                               w->lightGrid16[i * 6 + 5] = w->lightGridData[i 
* 8 + 5] * 257;
                        }
                }
 
diff --git a/SP/code/rend2/tr_curve.c b/SP/code/rend2/tr_curve.c
index ca6f52c..d8aa6e6 100644
--- a/SP/code/rend2/tr_curve.c
+++ b/SP/code/rend2/tr_curve.c
@@ -61,10 +61,10 @@ static void LerpDrawVert( srfVert_t *a, srfVert_t *b, 
srfVert_t *out ) {
        out->lightmap[0] = 0.5f * ( a->lightmap[0] + b->lightmap[0] );
        out->lightmap[1] = 0.5f * ( a->lightmap[1] + b->lightmap[1] );
 
-       out->vertexColors[0] = 0.5f * (a->vertexColors[0] + b->vertexColors[0]);
-       out->vertexColors[1] = 0.5f * (a->vertexColors[1] + b->vertexColors[1]);
-       out->vertexColors[2] = 0.5f * (a->vertexColors[2] + b->vertexColors[2]);
-       out->vertexColors[3] = 0.5f * (a->vertexColors[3] + b->vertexColors[3]);
+       out->color[0] = ((int)a->color[0] + (int)b->color[0]) >> 1;
+       out->color[1] = ((int)a->color[1] + (int)b->color[1]) >> 1;
+       out->color[2] = ((int)a->color[2] + (int)b->color[2]) >> 1;
+       out->color[3] = ((int)a->color[3] + (int)b->color[3]) >> 1;
 }
 
 /*
diff --git a/SP/code/rend2/tr_extensions.c b/SP/code/rend2/tr_extensions.c
index 6c0b8ca..9be4800 100644
--- a/SP/code/rend2/tr_extensions.c
+++ b/SP/code/rend2/tr_extensions.c
@@ -295,9 +295,6 @@ void GLimp_InitExtraExtensions()
                ri.Printf(PRINT_ALL, result[2], extension);
        }
 
-       // use float lightmaps?
-       glRefConfig.floatLightmap = (glRefConfig.textureFloat && 
glRefConfig.halfFloatPixel && r_floatLightmap->integer && r_hdr->integer);
-
        // GL_ARB_vertex_array_object
        extension = "GL_ARB_vertex_array_object";
        glRefConfig.vertexArrayObject = qfalse;
@@ -318,8 +315,6 @@ void GLimp_InitExtraExtensions()
        extension = "GL_ARB_half_float_vertex";
        glRefConfig.packedTexcoordDataType = GL_FLOAT;
        glRefConfig.packedTexcoordDataSize = sizeof(float) * 2;
-       glRefConfig.packedColorDataType    = GL_FLOAT;
-       glRefConfig.packedColorDataSize    = sizeof(float) * 4;
        if( GLimp_HaveExtension( extension ) )
        {
                qboolean useExt = !!r_arb_half_float_vertex->integer;
@@ -328,8 +323,6 @@ void GLimp_InitExtraExtensions()
                {
                        glRefConfig.packedTexcoordDataType = GL_HALF_FLOAT;
                        glRefConfig.packedTexcoordDataSize = sizeof(uint16_t) * 
2;
-                       glRefConfig.packedColorDataType    = GL_HALF_FLOAT;
-                       glRefConfig.packedColorDataSize    = sizeof(uint16_t) * 
4;
                }
 
                ri.Printf(PRINT_ALL, result[useExt], extension);
diff --git a/SP/code/rend2/tr_extramath.c b/SP/code/rend2/tr_extramath.c
index bded757..a6c2a0d 100644
--- a/SP/code/rend2/tr_extramath.c
+++ b/SP/code/rend2/tr_extramath.c
@@ -201,7 +201,7 @@ int NextPowerOfTwo(int in)
 
 union f32_u {
        float f;
-       uint32_t i;
+       uint32_t ui;
        struct {
                unsigned int fraction:23;
                unsigned int exponent:8;
@@ -210,7 +210,7 @@ union f32_u {
 };
 
 union f16_u {
-       uint16_t i;
+       uint16_t ui;
        struct {
                unsigned int fraction:10;
                unsigned int exponent:5;
@@ -229,5 +229,19 @@ uint16_t FloatToHalf(float in)
        f16.pack.fraction = f32.pack.fraction >> 13;
        f16.pack.sign     = f32.pack.sign;
 
-       return f16.i;
+       return f16.ui;
+}
+
+float HalfToFloat(uint16_t in)
+{
+       union f32_u f32;
+       union f16_u f16;
+
+       f16.ui = in;
+
+       f32.pack.exponent = (int)(f16.pack.exponent) + 112;
+       f32.pack.fraction = f16.pack.fraction << 13;
+       f32.pack.sign = f16.pack.sign;
+
+       return f32.f;
 }
diff --git a/SP/code/rend2/tr_extramath.h b/SP/code/rend2/tr_extramath.h
index 9327153..d9ce170 100644
--- a/SP/code/rend2/tr_extramath.h
+++ b/SP/code/rend2/tr_extramath.h
@@ -98,5 +98,6 @@ void BoundingSphereOfSpheres(vec3_t origin1, float radius1, 
vec3_t origin2, floa
 
 int NextPowerOfTwo(int in);
 unsigned short FloatToHalf(float in);
+float HalfToFloat(unsigned short in);
 
 #endif
diff --git a/SP/code/rend2/tr_flares.c b/SP/code/rend2/tr_flares.c
index 8eaf01b..a807aee 100644
--- a/SP/code/rend2/tr_flares.c
+++ b/SP/code/rend2/tr_flares.c
@@ -467,9 +467,9 @@ void RB_RenderFlare( flare_t *f ) {
                        return;
        }
 
-       iColor[0] = color[0] * fogFactors[0];
-       iColor[1] = color[1] * fogFactors[1];
-       iColor[2] = color[2] * fogFactors[2];
+       iColor[0] = color[0] * fogFactors[0] * 257;
+       iColor[1] = color[1] * fogFactors[1] * 257;
+       iColor[2] = color[2] * fogFactors[2] * 257;
 
        if ( f->flags & 2 ) {  // spotlight flare
                RB_BeginSurface( tr.spotFlareShader, f->fogNum, 0 );
@@ -482,44 +482,44 @@ void RB_RenderFlare( flare_t *f ) {
        tess.xyz[tess.numVertexes][1] = f->windowY - size;
        tess.texCoords[tess.numVertexes][0][0] = 0;
        tess.texCoords[tess.numVertexes][0][1] = 0;
-       tess.vertexColors[tess.numVertexes][0] = iColor[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = iColor[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = iColor[2] / 255.0f;
-       tess.vertexColors[tess.numVertexes][3] = f->drawIntensity;      
//----(SA)      mod for alpha blend rather than additive
-//     tess.vertexColors[tess.numVertexes][3] = 1.0f;          // rend2
+       tess.color[tess.numVertexes][0] = iColor[0];
+       tess.color[tess.numVertexes][1] = iColor[1];
+       tess.color[tess.numVertexes][2] = iColor[2];
+//     tess.color[tess.numVertexes][3] = 65535;                        //rend2
+       tess.color[tess.numVertexes][3] = f->drawIntensity * 65535;     
//----(SA)      mod for alpha blend rather than additive
        tess.numVertexes++;
 
        tess.xyz[tess.numVertexes][0] = f->windowX - size;
        tess.xyz[tess.numVertexes][1] = f->windowY + size;
        tess.texCoords[tess.numVertexes][0][0] = 0;
        tess.texCoords[tess.numVertexes][0][1] = 1;
-       tess.vertexColors[tess.numVertexes][0] = iColor[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = iColor[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = iColor[2] / 255.0f;
-       tess.vertexColors[tess.numVertexes][3] = f->drawIntensity;      
//----(SA)      mod for alpha blend rather than additive
-//     tess.vertexColors[tess.numVertexes][3] = 1.0f;          // rend2
+       tess.color[tess.numVertexes][0] = iColor[0];
+       tess.color[tess.numVertexes][1] = iColor[1];
+       tess.color[tess.numVertexes][2] = iColor[2];
+//     tess.color[tess.numVertexes][3] = 65535;                        // rend2
+       tess.color[tess.numVertexes][3] = f->drawIntensity * 65535;     
//----(SA)      mod for alpha blend rather than additive
        tess.numVertexes++;
 
        tess.xyz[tess.numVertexes][0] = f->windowX + size;
        tess.xyz[tess.numVertexes][1] = f->windowY + size;
        tess.texCoords[tess.numVertexes][0][0] = 1;
        tess.texCoords[tess.numVertexes][0][1] = 1;
-       tess.vertexColors[tess.numVertexes][0] = iColor[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = iColor[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = iColor[2] / 255.0f;
-       tess.vertexColors[tess.numVertexes][3] = f->drawIntensity;      
//----(SA)      mod for alpha blend rather than additive
-//     tess.vertexColors[tess.numVertexes][3] = 1.0f;          // rend2
+       tess.color[tess.numVertexes][0] = iColor[0];
+       tess.color[tess.numVertexes][1] = iColor[1];
+       tess.color[tess.numVertexes][2] = iColor[2];
+//     tess.color[tess.numVertexes][3] = 65535;                        // rend2
+       tess.color[tess.numVertexes][3] = f->drawIntensity * 65535;     
//----(SA)      mod for alpha blend rather than additive
        tess.numVertexes++;
 
        tess.xyz[tess.numVertexes][0] = f->windowX + size;
        tess.xyz[tess.numVertexes][1] = f->windowY - size;
        tess.texCoords[tess.numVertexes][0][0] = 1;
        tess.texCoords[tess.numVertexes][0][1] = 0;
-       tess.vertexColors[tess.numVertexes][0] = iColor[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = iColor[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = iColor[2] / 255.0f;
-       tess.vertexColors[tess.numVertexes][3] = f->drawIntensity;      
//----(SA)      mod for alpha blend rather than additive
-//     tess.vertexColors[tess.numVertexes][3] = 1.0f;          // rend2
+       tess.color[tess.numVertexes][0] = iColor[0];
+       tess.color[tess.numVertexes][1] = iColor[1];
+       tess.color[tess.numVertexes][2] = iColor[2];
+//     tess.color[tess.numVertexes][3] = 65535;                        // rend2
+       tess.color[tess.numVertexes][3] = f->drawIntensity * 65535;     
//----(SA)      mod for alpha blend rather than additive
        tess.numVertexes++;
 
        tess.indexes[tess.numIndexes++] = 0;
diff --git a/SP/code/rend2/tr_glsl.c b/SP/code/rend2/tr_glsl.c
index 545f809..1709b6f 100644
--- a/SP/code/rend2/tr_glsl.c
+++ b/SP/code/rend2/tr_glsl.c
@@ -1046,9 +1046,6 @@ void GLSL_InitGPUShaders(void)
                if (glRefConfig.swizzleNormalmap)
                        Q_strcat(extradefines, 1024, "#define 
SWIZZLE_NORMALMAP\n");
 
-               if (r_hdr->integer && !glRefConfig.floatLightmap)
-                       Q_strcat(extradefines, 1024, "#define RGBM_LIGHTMAP\n");
-
                if (lightType)
                {
                        Q_strcat(extradefines, 1024, "#define USE_LIGHT\n");
diff --git a/SP/code/rend2/tr_image.c b/SP/code/rend2/tr_image.c
index 428ffc8..be1ea98 100644
--- a/SP/code/rend2/tr_image.c
+++ b/SP/code/rend2/tr_image.c
@@ -164,16 +164,15 @@ R_ImageList_f
 ===============
 */
 void R_ImageList_f( void ) {
-#if 1
        int i;
        int estTotalSize = 0;
 
-       ri.Printf(PRINT_ALL, "\n      -w-- -h-- type  -size- --name-------\n");
+       ri.Printf(PRINT_ALL, "\n      -w-- -h-- -type-- -size- 
--name-------\n");
 
        for ( i = 0 ; i < tr.numImages ; i++ )
        {
                image_t *image = tr.images[i];
-               char *format = "???? ";
+               char *format = "????   ";
                char *sizeSuffix;
                int estSize;
                int displaySize;
@@ -183,95 +182,121 @@ void R_ImageList_f( void ) {
                switch(image->internalFormat)
                {
                        case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
-                               format = "sDXT1";
+                               format = "sDXT1  ";
                                // 64 bits per 16 pixels, so 4 bits per pixel
                                estSize /= 2;
                                break;
                        case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-                               format = "sDXT5";
+                               format = "sDXT5  ";
                                // 128 bits per 16 pixels, so 1 byte per pixel
                                break;
                        case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB:
-                               format = "sBPTC";
+                               format = "sBPTC  ";
                                // 128 bits per 16 pixels, so 1 byte per pixel
                                break;
                        case GL_COMPRESSED_RG_RGTC2:
-                               format = "RGTC2";
+                               format = "RGTC2  ";
                                // 128 bits per 16 pixels, so 1 byte per pixel
                                break;
                        case GL_COMPRESSED_RGB_S3TC_DXT1_EXT:
-                               format = "DXT1 ";
+                               format = "DXT1   ";
                                // 64 bits per 16 pixels, so 4 bits per pixel
                                estSize /= 2;
                                break;
                        case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-                               format = "DXT1a";
+                               format = "DXT1a  ";
                                // 64 bits per 16 pixels, so 4 bits per pixel
                                estSize /= 2;
                                break;
                        case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-                               format = "DXT5 ";
+                               format = "DXT5   ";
                                // 128 bits per 16 pixels, so 1 byte per pixel
                                break;
                        case GL_COMPRESSED_RGBA_BPTC_UNORM_ARB:
-                               format = "BPTC ";
+                               format = "BPTC   ";
                                // 128 bits per 16 pixels, so 1 byte per pixel
                                break;
                        case GL_RGB4_S3TC:
-                               format = "S3TC ";
+                               format = "S3TC   ";
                                // same as DXT1?
                                estSize /= 2;
                                break;
+                       case GL_RGBA16F:
+                               format = "RGBA16F";
+                               // 8 bytes per pixel
+                               estSize *= 8;
+                               break;
+                       case GL_RGBA16:
+                               format = "RGBA16 ";
+                               // 8 bytes per pixel
+                               estSize *= 8;
+                               break;
                        case GL_RGBA4:
                        case GL_RGBA8:
                        case GL_RGBA:
-                               format = "RGBA ";
+                               format = "RGBA   ";
                                // 4 bytes per pixel
                                estSize *= 4;
                                break;
                        case GL_LUMINANCE8:
                        case GL_LUMINANCE16:
                        case GL_LUMINANCE:
-                               format = "L    ";
+                               format = "L      ";
                                // 1 byte per pixel?
                                break;
                        case GL_RGB5:
                        case GL_RGB8:
                        case GL_RGB:
-                               format = "RGB  ";
+                               format = "RGB    ";
                                // 3 bytes per pixel?
                                estSize *= 3;
                                break;
                        case GL_LUMINANCE8_ALPHA8:
                        case GL_LUMINANCE16_ALPHA16:
                        case GL_LUMINANCE_ALPHA:
-                               format = "LA   ";
+                               format = "LA     ";
                                // 2 bytes per pixel?
                                estSize *= 2;
                                break;
                        case GL_SRGB_EXT:
                        case GL_SRGB8_EXT:
-                               format = "sRGB ";
+                               format = "sRGB   ";
                                // 3 bytes per pixel?
                                estSize *= 3;
                                break;
                        case GL_SRGB_ALPHA_EXT:
                        case GL_SRGB8_ALPHA8_EXT:
-                               format = "sRGBA";
+                               format = "sRGBA  ";
                                // 4 bytes per pixel?
                                estSize *= 4;
                                break;
                        case GL_SLUMINANCE_EXT:
                        case GL_SLUMINANCE8_EXT:
-                               format = "sL   ";
+                               format = "sL     ";
                                // 1 byte per pixel?
                                break;
                        case GL_SLUMINANCE_ALPHA_EXT:
                        case GL_SLUMINANCE8_ALPHA8_EXT:
-                               format = "sLA  ";
+                               format = "sLA    ";
                                // 2 byte per pixel?
                                estSize *= 2;
                                break;
+                       case GL_DEPTH_COMPONENT16:
+                               format = "Depth16";
+                               // 2 bytes per pixel
+                               estSize *= 2;
+                               break;
+                       case GL_DEPTH_COMPONENT24:
+                               format = "Depth24";
+                               // 3 bytes per pixel
+                               estSize *= 3;
+                               break;
+                       case GL_DEPTH_COMPONENT:
+                       case GL_DEPTH_COMPONENT32:
+                               format = "Depth32";
+                               // 4 bytes per pixel
+                               estSize *= 4;
+                               break;
                }
 
                // mipmap adds about 50%
@@ -306,107 +331,6 @@ void R_ImageList_f( void ) {
        ri.Printf (PRINT_ALL, " ---------\n");
        ri.Printf (PRINT_ALL, " approx %i bytes\n", estTotalSize);
        ri.Printf (PRINT_ALL, " %i total images\n\n", tr.numImages );
-#else
-       int i;
-       image_t *image;
-       int texels;
-       const char *yesno[] = {
-               "no ", "yes"
-       };
-
-       ri.Printf( PRINT_ALL, "\n      -w-- -h-- -mm- -TMU- -if-- wrap 
--name-------\n" );
-       texels = 0;
-
-       for ( i = 0 ; i < tr.numImages ; i++ ) {
-               image = tr.images[ i ];
-
-               texels += image->uploadWidth * image->uploadHeight;
-               ri.Printf( PRINT_ALL,  "%4i: %4i %4i  %s   %d   ",
-                       i, image->uploadWidth, image->uploadHeight, 
yesno[(image->flags & IMGFLAG_MIPMAP) ? 1 : 0], image->TMU );
-               switch ( image->internalFormat ) {
-               case 1:
-                       ri.Printf( PRINT_ALL, "I    " );
-                       break;
-               case 2:
-                       ri.Printf( PRINT_ALL, "IA   " );
-                       break;
-               case 3:
-                       ri.Printf( PRINT_ALL, "RGB  " );
-                       break;
-               case 4:
-                       ri.Printf( PRINT_ALL, "RGBA " );
-                       break;
-               case GL_RGBA8:
-                       ri.Printf( PRINT_ALL, "RGBA8" );
-                       break;
-               case GL_RGB8:
-                       ri.Printf( PRINT_ALL, "RGB8" );
-                       break;
-               case GL_RGB4_S3TC:
-                       ri.Printf( PRINT_ALL, "S3TC4" );
-                       break;
-               case GL_COMPRESSED_RGBA_S3TC_DXT1_EXT:
-                       ri.Printf( PRINT_ALL, "DXT1 " );
-                       break;
-               case GL_COMPRESSED_RGBA_S3TC_DXT5_EXT:
-                       ri.Printf( PRINT_ALL, "DXT5 " );
-                       break;
-               case GL_COMPRESSED_LUMINANCE_ALPHA_LATC2_EXT:
-                       ri.Printf( PRINT_ALL, "LATC " );
-                       break;
-               case GL_RGBA4:
-                       ri.Printf( PRINT_ALL, "RGBA4" );
-                       break;
-               case GL_RGB5:
-                       ri.Printf( PRINT_ALL, "RGB5 " );
-                       break;
-               case GL_SRGB_EXT:
-                       ri.Printf( PRINT_ALL, "sRGB " );
-                       break;
-               case GL_SRGB8_EXT:
-                       ri.Printf( PRINT_ALL, "sRGB8" );
-                       break;
-               case GL_SRGB_ALPHA_EXT:
-               case GL_SRGB8_ALPHA8_EXT:
-                       ri.Printf( PRINT_ALL, "sRGBA" );
-                       break;
-                       /*
-               case GL_SLUMINANCE_EXT:
-                       break;
-               case GL_SLUMINANCE8_EXT:
-                       break;
-               case GL_SLUMINANCE_ALPHA_EXT:
-                       break;
-               case GL_SLUMINANCE8_ALPHA8_EXT:
-                       break;
-                       */
-               case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT:
-                       ri.Printf( PRINT_ALL, "sDXT1" );
-                       break;
-               case GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT:
-                       ri.Printf( PRINT_ALL, "sDXT5" );
-                       break;
-               case GL_COMPRESSED_RGBA_BPTC_UNORM_ARB:
-                       ri.Printf( PRINT_ALL, "BPTC " );
-                       break;
-               case GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_ARB:
-                       ri.Printf( PRINT_ALL, "sBPTC" );
-                       break;
-               default:
-                       ri.Printf( PRINT_ALL, "???? " );
-               }
-
-               if (image->flags & IMGFLAG_CLAMPTOEDGE)
-                       ri.Printf( PRINT_ALL, "clmp " );
-               else
-                       ri.Printf( PRINT_ALL, "rept " );
-
-               ri.Printf( PRINT_ALL, " %s\n", image->imgName );
-       }
-       ri.Printf( PRINT_ALL, " ---------\n" );
-       ri.Printf( PRINT_ALL, " %i total texels (not including mipmaps)\n", 
texels );
-       ri.Printf( PRINT_ALL, " %i total images\n\n", tr.numImages );
-#endif
 }
 
 //=======================================================================
@@ -2104,7 +2028,20 @@ static void RawImage_UploadTexture(GLuint texture, byte 
*data, int x, int y, int
        dataFormat = PixelDataFormatFromInternalFormat(internalFormat);
 
        // FIXME: This is an old hack to use half floats with lightmaps, use 
picFormat to determine this instead.
-       dataType = (internalFormat == GL_RGBA16F_ARB) ? GL_HALF_FLOAT_ARB : 
GL_UNSIGNED_BYTE;
+       switch (internalFormat)
+       {
+               case GL_RGBA16F_ARB:
+                       dataType = GL_HALF_FLOAT_ARB;
+                       break;
+
+               case GL_RGBA16:
+                       dataType = GL_UNSIGNED_SHORT;
+                       break;
+
+               default:
+                       dataType = GL_UNSIGNED_BYTE;
+                       break;
+       }
 
        miplevel = 0;
        do
diff --git a/SP/code/rend2/tr_light.c b/SP/code/rend2/tr_light.c
index 835762f..35c0fe7 100644
--- a/SP/code/rend2/tr_light.c
+++ b/SP/code/rend2/tr_light.c
@@ -195,7 +195,9 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent, 
world_t *world ) {
                byte    *data;
                int lat, lng;
                vec3_t normal;
-
+               #if idppc
+               float d0, d1, d2, d3, d4, d5;
+               #endif
                factor = 1.0;
                data = gridData;
                for ( j = 0 ; j < 3 ; j++ ) {
@@ -213,10 +215,10 @@ static void R_SetupEntityLightingGrid( trRefEntity_t 
*ent, world_t *world ) {
                if ( j != 3 )
                        continue;
 
-               if (world->hdrLightGrid)
+               if (world->lightGrid16)
                {
-                       float *hdrData = world->hdrLightGrid + (int)(data - 
world->lightGridData) / 8 * 6;
-                       if 
(!(hdrData[0]+hdrData[1]+hdrData[2]+hdrData[3]+hdrData[4]+hdrData[5]) ) {
+                       uint16_t *data16 = world->lightGrid16 + (int)(data - 
world->lightGridData) / 8 * 6;
+                       if 
(!(data16[0]+data16[1]+data16[2]+data16[3]+data16[4]+data16[5])) {
                                continue;       // ignore samples in walls
                        }
                }
@@ -227,19 +229,30 @@ static void R_SetupEntityLightingGrid( trRefEntity_t 
*ent, world_t *world ) {
                        }
                }
                totalFactor += factor;
-
-               if (world->hdrLightGrid)
+               #if idppc
+               d0 = data[0]; d1 = data[1]; d2 = data[2];
+               d3 = data[3]; d4 = data[4]; d5 = data[5];
+
+               ent->ambientLight[0] += factor * d0;
+               ent->ambientLight[1] += factor * d1;
+               ent->ambientLight[2] += factor * d2;
+
+               ent->directedLight[0] += factor * d3;
+               ent->directedLight[1] += factor * d4;
+               ent->directedLight[2] += factor * d5;
+               #else
+               if (world->lightGrid16)
                {
                        // FIXME: this is hideous
-                       float *hdrData = world->hdrLightGrid + (int)(data - 
world->lightGridData) / 8 * 6;
+                       uint16_t *data16 = world->lightGrid16 + (int)(data - 
world->lightGridData) / 8 * 6;
 
-                       ent->ambientLight[0] += factor * hdrData[0];
-                       ent->ambientLight[1] += factor * hdrData[1];
-                       ent->ambientLight[2] += factor * hdrData[2];
+                       ent->ambientLight[0] += factor * data16[0] / 257.0f;
+                       ent->ambientLight[1] += factor * data16[1] / 257.0f;
+                       ent->ambientLight[2] += factor * data16[2] / 257.0f;
 
-                       ent->directedLight[0] += factor * hdrData[3];
-                       ent->directedLight[1] += factor * hdrData[4];
-                       ent->directedLight[2] += factor * hdrData[5];
+                       ent->directedLight[0] += factor * data16[3] / 257.0f;
+                       ent->directedLight[1] += factor * data16[4] / 257.0f;
+                       ent->directedLight[2] += factor * data16[5] / 257.0f;
                }
                else
                {
@@ -251,7 +264,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent, 
world_t *world ) {
                        ent->directedLight[1] += factor * data[4];
                        ent->directedLight[2] += factor * data[5];
                }
-
+               #endif
                lat = data[7];
                lng = data[6];
                lat *= ( FUNCTABLE_SIZE / 256 );
diff --git a/SP/code/rend2/tr_local.h b/SP/code/rend2/tr_local.h
index 0f48b4d..e714967 100644
--- a/SP/code/rend2/tr_local.h
+++ b/SP/code/rend2/tr_local.h
@@ -269,8 +269,8 @@ typedef enum {
        CGEN_IDENTITY,          // always (1,1,1,1)
        CGEN_ENTITY,            // grabbed from entity's modulate field
        CGEN_ONE_MINUS_ENTITY,  // grabbed from 1 - entity.modulate
-       CGEN_EXACT_VERTEX,      // tess.vertexColors
-       CGEN_VERTEX,            // tess.vertexColors * tr.identityLight
+       CGEN_EXACT_VERTEX,      // tess.color
+       CGEN_VERTEX,            // tess.color * tr.identityLight
        CGEN_EXACT_VERTEX_LIT,  // like CGEN_EXACT_VERTEX but takes a light 
direction from the lightgrid
        CGEN_VERTEX_LIT,        // like CGEN_VERTEX but takes a light direction 
from the lightgrid
        CGEN_ONE_MINUS_VERTEX,
@@ -1012,7 +1012,7 @@ typedef struct
        int16_t         normal[4];
        int16_t         tangent[4];
        int16_t         lightdir[4];
-       vec4_t                  vertexColors;
+       uint16_t        color[4];
 
 #if DEBUG_OPTIMIZEVERTICES
        unsigned int    id;
@@ -1271,7 +1271,7 @@ typedef struct {
        vec3_t lightGridInverseSize;
        int lightGridBounds[3];
        byte        *lightGridData;
-       float           *hdrLightGrid;
+       uint16_t        *lightGrid16;
 
        int numClusters;
        int clusterBytes;
@@ -1543,11 +1543,8 @@ typedef struct {
        qboolean seamlessCubeMap;
 
        GLenum packedTexcoordDataType;
-       GLenum packedColorDataType;
        int packedTexcoordDataSize;
-       int packedColorDataSize;
 
-       qboolean floatLightmap;
        qboolean vertexArrayObject;
        qboolean directStateAccess;
 } glRefConfig_t;
@@ -2259,7 +2256,7 @@ typedef struct shaderCommands_s
        int16_t         normal[SHADER_MAX_VERTEXES][4] QALIGN(16);
        int16_t         tangent[SHADER_MAX_VERTEXES][4] QALIGN(16);
        vec2_t          texCoords[SHADER_MAX_VERTEXES][2] QALIGN(16);
-       vec4_t          vertexColors[SHADER_MAX_VERTEXES] QALIGN(16);
+       uint16_t        color[SHADER_MAX_VERTEXES][4] QALIGN(16);
        int16_t         lightdir[SHADER_MAX_VERTEXES][4] QALIGN(16);
        //int                   vertexDlightBits[SHADER_MAX_VERTEXES] 
QALIGN(16);
 
@@ -2427,7 +2424,7 @@ VERTEX BUFFER OBJECTS
 void R_VaoPackTangent(int16_t *out, vec4_t v);
 void R_VaoPackNormal(int16_t *out, vec3_t v);
 int R_VaoPackTexCoord(byte *out, vec2_t st);
-int R_VaoPackColors(byte *out, vec4_t color);
+void R_VaoPackColor(uint16_t *out, vec4_t c);
 void R_VaoUnpackTangent(vec4_t v, int16_t *pack);
 void R_VaoUnpackNormal(vec3_t v, int16_t *pack);
 
diff --git a/SP/code/rend2/tr_model_iqm.c b/SP/code/rend2/tr_model_iqm.c
index b650547..cc102ed 100644
--- a/SP/code/rend2/tr_model_iqm.c
+++ b/SP/code/rend2/tr_model_iqm.c
@@ -1027,7 +1027,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
        int16_t *outNormal;
        int16_t *outTangent;
        vec2_t          (*outTexCoord)[2];
-       vec4_t  *outColor;
+       uint16_t *outColor;
 
        int     frame = data->num_frames ? backEnd.currentEntity->e.frame % 
data->num_frames : 0;
        int     oldframe = data->num_frames ? backEnd.currentEntity->e.oldframe 
% data->num_frames : 0;
@@ -1043,7 +1043,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
        outNormal = tess.normal[tess.numVertexes];
        outTangent = tess.tangent[tess.numVertexes];
        outTexCoord = &tess.texCoords[tess.numVertexes];
-       outColor = &tess.vertexColors[tess.numVertexes];
+       outColor = tess.color[tess.numVertexes];
 
        // compute interpolated joint matrices
        if ( data->num_poses > 0 ) {
@@ -1052,7 +1052,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
 
        // transform vertexes and fill other data
        for( i = 0; i < surf->num_vertexes;
-               i++, outXYZ++, outNormal+=4, outTexCoord++, outColor++ ) {
+               i++, outXYZ++, outNormal+=4, outTexCoord++, outColor+=4 ) {
                int     j, k;
                float   vtxMat[12];
                float   nrmMat[9];
@@ -1137,10 +1137,10 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
                        outTangent+=4;
                }
 
-               (*outColor)[0] = data->colors[4*vtx+0] / 255.0f;
-               (*outColor)[1] = data->colors[4*vtx+1] / 255.0f;
-               (*outColor)[2] = data->colors[4*vtx+2] / 255.0f;
-               (*outColor)[3] = data->colors[4*vtx+3] / 255.0f;
+               outColor[0] = data->colors[4*vtx+0] * 257;
+               outColor[1] = data->colors[4*vtx+1] * 257;
+               outColor[2] = data->colors[4*vtx+2] * 257;
+               outColor[3] = data->colors[4*vtx+3] * 257;
        }
 
        tri = data->triangles + 3 * surf->first_triangle;
diff --git a/SP/code/rend2/tr_shade_calc.c b/SP/code/rend2/tr_shade_calc.c
index ba73d65..e9f2a5b 100644
--- a/SP/code/rend2/tr_shade_calc.c
+++ b/SP/code/rend2/tr_shade_calc.c
@@ -439,6 +439,7 @@ static void AutospriteDeform( void ) {
        }
 
        for ( i = 0 ; i < oldVerts ; i += 4 ) {
+               vec4_t color;
                // find the midpoint
                xyz = tess.xyz[i];
 
@@ -469,7 +470,8 @@ static void AutospriteDeform( void ) {
                        VectorScale( up, axisLength, up );
                }
 
-               RB_AddQuadStamp( mid, left, up, tess.vertexColors[i] );
+               VectorScale4(tess.color[i], 1.0f / 65535.0f, color);
+               RB_AddQuadStamp( mid, left, up, color );
        }
 }
 
diff --git a/SP/code/rend2/tr_surface.c b/SP/code/rend2/tr_surface.c
index 39bbe5a..1027a0a 100644
--- a/SP/code/rend2/tr_surface.c
+++ b/SP/code/rend2/tr_surface.c
@@ -95,6 +95,7 @@ RB_AddQuadStampExt
 void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, float 
color[4], float s1, float t1, float s2, float t2 ) {
        vec3_t normal;
        int16_t     iNormal[4];
+       uint16_t    iColor[4];
        int ndx;
 
        RB_CheckVao(tess.vao);
@@ -154,10 +155,13 @@ void RB_AddQuadStampExt( vec3_t origin, vec3_t left, 
vec3_t up, float color[4],
 
        // constant color all the way around
        // should this be identity and let the shader specify from entity?
-       VectorCopy4(color, tess.vertexColors[ndx]);
-       VectorCopy4(color, tess.vertexColors[ndx+1]);
-       VectorCopy4(color, tess.vertexColors[ndx+2]);
-       VectorCopy4(color, tess.vertexColors[ndx+3]);
+
+       R_VaoPackColor(iColor, color);
+
+       VectorCopy4(iColor, tess.color[ndx]);
+       VectorCopy4(iColor, tess.color[ndx + 1]);
+       VectorCopy4(iColor, tess.color[ndx + 2]);
+       VectorCopy4(iColor, tess.color[ndx + 3]);
 
        tess.numVertexes += 4;
        tess.numIndexes += 6;
@@ -324,10 +328,10 @@ static void RB_SurfacePolychain( srfPoly_t *p ) {
                VectorCopy( p->verts[i].xyz, tess.xyz[numv] );
                tess.texCoords[numv][0][0] = p->verts[i].st[0];
                tess.texCoords[numv][0][1] = p->verts[i].st[1];
-               tess.vertexColors[numv][0] = p->verts[ i ].modulate[0] / 255.0f;
-               tess.vertexColors[numv][1] = p->verts[ i ].modulate[1] / 255.0f;
-               tess.vertexColors[numv][2] = p->verts[ i ].modulate[2] / 255.0f;
-               tess.vertexColors[numv][3] = p->verts[ i ].modulate[3] / 255.0f;
+               tess.color[numv][0] = (int)p->verts[i].modulate[0] * 257;
+               tess.color[numv][1] = (int)p->verts[i].modulate[1] * 257;
+               tess.color[numv][2] = (int)p->verts[i].modulate[2] * 257;
+               tess.color[numv][3] = (int)p->verts[i].modulate[3] * 257;
 
                numv++;
        }
@@ -353,7 +357,7 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, 
srfVert_t *verts, int numIn
        int16_t        *normal;
        int16_t        *tangent;
        glIndex_t      *outIndex;
-       float           *color;
+       uint16_t       *color;
 
        RB_CheckVao(tess.vao);
 
@@ -409,9 +413,9 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, 
srfVert_t *verts, int numIn
        if ( tess.shader->vertexAttribs & ATTR_COLOR )
        {
                dv = verts;
-               color = tess.vertexColors[ tess.numVertexes ];
+               color = tess.color[ tess.numVertexes ];
                for ( i = 0 ; i < numVerts ; i++, dv++, color+=4 )
-                       VectorCopy4(dv->vertexColors, color);
+                       VectorCopy4(dv->color, color);
        }
 
        if ( tess.shader->vertexAttribs & ATTR_LIGHTDIRECTION )
@@ -664,34 +668,34 @@ static void DoRailCore( const vec3_t start, const vec3_t 
end, const vec3_t up, f
        VectorMA( start, spanWidth, up, tess.xyz[tess.numVertexes] );
        tess.texCoords[tess.numVertexes][0][0] = 0;
        tess.texCoords[tess.numVertexes][0][1] = 0;
-       tess.vertexColors[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 0.25 / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 0.25 / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 0.25 / 255.0f;
+       tess.color[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 0.25f * 257.0f;
+       tess.color[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 0.25f * 257.0f;
+       tess.color[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 0.25f * 257.0f;
        tess.numVertexes++;
 
        VectorMA( start, spanWidth2, up, tess.xyz[tess.numVertexes] );
        tess.texCoords[tess.numVertexes][0][0] = 0;
        tess.texCoords[tess.numVertexes][0][1] = 1;
-       tess.vertexColors[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] / 255.0f;
+       tess.color[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 257;
+       tess.color[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 257;
+       tess.color[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 257;
        tess.numVertexes++;
 
        VectorMA( end, spanWidth, up, tess.xyz[tess.numVertexes] );
 
        tess.texCoords[tess.numVertexes][0][0] = t;
        tess.texCoords[tess.numVertexes][0][1] = 0;
-       tess.vertexColors[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] / 255.0f;
+       tess.color[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 257;
+       tess.color[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 257;
+       tess.color[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 257;
        tess.numVertexes++;
 
        VectorMA( end, spanWidth2, up, tess.xyz[tess.numVertexes] );
        tess.texCoords[tess.numVertexes][0][0] = t;
        tess.texCoords[tess.numVertexes][0][1] = 1;
-       tess.vertexColors[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] / 255.0f;
-       tess.vertexColors[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] / 255.0f;
-       tess.vertexColors[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] / 255.0f;
+       tess.color[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 257;
+       tess.color[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 257;
+       tess.color[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 257;
        tess.numVertexes++;
 
        tess.indexes[tess.numIndexes++] = vbase;
@@ -748,9 +752,9 @@ static void DoRailDiscs( int numSegs, const vec3_t start, 
const vec3_t dir, cons
                        VectorCopy( pos[j], tess.xyz[tess.numVertexes] );
                        tess.texCoords[tess.numVertexes][0][0] = ( j < 2 );
                        tess.texCoords[tess.numVertexes][0][1] = ( j && j != 3 
);
-                       tess.vertexColors[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] / 255.0f;
-                       tess.vertexColors[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] / 255.0f;
-                       tess.vertexColors[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] / 255.0f;
+                       tess.color[tess.numVertexes][0] = 
backEnd.currentEntity->e.shaderRGBA[0] * 257;
+                       tess.color[tess.numVertexes][1] = 
backEnd.currentEntity->e.shaderRGBA[1] * 257;
+                       tess.color[tess.numVertexes][2] = 
backEnd.currentEntity->e.shaderRGBA[2] * 257;
                        tess.numVertexes++;
 
                        VectorAdd( pos[j], dir, pos[j] );
@@ -1041,7 +1045,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
        float   *texCoords, *lightCoords;
        int16_t *normal;
        int16_t *tangent;
-       float   *color;
+       uint16_t *color;
        int16_t *lightdir;
        srfVert_t       *dv;
        int rows, irows, vrows;
@@ -1131,7 +1135,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
                tangent = tess.tangent[numVertexes];
                texCoords = tess.texCoords[numVertexes][0];
                lightCoords = tess.texCoords[numVertexes][1];
-               color = tess.vertexColors[numVertexes];
+               color = tess.color[numVertexes];
                lightdir = tess.lightdir[numVertexes];
                //vDlightBits = &tess.vertexDlightBits[numVertexes];
 
@@ -1172,7 +1176,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
 
                                if ( tess.shader->vertexAttribs & ATTR_COLOR )
                                {
-                                       VectorCopy4(dv->vertexColors, color);
+                                       VectorCopy4(dv->color, color);
                                        color += 4;
                                }
 
diff --git a/SP/code/rend2/tr_vbo.c b/SP/code/rend2/tr_vbo.c
index 4a2ddf8..0028094 100644
--- a/SP/code/rend2/tr_vbo.c
+++ b/SP/code/rend2/tr_vbo.c
@@ -61,30 +61,12 @@ int R_VaoPackTexCoord(byte *out, vec2_t st)
        }
 }
 
-int R_VaoPackColors(byte *out, vec4_t color)
+void R_VaoPackColor(uint16_t *out, vec4_t c)
 {
-       if (glRefConfig.packedTexcoordDataType == GL_HALF_FLOAT)
-       {
-               uint16_t *num = (uint16_t *)out;
-
-               *num++ = FloatToHalf(color[0]);
-               *num++ = FloatToHalf(color[1]);
-               *num++ = FloatToHalf(color[2]);
-               *num++ = FloatToHalf(color[3]);
-
-               return sizeof(*num) * 4;
-       }
-       else
-       {
-               float *num = (float *)out;
-
-               *num++ = color[0];
-               *num++ = color[1];
-               *num++ = color[2];
-               *num++ = color[3];
-
-               return sizeof(*num) * 4;
-       }
+       out[0] = c[0] * 65535.0f + 0.5f;
+       out[1] = c[1] * 65535.0f + 0.5f;
+       out[2] = c[2] * 65535.0f + 0.5f;
+       out[3] = c[3] * 65535.0f + 0.5f;
 }
 
 void R_VaoUnpackTangent(vec4_t v, int16_t *pack)
@@ -267,7 +249,7 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, 
srfVert_t *verts, int num
        vao->attribs[ATTR_INDEX_TANGENT       ].type = GL_SHORT;
        vao->attribs[ATTR_INDEX_TEXCOORD      ].type = 
glRefConfig.packedTexcoordDataType;
        vao->attribs[ATTR_INDEX_LIGHTCOORD    ].type = 
glRefConfig.packedTexcoordDataType;
-       vao->attribs[ATTR_INDEX_COLOR         ].type = 
glRefConfig.packedColorDataType;
+       vao->attribs[ATTR_INDEX_COLOR         ].type = GL_UNSIGNED_SHORT;
        vao->attribs[ATTR_INDEX_LIGHTDIRECTION].type = GL_SHORT;
 
        vao->attribs[ATTR_INDEX_POSITION      ].normalized = GL_FALSE;
@@ -275,7 +257,7 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, 
srfVert_t *verts, int num
        vao->attribs[ATTR_INDEX_TANGENT       ].normalized = GL_TRUE;
        vao->attribs[ATTR_INDEX_TEXCOORD      ].normalized = GL_FALSE;
        vao->attribs[ATTR_INDEX_LIGHTCOORD    ].normalized = GL_FALSE;
-       vao->attribs[ATTR_INDEX_COLOR         ].normalized = GL_FALSE;
+       vao->attribs[ATTR_INDEX_COLOR         ].normalized = GL_TRUE;
        vao->attribs[ATTR_INDEX_LIGHTDIRECTION].normalized = GL_TRUE;
 
        vao->attribs[ATTR_INDEX_POSITION      ].offset = 0;        dataSize  = 
sizeof(verts[0].xyz);
@@ -283,7 +265,7 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, 
srfVert_t *verts, int num
        vao->attribs[ATTR_INDEX_TANGENT       ].offset = dataSize; dataSize += 
sizeof(verts[0].tangent);
        vao->attribs[ATTR_INDEX_TEXCOORD      ].offset = dataSize; dataSize += 
glRefConfig.packedTexcoordDataSize;
        vao->attribs[ATTR_INDEX_LIGHTCOORD    ].offset = dataSize; dataSize += 
glRefConfig.packedTexcoordDataSize;
-       vao->attribs[ATTR_INDEX_COLOR         ].offset = dataSize; dataSize += 
glRefConfig.packedColorDataSize;
+       vao->attribs[ATTR_INDEX_COLOR         ].offset = dataSize; dataSize += 
sizeof(verts[0].color);
        vao->attribs[ATTR_INDEX_LIGHTDIRECTION].offset = dataSize; dataSize += 
sizeof(verts[0].lightdir);
 
        vao->attribs[ATTR_INDEX_POSITION      ].stride = dataSize;
@@ -328,7 +310,8 @@ vao_t *R_CreateVao2(const char *name, int numVertexes, 
srfVert_t *verts, int num
                dataOfs += R_VaoPackTexCoord(data + dataOfs, verts[i].lightmap);
 
                // colors
-               dataOfs += R_VaoPackColors(data + dataOfs, 
verts[i].vertexColors);
+               memcpy(data + dataOfs, &verts[i].color, sizeof(verts[i].color));
+               dataOfs += sizeof(verts[i].color);
 
                // light directions
                memcpy(data + dataOfs, &verts[i].lightdir, 
sizeof(verts[i].lightdir));
@@ -464,7 +447,7 @@ void R_InitVaos(void)
        vertexesSize  = sizeof(tess.xyz[0]);
        vertexesSize += sizeof(tess.normal[0]);
        vertexesSize += sizeof(tess.tangent[0]);
-       vertexesSize += sizeof(tess.vertexColors[0]);
+       vertexesSize += sizeof(tess.color[0]);
        vertexesSize += sizeof(tess.texCoords[0][0]) * 2;
        vertexesSize += sizeof(tess.lightdir[0]);
        vertexesSize *= SHADER_MAX_VERTEXES;
@@ -496,7 +479,7 @@ void R_InitVaos(void)
        tess.vao->attribs[ATTR_INDEX_TANGENT       ].type = GL_SHORT;
        tess.vao->attribs[ATTR_INDEX_TEXCOORD      ].type = GL_FLOAT;
        tess.vao->attribs[ATTR_INDEX_LIGHTCOORD    ].type = GL_FLOAT;
-       tess.vao->attribs[ATTR_INDEX_COLOR         ].type = GL_FLOAT;
+       tess.vao->attribs[ATTR_INDEX_COLOR         ].type = GL_UNSIGNED_SHORT;
        tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].type = GL_SHORT;
 
        tess.vao->attribs[ATTR_INDEX_POSITION      ].normalized = GL_FALSE;
@@ -504,7 +487,7 @@ void R_InitVaos(void)
        tess.vao->attribs[ATTR_INDEX_TANGENT       ].normalized = GL_TRUE;
        tess.vao->attribs[ATTR_INDEX_TEXCOORD      ].normalized = GL_FALSE;
        tess.vao->attribs[ATTR_INDEX_LIGHTCOORD    ].normalized = GL_FALSE;
-       tess.vao->attribs[ATTR_INDEX_COLOR         ].normalized = GL_FALSE;
+       tess.vao->attribs[ATTR_INDEX_COLOR         ].normalized = GL_TRUE;
        tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].normalized = GL_TRUE;
 
        tess.vao->attribs[ATTR_INDEX_POSITION      ].offset = offset; offset += 
sizeof(tess.xyz[0])              * SHADER_MAX_VERTEXES;
@@ -515,13 +498,13 @@ void R_InitVaos(void)
        tess.vao->attribs[ATTR_INDEX_LIGHTCOORD    ].offset = offset + 
sizeof(tess.texCoords[0][0]);
                                                                      offset += 
sizeof(tess.texCoords[0][0]) * 2 * SHADER_MAX_VERTEXES;
 
-       tess.vao->attribs[ATTR_INDEX_COLOR         ].offset = offset; offset += 
sizeof(tess.vertexColors[0])     * SHADER_MAX_VERTEXES;
+       tess.vao->attribs[ATTR_INDEX_COLOR         ].offset = offset; offset += 
sizeof(tess.color[0])            * SHADER_MAX_VERTEXES;
        tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].offset = offset;
 
        tess.vao->attribs[ATTR_INDEX_POSITION      ].stride = 
sizeof(tess.xyz[0]);
        tess.vao->attribs[ATTR_INDEX_NORMAL        ].stride = 
sizeof(tess.normal[0]);
        tess.vao->attribs[ATTR_INDEX_TANGENT       ].stride = 
sizeof(tess.tangent[0]);
-       tess.vao->attribs[ATTR_INDEX_COLOR         ].stride = 
sizeof(tess.vertexColors[0]);
+       tess.vao->attribs[ATTR_INDEX_COLOR         ].stride = 
sizeof(tess.color[0]);
        tess.vao->attribs[ATTR_INDEX_TEXCOORD      ].stride = 
sizeof(tess.texCoords[0][0]) * 2;
        tess.vao->attribs[ATTR_INDEX_LIGHTCOORD    ].stride = 
sizeof(tess.texCoords[0][0]) * 2;
        tess.vao->attribs[ATTR_INDEX_LIGHTDIRECTION].stride = 
sizeof(tess.lightdir[0]);
@@ -530,7 +513,7 @@ void R_InitVaos(void)
        tess.attribPointers[ATTR_INDEX_TEXCOORD]       = tess.texCoords;
        tess.attribPointers[ATTR_INDEX_NORMAL]         = tess.normal;
        tess.attribPointers[ATTR_INDEX_TANGENT]        = tess.tangent;
-       tess.attribPointers[ATTR_INDEX_COLOR]          = tess.vertexColors;
+       tess.attribPointers[ATTR_INDEX_COLOR]          = tess.color;
        tess.attribPointers[ATTR_INDEX_LIGHTDIRECTION] = tess.lightdir;
 
        Vao_SetVertexPointers(tess.vao);
diff --git a/SP/code/renderer/tr_light.c b/SP/code/renderer/tr_light.c
index e366672..0c7ddc8 100644
--- a/SP/code/renderer/tr_light.c
+++ b/SP/code/renderer/tr_light.c
@@ -190,7 +190,9 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) 
{
                byte    *data;
                int lat, lng;
                vec3_t normal;
-
+               #if idppc
+               float d0, d1, d2, d3, d4, d5;
+               #endif
                factor = 1.0;
                data = gridData;
                for ( j = 0 ; j < 3 ; j++ ) {
@@ -212,7 +214,18 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent 
) {
                        continue;   // ignore samples in walls
                }
                totalFactor += factor;
-
+               #if idppc
+               d0 = data[0]; d1 = data[1]; d2 = data[2];
+               d3 = data[3]; d4 = data[4]; d5 = data[5];
+
+               ent->ambientLight[0] += factor * d0;
+               ent->ambientLight[1] += factor * d1;
+               ent->ambientLight[2] += factor * d2;
+
+               ent->directedLight[0] += factor * d3;
+               ent->directedLight[1] += factor * d4;
+               ent->directedLight[2] += factor * d5;
+               #else
                ent->ambientLight[0] += factor * data[0];
                ent->ambientLight[1] += factor * data[1];
                ent->ambientLight[2] += factor * data[2];
@@ -220,7 +233,7 @@ static void R_SetupEntityLightingGrid( trRefEntity_t *ent ) 
{
                ent->directedLight[0] += factor * data[3];
                ent->directedLight[1] += factor * data[4];
                ent->directedLight[2] += factor * data[5];
-
+               #endif
                lat = data[7];
                lng = data[6];
                lat *= ( FUNCTABLE_SIZE / 256 );

-- 
Alioth's /usr/local/bin/git-commit-notice on 
/srv/git.debian.org/git/pkg-games/iortcw.git

_______________________________________________
Pkg-games-commits mailing list
Pkg-games-commits@lists.alioth.debian.org
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits

Reply via email to