1
0
Fork 0

Resolved strict-aliasing warnings in OpenGL and Vulkan renderers

This commit is contained in:
ec- 2021-04-11 14:40:29 +03:00
parent 0923f61ee9
commit 2fe57ac408
23 changed files with 300 additions and 300 deletions

View File

@ -187,6 +187,12 @@ typedef union floatint_u
}
floatint_t;
typedef union {
byte rgba[4];
uint32_t u32;
} color4ub_t;
typedef int qhandle_t;
typedef int sfxHandle_t;
typedef int fileHandle_t;

View File

@ -446,11 +446,9 @@ typedef struct {
float st[2];
float lightmap[2];
vec3_t normal;
byte color[4];
color4ub_t color;
} drawVert_t;
#define drawVert_t_cleared(x) drawVert_t (x) = {{0, 0, 0}, {0, 0}, {0, 0}, {0, 0, 0}, {0, 0, 0, 0}}
typedef enum {
MST_BAD,
MST_PLANAR,

View File

@ -1037,10 +1037,10 @@ static const void *RB_SetColor( const void *data ) {
cmd = (const setColorCommand_t *)data;
backEnd.color2D[0] = cmd->color[0] * 255;
backEnd.color2D[1] = cmd->color[1] * 255;
backEnd.color2D[2] = cmd->color[2] * 255;
backEnd.color2D[3] = cmd->color[3] * 255;
backEnd.color2D.rgba[0] = cmd->color[0] * 255;
backEnd.color2D.rgba[1] = cmd->color[1] * 255;
backEnd.color2D.rgba[2] = cmd->color[2] * 255;
backEnd.color2D.rgba[3] = cmd->color[3] * 255;
return (const void *)(cmd + 1);
}
@ -1090,10 +1090,10 @@ static const void *RB_StretchPic( 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;
tess.vertexColors[ numVerts ].u32 =
tess.vertexColors[ numVerts + 1 ].u32 =
tess.vertexColors[ numVerts + 2 ].u32 =
tess.vertexColors[ numVerts + 3 ].u32 = backEnd.color2D.u32;
tess.xyz[ numVerts ][0] = cmd->x;
tess.xyz[ numVerts ][1] = cmd->y;

View File

@ -622,7 +622,7 @@ static void ParseFace( const dsurface_t *ds, const drawVert_t *verts, msurface_t
cv->points[i][3+j] = LittleFloat( verts[i].st[j] );
cv->points[i][5+j] = LittleFloat( verts[i].lightmap[j] );
}
R_ColorShiftLightingBytes( verts[i].color, (byte *)&cv->points[i][7] );
R_ColorShiftLightingBytes( verts[i].color.rgba, (byte *)&cv->points[i][7] );
if ( lightmapNum >= 0 && r_mergeLightmaps->integer ) {
// adjust lightmap coords
cv->points[i][5] = cv->points[i][5] * tr.lightmapScale[0] + lightmapX;
@ -721,7 +721,7 @@ static void ParseMesh( const dsurface_t *ds, const drawVert_t *verts, msurface_t
points[i].st[j] = LittleFloat( verts[i].st[j] );
points[i].lightmap[j] = LittleFloat( verts[i].lightmap[j] );
}
R_ColorShiftLightingBytes( verts[i].color, points[i].color );
R_ColorShiftLightingBytes( verts[i].color.rgba, points[i].color.rgba );
if ( lightmapNum >= 0 && r_mergeLightmaps->integer ) {
// adjust lightmap coords
points[i].lightmap[0] = points[i].lightmap[0] * tr.lightmapScale[0] + lightmapX;
@ -805,7 +805,7 @@ static void ParseTriSurf( const dsurface_t *ds, const drawVert_t *verts, msurfac
tri->verts[i].lightmap[j] = LittleFloat( verts[i].lightmap[j] );
}
R_ColorShiftLightingBytes( verts[i].color, tri->verts[i].color );
R_ColorShiftLightingBytes( verts[i].color.rgba, tri->verts[i].color.rgba );
if ( lightmapNum >= 0 && r_mergeLightmaps->integer ) {
// adjust lightmap coords
tri->verts[i].lightmap[0] = tri->verts[i].lightmap[0] * tr.lightmapScale[0] + lightmapX;
@ -1983,11 +1983,13 @@ static void R_LoadFogs( const lump_t *l, const lump_t *brushesLump, const lump_t
out->parms = shader->fogParms;
out->colorInt = ColorBytes4( fogColor[0] * tr.identityLight,
fogColor[1] * tr.identityLight, fogColor[2] * tr.identityLight, 1.0 );
out->colorInt.rgba[0] = ( fogColor[0] * tr.identityLight ) * 255.0f;
out->colorInt.rgba[1] = ( fogColor[1] * tr.identityLight ) * 255.0f;
out->colorInt.rgba[2] = ( fogColor[2] * tr.identityLight ) * 255.0f;
out->colorInt.rgba[3] = 255;
for ( n = 0; n < 4; n++ )
out->color[ n ] = ( ( out->colorInt >> (n*8) ) & 255 ) / 255.0f;
out->color[ n ] = (float) out->colorInt.rgba[i] / 255.0f;
d = shader->fogParms.depthForOpaque < 1 ? 1 : shader->fogParms.depthForOpaque;
out->tcScale = 1.0f / ( d * 8 );

View File

@ -54,10 +54,10 @@ static void LerpDrawVert( drawVert_t *a, drawVert_t *b, drawVert_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->color[0] = (a->color[0] + b->color[0]) >> 1;
out->color[1] = (a->color[1] + b->color[1]) >> 1;
out->color[2] = (a->color[2] + b->color[2]) >> 1;
out->color[3] = (a->color[3] + b->color[3]) >> 1;
out->color.rgba[0] = (a->color.rgba[0] + b->color.rgba[0]) >> 1;
out->color.rgba[1] = (a->color.rgba[1] + b->color.rgba[1]) >> 1;
out->color.rgba[2] = (a->color.rgba[2] + b->color.rgba[2]) >> 1;
out->color.rgba[3] = (a->color.rgba[3] + b->color.rgba[3]) >> 1;
}
/*
@ -354,15 +354,19 @@ R_SubdividePatchToGrid
srfGridMesh_t *R_SubdividePatchToGrid( int width, int height,
drawVert_t points[MAX_PATCH_SIZE*MAX_PATCH_SIZE] ) {
int i, j, k, l;
drawVert_t_cleared( prev );
drawVert_t_cleared( next );
drawVert_t_cleared( mid );
drawVert_t prev;
drawVert_t next;
drawVert_t mid;
float len, maxLen;
int n;
int t;
drawVert_t ctrl[MAX_GRID_SIZE][MAX_GRID_SIZE];
float errorTable[2][MAX_GRID_SIZE];
memset( &prev, 0, sizeof( prev ) );
memset( &next, 0, sizeof( next ) );
memset( &mid, 0, sizeof( mid ) );
for ( i = 0 ; i < width ; i++ ) {
for ( j = 0 ; j < height ; j++ ) {
ctrl[j][i] = points[j*width+i];

View File

@ -376,40 +376,40 @@ void RB_RenderFlare( flare_t *f ) {
tess.xyz[tess.numVertexes][1] = f->windowY - size;
tess.texCoords[0][tess.numVertexes][0] = 0;
tess.texCoords[0][tess.numVertexes][1] = 0;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.vertexColors[tess.numVertexes].rgba[0] = iColor[0];
tess.vertexColors[tess.numVertexes].rgba[1] = iColor[1];
tess.vertexColors[tess.numVertexes].rgba[2] = iColor[2];
tess.vertexColors[tess.numVertexes].rgba[3] = 255;
tess.numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX - size;
tess.xyz[tess.numVertexes][1] = f->windowY + size;
tess.texCoords[0][tess.numVertexes][0] = 0;
tess.texCoords[0][tess.numVertexes][1] = 1;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.vertexColors[tess.numVertexes].rgba[0] = iColor[0];
tess.vertexColors[tess.numVertexes].rgba[1] = iColor[1];
tess.vertexColors[tess.numVertexes].rgba[2] = iColor[2];
tess.vertexColors[tess.numVertexes].rgba[3] = 255;
tess.numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX + size;
tess.xyz[tess.numVertexes][1] = f->windowY + size;
tess.texCoords[0][tess.numVertexes][0] = 1;
tess.texCoords[0][tess.numVertexes][1] = 1;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.vertexColors[tess.numVertexes].rgba[0] = iColor[0];
tess.vertexColors[tess.numVertexes].rgba[1] = iColor[1];
tess.vertexColors[tess.numVertexes].rgba[2] = iColor[2];
tess.vertexColors[tess.numVertexes].rgba[3] = 255;
tess.numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX + size;
tess.xyz[tess.numVertexes][1] = f->windowY - size;
tess.texCoords[0][tess.numVertexes][0] = 1;
tess.texCoords[0][tess.numVertexes][1] = 0;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.vertexColors[tess.numVertexes].rgba[0] = iColor[0];
tess.vertexColors[tess.numVertexes].rgba[1] = iColor[1];
tess.vertexColors[tess.numVertexes].rgba[2] = iColor[2];
tess.vertexColors[tess.numVertexes].rgba[3] = 255;
tess.numVertexes++;
tess.indexes[tess.numIndexes++] = 0;

View File

@ -315,7 +315,7 @@ typedef struct {
waveForm_t alphaWave;
alphaGen_t alphaGen;
byte constantColor[4]; // for CGEN_CONST and AGEN_CONST
color4ub_t constantColor; // for CGEN_CONST and AGEN_CONST
unsigned stateBits; // GLS_xxxx mask
GLint mtEnv; // 0, GL_MODULATE, GL_ADD, GL_DECAL
@ -518,7 +518,7 @@ typedef struct {
int originalBrushNumber;
vec3_t bounds[2];
unsigned colorInt; // in packed byte format
color4ub_t colorInt; // in packed byte format
vec4_t color;
float tcScale; // texture coordinate vector scales
fogParms_t parms;
@ -1036,7 +1036,7 @@ typedef struct {
qboolean skyRenderedThisView; // flag for drawing sun
qboolean projection2D; // if qtrue, drawstretchpic doesn't need to change modes
byte color2D[4];
color4ub_t color2D;
qboolean doneBloom; // done bloom this frame
qboolean doneSurfaces; // done any 3d surfaces already
trRefEntity_t entity2D; // currentEntity will point at this when doing 2D rendering
@ -1446,7 +1446,6 @@ TESSELATOR/SHADER DECLARATIONS
====================================================================
*/
typedef byte color4ub_t[4];
typedef struct stageVars
{

View File

@ -274,7 +274,7 @@ static void DrawMultitextured( const shaderCommands_t *input, int stage ) {
GL_ClientState( 0, CLS_TEXCOORD_ARRAY | CLS_COLOR_ARRAY );
qglTexCoordPointer( 2, GL_FLOAT, 0, input->svars.texcoordPtr[0] );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, input->svars.colors );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, input->svars.colors[0].rgba );
GL_ClientState( 1, CLS_TEXCOORD_ARRAY );
qglTexCoordPointer( 2, GL_FLOAT, 0, input->svars.texcoordPtr[1] );
@ -478,7 +478,7 @@ static void RB_FogPass( void ) {
fog = tr.world->fogs + tess.fogNum;
for ( i = 0; i < tess.numVertexes; i++ ) {
* ( int * )&tess.svars.colors[i] = fog->colorInt;
tess.svars.colors[i].u32 = fog->colorInt.u32;
}
RB_CalcFogTexCoords( ( float * ) tess.svars.texcoords[0] );
@ -486,7 +486,7 @@ static void RB_FogPass( void ) {
GL_ClientState( 1, CLS_NONE );
GL_ClientState( 0, CLS_TEXCOORD_ARRAY | CLS_COLOR_ARRAY );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors[0].rgba );
qglTexCoordPointer( 2, GL_FLOAT, 0, tess.svars.texcoords[0] );
GL_SelectTexture( 0 );
@ -534,7 +534,7 @@ void R_ComputeColors( const shaderStage_t *pStage )
break;
case CGEN_CONST:
for ( i = 0; i < tess.numVertexes; i++ ) {
*(int *)tess.svars.colors[i] = *(int *)pStage->constantColor;
tess.svars.colors[i].u32 = pStage->constantColor.u32;
}
break;
case CGEN_VERTEX:
@ -546,10 +546,10 @@ void R_ComputeColors( const shaderStage_t *pStage )
{
for ( i = 0; i < tess.numVertexes; i++ )
{
tess.svars.colors[i][0] = tess.vertexColors[i][0] * tr.identityLight;
tess.svars.colors[i][1] = tess.vertexColors[i][1] * tr.identityLight;
tess.svars.colors[i][2] = tess.vertexColors[i][2] * tr.identityLight;
tess.svars.colors[i][3] = tess.vertexColors[i][3];
tess.svars.colors[i].rgba[0] = tess.vertexColors[i].rgba[0] * tr.identityLight;
tess.svars.colors[i].rgba[1] = tess.vertexColors[i].rgba[1] * tr.identityLight;
tess.svars.colors[i].rgba[2] = tess.vertexColors[i].rgba[2] * tr.identityLight;
tess.svars.colors[i].rgba[3] = tess.vertexColors[i].rgba[3];
}
}
break;
@ -558,18 +558,18 @@ void R_ComputeColors( const shaderStage_t *pStage )
{
for ( i = 0; i < tess.numVertexes; i++ )
{
tess.svars.colors[i][0] = 255 - tess.vertexColors[i][0];
tess.svars.colors[i][1] = 255 - tess.vertexColors[i][1];
tess.svars.colors[i][2] = 255 - tess.vertexColors[i][2];
tess.svars.colors[i].rgba[0] = 255 - tess.vertexColors[i].rgba[0];
tess.svars.colors[i].rgba[1] = 255 - tess.vertexColors[i].rgba[1];
tess.svars.colors[i].rgba[2] = 255 - tess.vertexColors[i].rgba[2];
}
}
else
{
for ( i = 0; i < tess.numVertexes; i++ )
{
tess.svars.colors[i][0] = ( 255 - tess.vertexColors[i][0] ) * tr.identityLight;
tess.svars.colors[i][1] = ( 255 - tess.vertexColors[i][1] ) * tr.identityLight;
tess.svars.colors[i][2] = ( 255 - tess.vertexColors[i][2] ) * tr.identityLight;
tess.svars.colors[i].rgba[0] = ( 255 - tess.vertexColors[i].rgba[0] ) * tr.identityLight;
tess.svars.colors[i].rgba[1] = ( 255 - tess.vertexColors[i].rgba[1] ) * tr.identityLight;
tess.svars.colors[i].rgba[2] = ( 255 - tess.vertexColors[i].rgba[2] ) * tr.identityLight;
}
}
break;
@ -580,18 +580,18 @@ void R_ComputeColors( const shaderStage_t *pStage )
fog = tr.world->fogs + tess.fogNum;
for ( i = 0; i < tess.numVertexes; i++ ) {
* ( int * )&tess.svars.colors[i] = fog->colorInt;
tess.svars.colors[i].u32 = fog->colorInt.u32;
}
}
break;
case CGEN_WAVEFORM:
RB_CalcWaveColor( &pStage->rgbWave, ( unsigned char * ) tess.svars.colors );
RB_CalcWaveColor( &pStage->rgbWave, tess.svars.colors[0].rgba );
break;
case CGEN_ENTITY:
RB_CalcColorFromEntity( ( unsigned char * ) tess.svars.colors );
RB_CalcColorFromEntity( tess.svars.colors[0].rgba );
break;
case CGEN_ONE_MINUS_ENTITY:
RB_CalcColorFromOneMinusEntity( ( unsigned char * ) tess.svars.colors );
RB_CalcColorFromOneMinusEntity( tess.svars.colors[0].rgba );
break;
}
@ -606,36 +606,36 @@ void R_ComputeColors( const shaderStage_t *pStage )
if ( ( pStage->rgbGen == CGEN_VERTEX && tr.identityLight != 1 ) ||
pStage->rgbGen != CGEN_VERTEX ) {
for ( i = 0; i < tess.numVertexes; i++ ) {
tess.svars.colors[i][3] = 0xff;
tess.svars.colors[i].rgba[3] = 255;
}
}
break;
case AGEN_CONST:
for ( i = 0; i < tess.numVertexes; i++ ) {
tess.svars.colors[i][3] = pStage->constantColor[3];
tess.svars.colors[i].rgba[3] = pStage->constantColor.rgba[3];
}
break;
case AGEN_WAVEFORM:
RB_CalcWaveAlpha( &pStage->alphaWave, ( unsigned char * ) tess.svars.colors );
RB_CalcWaveAlpha( &pStage->alphaWave, tess.svars.colors[0].rgba );
break;
case AGEN_LIGHTING_SPECULAR:
RB_CalcSpecularAlpha( ( unsigned char * ) tess.svars.colors );
RB_CalcSpecularAlpha( tess.svars.colors[0].rgba );
break;
case AGEN_ENTITY:
RB_CalcAlphaFromEntity( ( unsigned char * ) tess.svars.colors );
RB_CalcAlphaFromEntity( tess.svars.colors[0].rgba );
break;
case AGEN_ONE_MINUS_ENTITY:
RB_CalcAlphaFromOneMinusEntity( ( unsigned char * ) tess.svars.colors );
RB_CalcAlphaFromOneMinusEntity( tess.svars.colors[0].rgba );
break;
case AGEN_VERTEX:
for ( i = 0; i < tess.numVertexes; i++ ) {
tess.svars.colors[i][3] = tess.vertexColors[i][3];
tess.svars.colors[i].rgba[3] = tess.vertexColors[i].rgba[3];
}
break;
case AGEN_ONE_MINUS_VERTEX:
for ( i = 0; i < tess.numVertexes; i++ )
{
tess.svars.colors[i][3] = 255 - tess.vertexColors[i][3];
tess.svars.colors[i].rgba[3] = 255 - tess.vertexColors[i].rgba[3];
}
break;
case AGEN_PORTAL:
@ -665,7 +665,7 @@ void R_ComputeColors( const shaderStage_t *pStage )
alpha = len * 0xff;
}
tess.svars.colors[i][3] = alpha;
tess.svars.colors[i].rgba[3] = alpha;
}
}
break;
@ -679,13 +679,13 @@ void R_ComputeColors( const shaderStage_t *pStage )
switch ( pStage->adjustColorsForFog )
{
case ACFF_MODULATE_RGB:
RB_CalcModulateColorsByFog( ( unsigned char * ) tess.svars.colors );
RB_CalcModulateColorsByFog( tess.svars.colors[0].rgba );
break;
case ACFF_MODULATE_ALPHA:
RB_CalcModulateAlphasByFog( ( unsigned char * ) tess.svars.colors );
RB_CalcModulateAlphasByFog( tess.svars.colors[0].rgba );
break;
case ACFF_MODULATE_RGBA:
RB_CalcModulateRGBAsByFog( ( unsigned char * ) tess.svars.colors );
RB_CalcModulateRGBAsByFog( tess.svars.colors[0].rgba );
break;
case ACFF_NONE:
break;
@ -838,7 +838,7 @@ static void RB_IterateStagesGeneric( const shaderCommands_t *input )
GL_ClientState( 0, CLS_TEXCOORD_ARRAY | CLS_COLOR_ARRAY );
qglTexCoordPointer( 2, GL_FLOAT, 0, input->svars.texcoordPtr[0] );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, input->svars.colors );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, input->svars.colors[0].rgba );
}
//
@ -934,7 +934,7 @@ void RB_StageIteratorGeneric( void )
if ( tess.xstages[0] )
{
R_ComputeColors( tess.xstages[0] );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors[0].rgba );
R_ComputeTexCoords( 0, &tess.xstages[0]->bundle[0] );
qglTexCoordPointer( 2, GL_FLOAT, 0, tess.svars.texcoordPtr[0] );
if ( shader->multitextureEnv )

View File

@ -410,7 +410,7 @@ static void AutospriteDeform( void ) {
VectorScale(up, axisLength, up);
}
RB_AddQuadStamp( mid, left, up, tess.vertexColors[i] );
RB_AddQuadStamp( mid, left, up, tess.vertexColors[i].rgba );
}
}
@ -599,14 +599,13 @@ COLORS
*/
void RB_CalcColorFromEntity( unsigned char *dstColors )
{
uint32_t c, *pColors = (uint32_t *)dstColors;
int i;
int *pColors = ( int * ) dstColors;
int c;
if ( !backEnd.currentEntity )
return;
c = * ( int * ) backEnd.currentEntity->e.shaderRGBA;
c = backEnd.currentEntity->e.shader.u32;
for ( i = 0; i < tess.numVertexes; i++, pColors++ )
{
@ -621,23 +620,20 @@ void RB_CalcColorFromEntity( unsigned char *dstColors )
void RB_CalcColorFromOneMinusEntity( unsigned char *dstColors )
{
int i;
int *pColors = ( int * ) dstColors;
unsigned char invModulate[4];
int c;
uint32_t *pColors = ( uint32_t * ) dstColors;
color4ub_t invModulate;
if ( !backEnd.currentEntity )
return;
invModulate[0] = 255 - backEnd.currentEntity->e.shaderRGBA[0];
invModulate[1] = 255 - backEnd.currentEntity->e.shaderRGBA[1];
invModulate[2] = 255 - backEnd.currentEntity->e.shaderRGBA[2];
invModulate[3] = 255 - backEnd.currentEntity->e.shaderRGBA[3]; // this trashes alpha, but the AGEN block fixes it
c = * ( int * ) invModulate;
invModulate.rgba[0] = 255 - backEnd.currentEntity->e.shader.rgba[0];
invModulate.rgba[1] = 255 - backEnd.currentEntity->e.shader.rgba[1];
invModulate.rgba[2] = 255 - backEnd.currentEntity->e.shader.rgba[2];
invModulate.rgba[3] = 255 - backEnd.currentEntity->e.shader.rgba[3]; // this trashes alpha, but the AGEN block fixes it
for ( i = 0; i < tess.numVertexes; i++, pColors++ )
{
*pColors = c;
*pColors = invModulate.u32;
}
}
@ -656,7 +652,7 @@ void RB_CalcAlphaFromEntity( unsigned char *dstColors )
for ( i = 0; i < tess.numVertexes; i++, dstColors += 4 )
{
*dstColors = backEnd.currentEntity->e.shaderRGBA[3];
*dstColors = backEnd.currentEntity->e.shader.rgba[3];
}
}
@ -675,7 +671,7 @@ void RB_CalcAlphaFromOneMinusEntity( unsigned char *dstColors )
for ( i = 0; i < tess.numVertexes; i++, dstColors += 4 )
{
*dstColors = 0xff - backEnd.currentEntity->e.shaderRGBA[3];
*dstColors = 0xff - backEnd.currentEntity->e.shader.rgba[3];
}
}
@ -685,12 +681,10 @@ void RB_CalcAlphaFromOneMinusEntity( unsigned char *dstColors )
*/
void RB_CalcWaveColor( const waveForm_t *wf, unsigned char *dstColors )
{
int i;
int v;
int v, i;
float glow;
int *colors = ( int * ) dstColors;
byte color[4];
uint32_t *colors = ( uint32_t * ) dstColors;
color4ub_t color;
if ( wf->func == GF_NOISE ) {
glow = wf->base + R_NoiseGet4f( 0, 0, 0, ( tess.shaderTime + wf->phase ) * wf->frequency ) * wf->amplitude;
@ -705,12 +699,11 @@ void RB_CalcWaveColor( const waveForm_t *wf, unsigned char *dstColors )
else if ( v > 255 )
v = 255;
color[0] = color[1] = color[2] = v;
color[3] = 255;
v = *(int *)color;
color.rgba[0] = color.rgba[1] = color.rgba[2] = v;
color.rgba[3] = 255;
for ( i = 0; i < tess.numVertexes; i++, colors++ ) {
*colors = v;
*colors = color.u32;
}
}

View File

@ -874,9 +874,9 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text )
VectorClear( color );
ParseVector( text, 3, color );
stage->constantColor[0] = 255 * color[0];
stage->constantColor[1] = 255 * color[1];
stage->constantColor[2] = 255 * color[2];
stage->constantColor.rgba[0] = 255 * color[0];
stage->constantColor.rgba[1] = 255 * color[1];
stage->constantColor.rgba[2] = 255 * color[2];
stage->rgbGen = CGEN_CONST;
}
@ -941,7 +941,7 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text )
else if ( !Q_stricmp( token, "const" ) )
{
token = COM_ParseExt( text, qfalse );
stage->constantColor[3] = 255 * Q_atof( token );
stage->constantColor.rgba[3] = 255 * Q_atof( token );
stage->alphaGen = AGEN_CONST;
}
else if ( !Q_stricmp( token, "identity" ) )

View File

@ -184,7 +184,7 @@ static void RB_SurfaceSprite( void ) {
VectorSubtract( vec3_origin, left, left );
}
RB_AddQuadStamp( backEnd.currentEntity->e.origin, left, up, backEnd.currentEntity->e.shaderRGBA );
RB_AddQuadStamp( backEnd.currentEntity->e.origin, left, up, backEnd.currentEntity->e.shader.rgba );
}
@ -209,7 +209,7 @@ static void RB_SurfacePolychain( srfPoly_t *p ) {
VectorCopy( p->verts[i].xyz, tess.xyz[numv] );
tess.texCoords[0][numv][0] = p->verts[i].st[0];
tess.texCoords[0][numv][1] = p->verts[i].st[1];
*(int *)&tess.vertexColors[numv] = *(int *)p->verts[ i ].modulate;
tess.vertexColors[numv].u32 = p->verts[ i ].modulate.u32;
numv++;
}
@ -237,7 +237,7 @@ static void RB_SurfaceTriangles( srfTriangles_t *srf ) {
float *xyz, *normal;
float *texCoords0;
float *texCoords1;
byte *color;
uint32_t *color;
#ifdef USE_LEGACY_DLIGHTS
int dlightBits;
#endif
@ -285,9 +285,9 @@ static void RB_SurfaceTriangles( srfTriangles_t *srf ) {
normal = tess.normal[ tess.numVertexes ];
texCoords0 = tess.texCoords[0][ tess.numVertexes ];
texCoords1 = tess.texCoords[1][ tess.numVertexes ];
color = tess.vertexColors[ tess.numVertexes ];
color = &tess.vertexColors[ tess.numVertexes ].u32;
for ( i = 0; i < srf->numVerts; i++, dv++, xyz += 4, normal += 4, texCoords0 += 2, color += 4 ) {
for ( i = 0; i < srf->numVerts; i++, dv++, xyz += 4, normal += 4, texCoords0 += 2, color++ ) {
xyz[0] = dv->xyz[0];
xyz[1] = dv->xyz[1];
xyz[2] = dv->xyz[2];
@ -313,7 +313,7 @@ static void RB_SurfaceTriangles( srfTriangles_t *srf ) {
texCoords1 += 2;
}
*(int *)color = *(int *)dv->color;
*color = dv->color.u32;
}
#ifdef USE_LEGACY_DLIGHTS
for ( i = 0 ; i < srf->numVerts ; i++ ) {
@ -398,34 +398,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[0][tess.numVertexes][0] = 0;
tess.texCoords[0][tess.numVertexes][1] = 0;
tess.vertexColors[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0] * 0.25;
tess.vertexColors[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1] * 0.25;
tess.vertexColors[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2] * 0.25;
tess.vertexColors[tess.numVertexes].rgba[0] = backEnd.currentEntity->e.shader.rgba[0] * 0.25;
tess.vertexColors[tess.numVertexes].rgba[1] = backEnd.currentEntity->e.shader.rgba[1] * 0.25;
tess.vertexColors[tess.numVertexes].rgba[2] = backEnd.currentEntity->e.shader.rgba[2] * 0.25;
tess.numVertexes++;
VectorMA( start, spanWidth2, up, tess.xyz[tess.numVertexes] );
tess.texCoords[0][tess.numVertexes][0] = 0;
tess.texCoords[0][tess.numVertexes][1] = 1;
tess.vertexColors[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0];
tess.vertexColors[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1];
tess.vertexColors[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2];
tess.vertexColors[tess.numVertexes].rgba[0] = backEnd.currentEntity->e.shader.rgba[0];
tess.vertexColors[tess.numVertexes].rgba[1] = backEnd.currentEntity->e.shader.rgba[1];
tess.vertexColors[tess.numVertexes].rgba[2] = backEnd.currentEntity->e.shader.rgba[2];
tess.numVertexes++;
VectorMA( end, spanWidth, up, tess.xyz[tess.numVertexes] );
tess.texCoords[0][tess.numVertexes][0] = t;
tess.texCoords[0][tess.numVertexes][1] = 0;
tess.vertexColors[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0];
tess.vertexColors[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1];
tess.vertexColors[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2];
tess.vertexColors[tess.numVertexes].rgba[0] = backEnd.currentEntity->e.shader.rgba[0];
tess.vertexColors[tess.numVertexes].rgba[1] = backEnd.currentEntity->e.shader.rgba[1];
tess.vertexColors[tess.numVertexes].rgba[2] = backEnd.currentEntity->e.shader.rgba[2];
tess.numVertexes++;
VectorMA( end, spanWidth2, up, tess.xyz[tess.numVertexes] );
tess.texCoords[0][tess.numVertexes][0] = t;
tess.texCoords[0][tess.numVertexes][1] = 1;
tess.vertexColors[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0];
tess.vertexColors[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1];
tess.vertexColors[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2];
tess.vertexColors[tess.numVertexes].rgba[0] = backEnd.currentEntity->e.shader.rgba[0];
tess.vertexColors[tess.numVertexes].rgba[1] = backEnd.currentEntity->e.shader.rgba[1];
tess.vertexColors[tess.numVertexes].rgba[2] = backEnd.currentEntity->e.shader.rgba[2];
tess.numVertexes++;
tess.indexes[tess.numIndexes++] = vbase;
@ -481,9 +481,9 @@ static void DoRailDiscs( int numSegs, const vec3_t start, const vec3_t dir, cons
VectorCopy( pos[j], tess.xyz[tess.numVertexes] );
tess.texCoords[0][tess.numVertexes][0] = ( j < 2 );
tess.texCoords[0][tess.numVertexes][1] = ( j && j != 3 );
tess.vertexColors[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0];
tess.vertexColors[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1];
tess.vertexColors[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2];
tess.vertexColors[tess.numVertexes].rgba[0] = backEnd.currentEntity->e.shader.rgba[0];
tess.vertexColors[tess.numVertexes].rgba[1] = backEnd.currentEntity->e.shader.rgba[1];
tess.vertexColors[tess.numVertexes].rgba[2] = backEnd.currentEntity->e.shader.rgba[2];
tess.numVertexes++;
VectorAdd( pos[j], dir, pos[j] );
@ -982,8 +982,8 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
float *texCoords0;
float *texCoords1;
float *normal;
unsigned char *color;
drawVert_t *dv;
uint32_t *color;
drawVert_t *dv;
int rows, irows, vrows;
int used;
int widthTable[MAX_GRID_SIZE];
@ -1103,7 +1103,7 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
normal = tess.normal[numVertexes];
texCoords0 = tess.texCoords[0][numVertexes];
texCoords1 = tess.texCoords[1][numVertexes];
color = ( unsigned char * ) &tess.vertexColors[numVertexes];
color = &tess.vertexColors[numVertexes].u32;
#ifdef USE_LEGACY_DLIGHTS
vDlightBits = &tess.vertexDlightBits[numVertexes];
#endif
@ -1134,13 +1134,13 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
normal[2] = dv->normal[2];
normal += 4;
}
* ( unsigned int * ) color = * ( unsigned int * ) dv->color;
*color = dv->color.u32;
#ifdef USE_LEGACY_DLIGHTS
*vDlightBits++ = dlightBits;
#endif
xyz += 4;
texCoords0 += 2;
color += 4;
color++;
}
}
@ -1217,18 +1217,18 @@ static void RB_SurfaceAxis( void ) {
Com_Memset( colors, 0, sizeof( colors ) );
for ( i = 0; i < 6; i++ ) {
colors[i][3] = 255;
colors[i].rgba[3] = 255;
}
colors[0][0] = 255;
colors[1][0] = 255;
colors[2][1] = 255;
colors[3][1] = 255;
colors[4][2] = 255;
colors[5][2] = 255;
colors[0].rgba[0] = 255;
colors[1].rgba[0] = 255;
colors[2].rgba[1] = 255;
colors[3].rgba[1] = 255;
colors[4].rgba[2] = 255;
colors[5].rgba[2] = 255;
qglVertexPointer( 3, GL_FLOAT, 0, xyz );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colors );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colors[0].rgba );
qglDrawArrays( GL_LINES, 0, 6 );

View File

@ -56,7 +56,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
typedef struct {
vec3_t xyz;
float st[2];
byte modulate[4];
color4ub_t modulate;
} polyVert_t;
typedef struct poly_s {
@ -104,7 +104,7 @@ typedef struct {
qhandle_t customShader; // use one image for the entire thing
// misc
byte shaderRGBA[4]; // colors used by rgbgen entity shaders
color4ub_t shader;
float shaderTexCoord[2]; // texture coordinates used by tcMod entity modifiers
// subtracted from refdef time to control effect start times

View File

@ -1152,10 +1152,10 @@ static const void *RB_SetColor( const void *data ) {
cmd = (const setColorCommand_t *)data;
backEnd.color2D[0] = cmd->color[0] * 255;
backEnd.color2D[1] = cmd->color[1] * 255;
backEnd.color2D[2] = cmd->color[2] * 255;
backEnd.color2D[3] = cmd->color[3] * 255;
backEnd.color2D.rgba[0] = cmd->color[0] * 255;
backEnd.color2D.rgba[1] = cmd->color[1] * 255;
backEnd.color2D.rgba[2] = cmd->color[2] * 255;
backEnd.color2D.rgba[3] = cmd->color[3] * 255;
return (const void *)(cmd + 1);
}
@ -1210,10 +1210,10 @@ static const void *RB_StretchPic( 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;
tess.vertexColors[ numVerts ].u32 =
tess.vertexColors[ numVerts + 1 ].u32 =
tess.vertexColors[ numVerts + 2 ].u32 =
tess.vertexColors[ numVerts + 3 ].u32 = backEnd.color2D.u32;
tess.xyz[ numVerts ][0] = cmd->x;
tess.xyz[ numVerts ][1] = cmd->y;
@ -1325,10 +1325,10 @@ static void RB_DebugPolygon( int color, int numPoints, float *points ) {
for (i = 0; i < numPoints; i++) {
VectorCopy(&points[3*i], tess.xyz[i]);
tess.svars.colors[0][i][0] = (color&1) ? 255 : 0;
tess.svars.colors[0][i][1] = (color&2) ? 255 : 0;
tess.svars.colors[0][i][2] = (color&4) ? 255 : 0;
tess.svars.colors[0][i][3] = 255;
tess.svars.colors[0][i].rgba[0] = (color&1) ? 255 : 0;
tess.svars.colors[0][i].rgba[1] = (color&2) ? 255 : 0;
tess.svars.colors[0][i].rgba[2] = (color&4) ? 255 : 0;
tess.svars.colors[0][i].rgba[3] = 255;
}
tess.numVertexes = numPoints;
@ -1544,7 +1544,7 @@ void RB_ShowImages( void )
GL_Bind( image );
Com_Memset( tess.svars.colors[0], 255, 4 * sizeof( color4ub_t ) );
Com_Memset( tess.svars.colors[0][0].rgba, 255, 4 * sizeof( color4ub_t ) );
tess.numVertexes = 4;

View File

@ -661,7 +661,7 @@ static void ParseFace( const dsurface_t *ds, const drawVert_t *verts, msurface_t
cv->points[i][3+j] = LittleFloat( verts[i].st[j] );
cv->points[i][5+j] = LittleFloat( verts[i].lightmap[j] );
}
R_ColorShiftLightingBytes( verts[i].color, (byte *)&cv->points[i][7] );
R_ColorShiftLightingBytes( verts[i].color.rgba, (byte *)&cv->points[i][7] );
if ( lightmapNum >= 0 && r_mergeLightmaps->integer ) {
// adjust lightmap coords
cv->points[i][5] = cv->points[i][5] * tr.lightmapScale[0] + lightmapX;
@ -772,7 +772,7 @@ static void ParseMesh( const dsurface_t *ds, const drawVert_t *verts, msurface_t
points[i].st[j] = LittleFloat( verts[i].st[j] );
points[i].lightmap[j] = LittleFloat( verts[i].lightmap[j] );
}
R_ColorShiftLightingBytes( verts[i].color, points[i].color );
R_ColorShiftLightingBytes( verts[i].color.rgba, points[i].color.rgba );
if ( lightmapNum >= 0 && r_mergeLightmaps->integer ) {
// adjust lightmap coords
points[i].lightmap[0] = points[i].lightmap[0] * tr.lightmapScale[0] + lightmapX;
@ -856,7 +856,7 @@ static void ParseTriSurf( const dsurface_t *ds, const drawVert_t *verts, msurfac
tri->verts[i].lightmap[j] = LittleFloat( verts[i].lightmap[j] );
}
R_ColorShiftLightingBytes( verts[i].color, tri->verts[i].color );
R_ColorShiftLightingBytes( verts[i].color.rgba, tri->verts[i].color.rgba );
if ( lightmapNum >= 0 && r_mergeLightmaps->integer ) {
// adjust lightmap coords
tri->verts[i].lightmap[0] = tri->verts[i].lightmap[0] * tr.lightmapScale[0] + lightmapX;
@ -2034,11 +2034,13 @@ static void R_LoadFogs( const lump_t *l, const lump_t *brushesLump, const lump_t
out->parms = shader->fogParms;
out->colorInt = ColorBytes4( fogColor[0] * tr.identityLight,
fogColor[1] * tr.identityLight, fogColor[2] * tr.identityLight, 1.0 );
out->colorInt.rgba[0] = ( fogColor[0] * tr.identityLight ) * 255.0f;
out->colorInt.rgba[1] = ( fogColor[1] * tr.identityLight ) * 255.0f;
out->colorInt.rgba[2] = ( fogColor[2] * tr.identityLight ) * 255.0f;
out->colorInt.rgba[3] = 255;
for ( n = 0; n < 4; n++ )
out->color[ n ] = ( ( out->colorInt >> (n*8) ) & 255 ) / 255.0f;
out->color[ n ] = (float) out->colorInt.rgba[i] / 255.0f;
d = shader->fogParms.depthForOpaque < 1 ? 1 : shader->fogParms.depthForOpaque;
out->tcScale = 1.0f / ( d * 8 );

View File

@ -54,10 +54,10 @@ static void LerpDrawVert( drawVert_t *a, drawVert_t *b, drawVert_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->color[0] = (a->color[0] + b->color[0]) >> 1;
out->color[1] = (a->color[1] + b->color[1]) >> 1;
out->color[2] = (a->color[2] + b->color[2]) >> 1;
out->color[3] = (a->color[3] + b->color[3]) >> 1;
out->color.rgba[0] = (a->color.rgba[0] + b->color.rgba[0]) >> 1;
out->color.rgba[1] = (a->color.rgba[1] + b->color.rgba[1]) >> 1;
out->color.rgba[2] = (a->color.rgba[2] + b->color.rgba[2]) >> 1;
out->color.rgba[3] = (a->color.rgba[3] + b->color.rgba[3]) >> 1;
}
/*
@ -354,15 +354,19 @@ R_SubdividePatchToGrid
srfGridMesh_t *R_SubdividePatchToGrid( int width, int height,
drawVert_t points[MAX_PATCH_SIZE*MAX_PATCH_SIZE] ) {
int i, j, k, l;
drawVert_t_cleared( prev );
drawVert_t_cleared( next );
drawVert_t_cleared( mid );
drawVert_t prev;
drawVert_t next;
drawVert_t mid;
float len, maxLen;
int n;
int t;
drawVert_t ctrl[MAX_GRID_SIZE][MAX_GRID_SIZE];
float errorTable[2][MAX_GRID_SIZE];
memset( &prev, 0, sizeof( prev ) );
memset( &next, 0, sizeof( next ) );
memset( &mid, 0, sizeof( mid ) );
for ( i = 0 ; i < width ; i++ ) {
for ( j = 0 ; j < height ; j++ ) {
ctrl[j][i] = points[j*width+i];

View File

@ -338,7 +338,7 @@ typedef struct {
waveForm_t alphaWave;
alphaGen_t alphaGen;
byte constantColor[4]; // for CGEN_CONST and AGEN_CONST
color4ub_t constantColor; // for CGEN_CONST and AGEN_CONST
acff_t adjustColorsForFog;
@ -587,7 +587,7 @@ typedef struct {
int originalBrushNumber;
vec3_t bounds[2];
unsigned colorInt; // in packed byte format
color4ub_t colorInt; // in packed byte format
vec4_t color;
float tcScale; // texture coordinate vector scales
fogParms_t parms;
@ -1109,7 +1109,7 @@ typedef struct {
qboolean skyRenderedThisView; // flag for drawing sun
qboolean projection2D; // if qtrue, drawstretchpic doesn't need to change modes
byte color2D[4];
color4ub_t color2D;
qboolean doneSurfaces; // done any 3d surfaces already
trRefEntity_t entity2D; // currentEntity will point at this when doing 2D rendering
@ -1535,7 +1535,6 @@ TESSELATOR/SHADER DECLARATIONS
====================================================================
*/
typedef byte color4ub_t[4];
typedef struct stageVars
{

View File

@ -200,7 +200,7 @@ static void DrawNormals( const shaderCommands_t *input ) {
tess.numIndexes += 2;
}
tess.numVertexes *= 2;
Com_Memset( tess.svars.colors[0], tr.identityLightByte, tess.numVertexes * sizeof( color4ub_t ) );
Com_Memset( tess.svars.colors[0][0].rgba, tr.identityLightByte, tess.numVertexes * sizeof( color4ub_t ) );
vk_bind_pipeline( vk.normals_debug_pipeline );
vk_bind_index();
@ -328,7 +328,7 @@ static void DrawMultitextured( const shaderCommands_t *input, int stage ) {
GL_ClientState( 0, CLS_TEXCOORD_ARRAY | CLS_COLOR_ARRAY );
qglTexCoordPointer( 2, GL_FLOAT, 0, input->svars.texcoordPtr[0] );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, input->svars.colors[0] );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, input->svars.colors[0].rgba );
GL_ClientState( 1, CLS_TEXCOORD_ARRAY );
qglTexCoordPointer( 2, GL_FLOAT, 0, input->svars.texcoordPtr[1] );
@ -406,7 +406,7 @@ static void ProjectDlightTexture_scalar( void ) {
#ifdef USE_VULKAN
texCoords = (float*)&tess.svars.texcoords[0][0];
tess.svars.texcoordPtr[0] = tess.svars.texcoords[0];
colors = (byte*)&tess.svars.colors[0][0];
colors = tess.svars.colors[0][0].rgba;
#else
texCoords = texCoordsArray[0];
colors = colorArray[0];
@ -560,7 +560,7 @@ static void RB_FogPass( void ) {
fog = tr.world->fogs + tess.fogNum;
for ( i = 0; i < tess.numVertexes; i++ ) {
* ( int * )&tess.svars.colors[0][i] = fog->colorInt;
tess.svars.colors[0][i].u32 = fog->colorInt.u32;
}
RB_CalcFogTexCoords( ( float * ) tess.svars.texcoords[0] );
@ -580,7 +580,7 @@ static void RB_FogPass( void ) {
GL_ClientState( 1, CLS_NONE );
GL_ClientState( 0, CLS_TEXCOORD_ARRAY | CLS_COLOR_ARRAY );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors[0] );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors[0].rgba );
qglTexCoordPointer( 2, GL_FLOAT, 0, tess.svars.texcoords[0] );
GL_SelectTexture( 0 );
@ -629,7 +629,7 @@ void R_ComputeColors( const int b, color4ub_t *dest, const shaderStage_t *pStage
break;
case CGEN_CONST:
for ( i = 0; i < tess.numVertexes; i++ ) {
*(int *)dest[i] = *(int *)pStage->bundle[b].constantColor;
dest[i].u32 = pStage->bundle[b].constantColor.u32;
}
break;
case CGEN_VERTEX:
@ -641,10 +641,10 @@ void R_ComputeColors( const int b, color4ub_t *dest, const shaderStage_t *pStage
{
for ( i = 0; i < tess.numVertexes; i++ )
{
dest[i][0] = tess.vertexColors[i][0] * tr.identityLight;
dest[i][1] = tess.vertexColors[i][1] * tr.identityLight;
dest[i][2] = tess.vertexColors[i][2] * tr.identityLight;
dest[i][3] = tess.vertexColors[i][3];
dest[i].rgba[0] = tess.vertexColors[i].rgba[0] * tr.identityLight;
dest[i].rgba[1] = tess.vertexColors[i].rgba[1] * tr.identityLight;
dest[i].rgba[2] = tess.vertexColors[i].rgba[2] * tr.identityLight;
dest[i].rgba[3] = tess.vertexColors[i].rgba[3];
}
}
break;
@ -653,18 +653,18 @@ void R_ComputeColors( const int b, color4ub_t *dest, const shaderStage_t *pStage
{
for ( i = 0; i < tess.numVertexes; i++ )
{
dest[i][0] = 255 - tess.vertexColors[i][0];
dest[i][1] = 255 - tess.vertexColors[i][1];
dest[i][2] = 255 - tess.vertexColors[i][2];
dest[i].rgba[0] = 255 - tess.vertexColors[i].rgba[0];
dest[i].rgba[1] = 255 - tess.vertexColors[i].rgba[1];
dest[i].rgba[2] = 255 - tess.vertexColors[i].rgba[2];
}
}
else
{
for ( i = 0; i < tess.numVertexes; i++ )
{
dest[i][0] = ( 255 - tess.vertexColors[i][0] ) * tr.identityLight;
dest[i][1] = ( 255 - tess.vertexColors[i][1] ) * tr.identityLight;
dest[i][2] = ( 255 - tess.vertexColors[i][2] ) * tr.identityLight;
dest[i].rgba[0] = ( 255 - tess.vertexColors[i].rgba[0] ) * tr.identityLight;
dest[i].rgba[1] = ( 255 - tess.vertexColors[i].rgba[1] ) * tr.identityLight;
dest[i].rgba[2] = ( 255 - tess.vertexColors[i].rgba[2] ) * tr.identityLight;
}
}
break;
@ -675,18 +675,18 @@ void R_ComputeColors( const int b, color4ub_t *dest, const shaderStage_t *pStage
fog = tr.world->fogs + tess.fogNum;
for ( i = 0; i < tess.numVertexes; i++ ) {
* ( int * )&dest[i] = fog->colorInt;
dest[i].u32 = fog->colorInt.u32;
}
}
break;
case CGEN_WAVEFORM:
RB_CalcWaveColor( &pStage->bundle[b].rgbWave, ( unsigned char * ) dest );
RB_CalcWaveColor( &pStage->bundle[b].rgbWave, dest->rgba );
break;
case CGEN_ENTITY:
RB_CalcColorFromEntity( ( unsigned char * ) dest );
RB_CalcColorFromEntity( dest->rgba );
break;
case CGEN_ONE_MINUS_ENTITY:
RB_CalcColorFromOneMinusEntity( ( unsigned char * ) dest );
RB_CalcColorFromOneMinusEntity( dest->rgba );
break;
}
@ -701,36 +701,36 @@ void R_ComputeColors( const int b, color4ub_t *dest, const shaderStage_t *pStage
if ( ( pStage->bundle[b].rgbGen == CGEN_VERTEX && tr.identityLight != 1 ) ||
pStage->bundle[b].rgbGen != CGEN_VERTEX ) {
for ( i = 0; i < tess.numVertexes; i++ ) {
dest[i][3] = 0xff;
dest[i].rgba[3] = 255;
}
}
break;
case AGEN_CONST:
for ( i = 0; i < tess.numVertexes; i++ ) {
dest[i][3] = pStage->bundle[b].constantColor[3];
dest[i].rgba[3] = pStage->bundle[b].constantColor.rgba[3];
}
break;
case AGEN_WAVEFORM:
RB_CalcWaveAlpha( &pStage->bundle[b].alphaWave, ( unsigned char * ) dest );
RB_CalcWaveAlpha( &pStage->bundle[b].alphaWave, dest->rgba );
break;
case AGEN_LIGHTING_SPECULAR:
RB_CalcSpecularAlpha( ( unsigned char * ) dest );
RB_CalcSpecularAlpha( dest->rgba );
break;
case AGEN_ENTITY:
RB_CalcAlphaFromEntity( ( unsigned char * ) dest );
RB_CalcAlphaFromEntity( dest->rgba );
break;
case AGEN_ONE_MINUS_ENTITY:
RB_CalcAlphaFromOneMinusEntity( ( unsigned char * ) dest );
RB_CalcAlphaFromOneMinusEntity( dest->rgba );
break;
case AGEN_VERTEX:
for ( i = 0; i < tess.numVertexes; i++ ) {
dest[i][3] = tess.vertexColors[i][3];
dest[i].rgba[3] = tess.vertexColors[i].rgba[3];
}
break;
case AGEN_ONE_MINUS_VERTEX:
for ( i = 0; i < tess.numVertexes; i++ )
{
dest[i][3] = 255 - tess.vertexColors[i][3];
dest[i].rgba[3] = 255 - tess.vertexColors[i].rgba[3];
}
break;
case AGEN_PORTAL:
@ -760,7 +760,7 @@ void R_ComputeColors( const int b, color4ub_t *dest, const shaderStage_t *pStage
alpha = len * 0xff;
}
dest[i][3] = alpha;
dest[i].rgba[3] = alpha;
}
}
break;
@ -774,13 +774,13 @@ void R_ComputeColors( const int b, color4ub_t *dest, const shaderStage_t *pStage
switch ( pStage->bundle[b].adjustColorsForFog )
{
case ACFF_MODULATE_RGB:
RB_CalcModulateColorsByFog( ( unsigned char * ) dest );
RB_CalcModulateColorsByFog( dest->rgba );
break;
case ACFF_MODULATE_ALPHA:
RB_CalcModulateAlphasByFog( ( unsigned char * ) dest );
RB_CalcModulateAlphasByFog( dest->rgba );
break;
case ACFF_MODULATE_RGBA:
RB_CalcModulateRGBAsByFog( ( unsigned char * ) dest );
RB_CalcModulateRGBAsByFog( dest->rgba );
break;
case ACFF_NONE:
break;
@ -991,7 +991,7 @@ static void RB_IterateStagesGeneric( const shaderCommands_t *input )
vk_draw_geometry( tess.depthRange, qtrue );
}
#else
R_ComputeColors( 0, tess.svars.colors[0], pStage );
R_ComputeColors( 0, tess.svars.colors[0].rgba, pStage );
R_ComputeTexCoords( 0, &pStage->bundle[0] );
@ -1013,7 +1013,7 @@ static void RB_IterateStagesGeneric( const shaderCommands_t *input )
GL_ClientState( 0, CLS_TEXCOORD_ARRAY | CLS_COLOR_ARRAY );
qglTexCoordPointer( 2, GL_FLOAT, 0, input->svars.texcoordPtr[0] );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, input->svars.colors[0] );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, input->svars.colors[0].rgba );
}
//
@ -1281,7 +1281,7 @@ void RB_StageIteratorGeneric( void )
if ( tess.xstages[0] )
{
R_ComputeColors( 0, tess.svars.colors, tess.xstages[0] );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors[0] );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, tess.svars.colors[0].rgba );
R_ComputeTexCoords( 0, &tess.xstages[0]->bundle[0] );
qglTexCoordPointer( 2, GL_FLOAT, 0, tess.svars.texcoordPtr[0] );
if ( shader->multitextureEnv )

View File

@ -410,7 +410,7 @@ static void AutospriteDeform( void ) {
VectorScale(up, axisLength, up);
}
RB_AddQuadStamp( mid, left, up, tess.vertexColors[i] );
RB_AddQuadStamp( mid, left, up, tess.vertexColors[i].rgba );
}
}
@ -599,14 +599,13 @@ COLORS
*/
void RB_CalcColorFromEntity( unsigned char *dstColors )
{
uint32_t c, *pColors = (uint32_t *)dstColors;
int i;
int *pColors = ( int * ) dstColors;
int c;
if ( !backEnd.currentEntity )
return;
c = * ( int * ) backEnd.currentEntity->e.shaderRGBA;
c = backEnd.currentEntity->e.shader.u32;
for ( i = 0; i < tess.numVertexes; i++, pColors++ )
{
@ -621,23 +620,20 @@ void RB_CalcColorFromEntity( unsigned char *dstColors )
void RB_CalcColorFromOneMinusEntity( unsigned char *dstColors )
{
int i;
int *pColors = ( int * ) dstColors;
unsigned char invModulate[4];
int c;
uint32_t *pColors = ( uint32_t * ) dstColors;
color4ub_t invModulate;
if ( !backEnd.currentEntity )
return;
invModulate[0] = 255 - backEnd.currentEntity->e.shaderRGBA[0];
invModulate[1] = 255 - backEnd.currentEntity->e.shaderRGBA[1];
invModulate[2] = 255 - backEnd.currentEntity->e.shaderRGBA[2];
invModulate[3] = 255 - backEnd.currentEntity->e.shaderRGBA[3]; // this trashes alpha, but the AGEN block fixes it
c = * ( int * ) invModulate;
invModulate.rgba[0] = 255 - backEnd.currentEntity->e.shader.rgba[0];
invModulate.rgba[1] = 255 - backEnd.currentEntity->e.shader.rgba[1];
invModulate.rgba[2] = 255 - backEnd.currentEntity->e.shader.rgba[2];
invModulate.rgba[3] = 255 - backEnd.currentEntity->e.shader.rgba[3]; // this trashes alpha, but the AGEN block fixes it
for ( i = 0; i < tess.numVertexes; i++, pColors++ )
{
*pColors = c;
*pColors = invModulate.u32;
}
}
@ -656,7 +652,7 @@ void RB_CalcAlphaFromEntity( unsigned char *dstColors )
for ( i = 0; i < tess.numVertexes; i++, dstColors += 4 )
{
*dstColors = backEnd.currentEntity->e.shaderRGBA[3];
*dstColors = backEnd.currentEntity->e.shader.rgba[3];
}
}
@ -675,7 +671,7 @@ void RB_CalcAlphaFromOneMinusEntity( unsigned char *dstColors )
for ( i = 0; i < tess.numVertexes; i++, dstColors += 4 )
{
*dstColors = 0xff - backEnd.currentEntity->e.shaderRGBA[3];
*dstColors = 0xff - backEnd.currentEntity->e.shader.rgba[3];
}
}
@ -685,12 +681,10 @@ void RB_CalcAlphaFromOneMinusEntity( unsigned char *dstColors )
*/
void RB_CalcWaveColor( const waveForm_t *wf, unsigned char *dstColors )
{
int i;
int v;
int v, i;
float glow;
int *colors = ( int * ) dstColors;
byte color[4];
uint32_t *colors = ( uint32_t * ) dstColors;
color4ub_t color;
if ( wf->func == GF_NOISE ) {
glow = wf->base + R_NoiseGet4f( 0, 0, 0, ( tess.shaderTime + wf->phase ) * wf->frequency ) * wf->amplitude;
@ -705,12 +699,11 @@ void RB_CalcWaveColor( const waveForm_t *wf, unsigned char *dstColors )
else if ( v > 255 )
v = 255;
color[0] = color[1] = color[2] = v;
color[3] = 255;
v = *(int *)color;
color.rgba[0] = color.rgba[1] = color.rgba[2] = v;
color.rgba[3] = 255;
for ( i = 0; i < tess.numVertexes; i++, colors++ ) {
*colors = v;
*colors = color.u32;
}
}

View File

@ -873,9 +873,9 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text )
VectorClear( color );
ParseVector( text, 3, color );
stage->bundle[0].constantColor[0] = 255 * color[0];
stage->bundle[0].constantColor[1] = 255 * color[1];
stage->bundle[0].constantColor[2] = 255 * color[2];
stage->bundle[0].constantColor.rgba[0] = 255 * color[0];
stage->bundle[0].constantColor.rgba[1] = 255 * color[1];
stage->bundle[0].constantColor.rgba[2] = 255 * color[2];
stage->bundle[0].rgbGen = CGEN_CONST;
}
@ -940,7 +940,7 @@ static qboolean ParseStage( shaderStage_t *stage, const char **text )
else if ( !Q_stricmp( token, "const" ) )
{
token = COM_ParseExt( text, qfalse );
stage->bundle[0].constantColor[3] = 255 * Q_atof( token );
stage->bundle[0].constantColor.rgba[3] = 255 * Q_atof( token );
stage->bundle[0].alphaGen = AGEN_CONST;
}
else if ( !Q_stricmp( token, "identity" ) )
@ -2456,7 +2456,7 @@ static qboolean EqualRGBgen( const shaderStage_t *st1, const shaderStage_t *st2
}
if ( st1->bundle[0].rgbGen == CGEN_CONST ) {
if ( memcmp( st1->bundle[0].constantColor, st2->bundle[0].constantColor, 4 ) != 0 ) {
if ( st1->bundle[0].constantColor.u32 != st2->bundle[0].constantColor.u32 ) {
return qfalse;
}
}
@ -2473,7 +2473,7 @@ static qboolean EqualRGBgen( const shaderStage_t *st1, const shaderStage_t *st2
if ( st1->bundle[0].alphaGen == AGEN_CONST ) {
if ( st1->bundle[0].rgbGen != CGEN_CONST ) {
if ( st1->bundle[0].constantColor[3] != st2->bundle[0].constantColor[3] ) {
if ( st1->bundle[0].constantColor.rgba[3] != st2->bundle[0].constantColor.rgba[3] ) {
return qfalse;
}
}

View File

@ -123,7 +123,7 @@ static void R_CalcShadowEdges( void ) {
colors = &tess.svars.colors[0][0]; // we need at least 2x SHADER_MAX_VERTEXES there
for ( i = 0; i < tess.numVertexes; i++ ) {
Vector4Set(colors[i], 50, 50, 50, 255);
Vector4Set( colors[i].rgba, 50, 50, 50, 255 );
}
#endif
}
@ -320,7 +320,7 @@ void RB_ShadowFinish( void ) {
for ( i = 0; i < 4; i++ )
{
VectorCopy( verts[i], tess.xyz[i] );
Vector4Set( tess.svars.colors[0][i], 153, 153, 153, 255 );
Vector4Set( tess.svars.colors[0][i].rgba, 153, 153, 153, 255 );
}
tess.numVertexes = 4;

View File

@ -188,7 +188,7 @@ static void RB_SurfaceSprite( void ) {
VectorSubtract( vec3_origin, left, left );
}
RB_AddQuadStamp( backEnd.currentEntity->e.origin, left, up, backEnd.currentEntity->e.shaderRGBA );
RB_AddQuadStamp( backEnd.currentEntity->e.origin, left, up, backEnd.currentEntity->e.shader.rgba );
}
@ -217,7 +217,7 @@ static void RB_SurfacePolychain( srfPoly_t *p ) {
VectorCopy( p->verts[i].xyz, tess.xyz[numv] );
tess.texCoords[0][numv][0] = p->verts[i].st[0];
tess.texCoords[0][numv][1] = p->verts[i].st[1];
*(int *)&tess.vertexColors[numv] = *(int *)p->verts[ i ].modulate;
tess.vertexColors[numv].u32 = p->verts[ i ].modulate.u32;
numv++;
}
@ -245,7 +245,7 @@ static void RB_SurfaceTriangles( srfTriangles_t *srf ) {
float *xyz, *normal;
float *texCoords0;
float *texCoords1;
byte *color;
uint32_t *color;
#ifdef USE_LEGACY_DLIGHTS
int dlightBits;
#endif
@ -297,9 +297,9 @@ static void RB_SurfaceTriangles( srfTriangles_t *srf ) {
normal = tess.normal[ tess.numVertexes ];
texCoords0 = tess.texCoords[0][ tess.numVertexes ];
texCoords1 = tess.texCoords[1][ tess.numVertexes ];
color = tess.vertexColors[ tess.numVertexes ];
color = &tess.vertexColors[ tess.numVertexes ].u32;
for ( i = 0; i < srf->numVerts; i++, dv++, xyz += 4, normal += 4, texCoords0 += 2, color += 4 ) {
for ( i = 0; i < srf->numVerts; i++, dv++, xyz += 4, normal += 4, texCoords0 += 2, color++ ) {
xyz[0] = dv->xyz[0];
xyz[1] = dv->xyz[1];
xyz[2] = dv->xyz[2];
@ -325,7 +325,7 @@ static void RB_SurfaceTriangles( srfTriangles_t *srf ) {
texCoords1 += 2;
}
*(int *)color = *(int *)dv->color;
*color = dv->color.u32;
}
#ifdef USE_LEGACY_DLIGHTS
for ( i = 0 ; i < srf->numVerts ; i++ ) {
@ -385,7 +385,7 @@ static void RB_SurfaceBeam( void )
GL_Bind( tr.whiteImage );
for ( i = 0; i < (NUM_BEAM_SEGS+1)*2; i++ ) {
Vector4Set( tess.svars.colors[0][i], 255, 0, 0, 255 );
Vector4Set( tess.svars.colors[0][i].rgba, 255, 0, 0, 255 );
}
for ( i = 0; i <= NUM_BEAM_SEGS; i++ ) {
@ -434,34 +434,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[0][tess.numVertexes][0] = 0;
tess.texCoords[0][tess.numVertexes][1] = 0;
tess.vertexColors[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0] * 0.25;
tess.vertexColors[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1] * 0.25;
tess.vertexColors[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2] * 0.25;
tess.vertexColors[tess.numVertexes].rgba[0] = backEnd.currentEntity->e.shader.rgba[0] * 0.25;
tess.vertexColors[tess.numVertexes].rgba[1] = backEnd.currentEntity->e.shader.rgba[1] * 0.25;
tess.vertexColors[tess.numVertexes].rgba[2] = backEnd.currentEntity->e.shader.rgba[2] * 0.25;
tess.numVertexes++;
VectorMA( start, spanWidth2, up, tess.xyz[tess.numVertexes] );
tess.texCoords[0][tess.numVertexes][0] = 0;
tess.texCoords[0][tess.numVertexes][1] = 1;
tess.vertexColors[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0];
tess.vertexColors[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1];
tess.vertexColors[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2];
tess.vertexColors[tess.numVertexes].rgba[0] = backEnd.currentEntity->e.shader.rgba[0];
tess.vertexColors[tess.numVertexes].rgba[1] = backEnd.currentEntity->e.shader.rgba[1];
tess.vertexColors[tess.numVertexes].rgba[2] = backEnd.currentEntity->e.shader.rgba[2];
tess.numVertexes++;
VectorMA( end, spanWidth, up, tess.xyz[tess.numVertexes] );
tess.texCoords[0][tess.numVertexes][0] = t;
tess.texCoords[0][tess.numVertexes][1] = 0;
tess.vertexColors[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0];
tess.vertexColors[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1];
tess.vertexColors[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2];
tess.vertexColors[tess.numVertexes].rgba[0] = backEnd.currentEntity->e.shader.rgba[0];
tess.vertexColors[tess.numVertexes].rgba[1] = backEnd.currentEntity->e.shader.rgba[1];
tess.vertexColors[tess.numVertexes].rgba[2] = backEnd.currentEntity->e.shader.rgba[2];
tess.numVertexes++;
VectorMA( end, spanWidth2, up, tess.xyz[tess.numVertexes] );
tess.texCoords[0][tess.numVertexes][0] = t;
tess.texCoords[0][tess.numVertexes][1] = 1;
tess.vertexColors[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0];
tess.vertexColors[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1];
tess.vertexColors[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2];
tess.vertexColors[tess.numVertexes].rgba[0] = backEnd.currentEntity->e.shader.rgba[0];
tess.vertexColors[tess.numVertexes].rgba[1] = backEnd.currentEntity->e.shader.rgba[1];
tess.vertexColors[tess.numVertexes].rgba[2] = backEnd.currentEntity->e.shader.rgba[2];
tess.numVertexes++;
tess.indexes[tess.numIndexes++] = vbase;
@ -517,9 +517,9 @@ static void DoRailDiscs( int numSegs, const vec3_t start, const vec3_t dir, cons
VectorCopy( pos[j], tess.xyz[tess.numVertexes] );
tess.texCoords[0][tess.numVertexes][0] = ( j < 2 );
tess.texCoords[0][tess.numVertexes][1] = ( j && j != 3 );
tess.vertexColors[tess.numVertexes][0] = backEnd.currentEntity->e.shaderRGBA[0];
tess.vertexColors[tess.numVertexes][1] = backEnd.currentEntity->e.shaderRGBA[1];
tess.vertexColors[tess.numVertexes][2] = backEnd.currentEntity->e.shaderRGBA[2];
tess.vertexColors[tess.numVertexes].rgba[0] = backEnd.currentEntity->e.shader.rgba[0];
tess.vertexColors[tess.numVertexes].rgba[1] = backEnd.currentEntity->e.shader.rgba[1];
tess.vertexColors[tess.numVertexes].rgba[2] = backEnd.currentEntity->e.shader.rgba[2];
tess.numVertexes++;
VectorAdd( pos[j], dir, pos[j] );
@ -1026,8 +1026,8 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
float *texCoords0;
float *texCoords1;
float *normal;
unsigned char *color;
drawVert_t *dv;
uint32_t *color;
drawVert_t *dv;
int rows, irows, vrows;
int used;
int widthTable[MAX_GRID_SIZE];
@ -1152,7 +1152,7 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
normal = tess.normal[numVertexes];
texCoords0 = tess.texCoords[0][numVertexes];
texCoords1 = tess.texCoords[1][numVertexes];
color = ( unsigned char * ) &tess.vertexColors[numVertexes];
color = &tess.vertexColors[numVertexes].u32;
#ifdef USE_LEGACY_DLIGHTS
vDlightBits = &tess.vertexDlightBits[numVertexes];
#endif
@ -1183,13 +1183,13 @@ static void RB_SurfaceGrid( srfGridMesh_t *cv ) {
normal[2] = dv->normal[2];
normal += 4;
}
* ( unsigned int * ) color = * ( unsigned int * ) dv->color;
*color = dv->color.u32;
#ifdef USE_LEGACY_DLIGHTS
*vDlightBits++ = dlightBits;
#endif
xyz += 4;
texCoords0 += 2;
color += 4;
color++;
}
}
@ -1261,14 +1261,14 @@ static void RB_SurfaceAxis( void ) {
Com_Memset( tess.svars.colors[0], 0, 6 * sizeof( color4ub_t ) );
for ( i = 0; i < 6; i++ )
tess.svars.colors[0][i][3] = 255;
tess.svars.colors[0][i].rgba[3] = 255;
tess.svars.colors[0][0][0] = 255;
tess.svars.colors[0][1][0] = 255;
tess.svars.colors[0][2][1] = 255;
tess.svars.colors[0][3][1] = 255;
tess.svars.colors[0][4][2] = 255;
tess.svars.colors[0][5][2] = 255;
tess.svars.colors[0][0].rgba[0] = 255;
tess.svars.colors[0][1].rgba[0] = 255;
tess.svars.colors[0][2].rgba[1] = 255;
tess.svars.colors[0][3].rgba[1] = 255;
tess.svars.colors[0][4].rgba[2] = 255;
tess.svars.colors[0][5].rgba[2] = 255;
tess.numVertexes = 6;
@ -1297,18 +1297,18 @@ static void RB_SurfaceAxis( void ) {
Com_Memset( colors, 0, sizeof( colors ) );
for ( i = 0; i < 6; i++ ) {
colors[i][3] = 255;
colors[i].rgba[3] = 255;
}
colors[0][0] = 255;
colors[1][0] = 255;
colors[2][1] = 255;
colors[3][1] = 255;
colors[4][2] = 255;
colors[5][2] = 255;
colors[0].rgba[0] = 255;
colors[1].rgba[0] = 255;
colors[2].rgba[1] = 255;
colors[3].rgba[1] = 255;
colors[4].rgba[2] = 255;
colors[5].rgba[2] = 255;
qglVertexPointer( 3, GL_FLOAT, 0, xyz );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colors );
qglColorPointer( 4, GL_UNSIGNED_BYTE, 0, colors[0].rgba );
qglDrawArrays( GL_LINES, 0, 6 );

View File

@ -6065,7 +6065,7 @@ void vk_bind_geometry( uint32_t flags )
}
if ( flags & TESS_RGBA0 ) {
vk_bind_attr(1, sizeof( color4ub_t ), tess.svars.colors[0]);
vk_bind_attr(1, sizeof( color4ub_t ), tess.svars.colors[0][0].rgba);
}
if ( flags & TESS_ST0 ) {
@ -6085,11 +6085,11 @@ void vk_bind_geometry( uint32_t flags )
}
if ( flags & TESS_RGBA1 ) {
vk_bind_attr(6, sizeof( color4ub_t ), tess.svars.colors[1]);
vk_bind_attr(6, sizeof( color4ub_t ), tess.svars.colors[1][0].rgba);
}
if ( flags & TESS_RGBA2 ) {
vk_bind_attr(7, sizeof( color4ub_t ), tess.svars.colors[2]);
vk_bind_attr(7, sizeof( color4ub_t ), tess.svars.colors[2][0].rgba);
}
qvkCmdBindVertexBuffers( vk.cmd->command_buffer, bind_base, bind_count, shade_bufs, vk.cmd->buf_offset + bind_base );

View File

@ -458,10 +458,10 @@ void RB_RenderFlare( flare_t *f ) {
tess.xyz[tess.numVertexes][2] = 0.0;
tess.texCoords[0][tess.numVertexes][0] = 0;
tess.texCoords[0][tess.numVertexes][1] = 0;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.vertexColors[tess.numVertexes].rgba[0] = iColor[0];
tess.vertexColors[tess.numVertexes].rgba[1] = iColor[1];
tess.vertexColors[tess.numVertexes].rgba[2] = iColor[2];
tess.vertexColors[tess.numVertexes].rgba[3] = 255;
tess.numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX - size;
@ -469,10 +469,10 @@ void RB_RenderFlare( flare_t *f ) {
tess.xyz[tess.numVertexes][2] = 0.0;
tess.texCoords[0][tess.numVertexes][0] = 0;
tess.texCoords[0][tess.numVertexes][1] = 1;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.vertexColors[tess.numVertexes].rgba[0] = iColor[0];
tess.vertexColors[tess.numVertexes].rgba[1] = iColor[1];
tess.vertexColors[tess.numVertexes].rgba[2] = iColor[2];
tess.vertexColors[tess.numVertexes].rgba[3] = 255;
tess.numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX + size;
@ -480,10 +480,10 @@ void RB_RenderFlare( flare_t *f ) {
tess.xyz[tess.numVertexes][2] = 0.0;
tess.texCoords[0][tess.numVertexes][0] = 1;
tess.texCoords[0][tess.numVertexes][1] = 1;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.vertexColors[tess.numVertexes].rgba[0] = iColor[0];
tess.vertexColors[tess.numVertexes].rgba[1] = iColor[1];
tess.vertexColors[tess.numVertexes].rgba[2] = iColor[2];
tess.vertexColors[tess.numVertexes].rgba[3] = 255;
tess.numVertexes++;
tess.xyz[tess.numVertexes][0] = f->windowX + size;
@ -491,10 +491,10 @@ void RB_RenderFlare( flare_t *f ) {
tess.xyz[tess.numVertexes][2] = 0.0;
tess.texCoords[0][tess.numVertexes][0] = 1;
tess.texCoords[0][tess.numVertexes][1] = 0;
tess.vertexColors[tess.numVertexes][0] = iColor[0];
tess.vertexColors[tess.numVertexes][1] = iColor[1];
tess.vertexColors[tess.numVertexes][2] = iColor[2];
tess.vertexColors[tess.numVertexes][3] = 255;
tess.vertexColors[tess.numVertexes].rgba[0] = iColor[0];
tess.vertexColors[tess.numVertexes].rgba[1] = iColor[1];
tess.vertexColors[tess.numVertexes].rgba[2] = iColor[2];
tess.vertexColors[tess.numVertexes].rgba[3] = 255;
tess.numVertexes++;
tess.indexes[tess.numIndexes++] = 0;