OpenGL2: Support half floats for texcoords and vertex colors.
This commit is contained in:
parent
1ba9e7a45e
commit
943259f6b4
10 changed files with 193 additions and 154 deletions
|
@ -88,6 +88,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;
|
||||
uint32_t pNormal;
|
||||
int ndx;
|
||||
|
||||
RB_CHECKOVERFLOW( 4, 6 );
|
||||
|
@ -123,10 +124,11 @@ void RB_AddQuadStampExt( vec3_t origin, vec3_t left, vec3_t up, float color[4],
|
|||
// constant normal all the way around
|
||||
VectorSubtract( vec3_origin, backEnd.viewParms.or.axis[0], normal );
|
||||
|
||||
R_VaoPackNormal((byte *)&pNormal, normal);
|
||||
tess.normal[ndx] =
|
||||
tess.normal[ndx+1] =
|
||||
tess.normal[ndx+2] =
|
||||
tess.normal[ndx+3] = R_VaoPackNormal(normal);
|
||||
tess.normal[ndx+3] = pNormal;
|
||||
|
||||
// standard square texture coordinates
|
||||
VectorSet2(tess.texCoords[ndx ][0], s1, t1);
|
||||
|
@ -346,7 +348,7 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, srfVert_t *verts, int numIn
|
|||
dv = verts;
|
||||
normal = &tess.normal[ tess.numVertexes ];
|
||||
for ( i = 0 ; i < numVerts ; i++, dv++, normal++ )
|
||||
*normal = R_VaoPackNormal(dv->normal);
|
||||
R_VaoPackNormal((byte *)normal, dv->normal);
|
||||
}
|
||||
|
||||
#ifdef USE_VERT_TANGENT_SPACE
|
||||
|
@ -355,7 +357,7 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, srfVert_t *verts, int numIn
|
|||
dv = verts;
|
||||
tangent = &tess.tangent[ tess.numVertexes ];
|
||||
for ( i = 0 ; i < numVerts ; i++, dv++, tangent++ )
|
||||
*tangent = R_VaoPackTangent(dv->tangent);
|
||||
R_VaoPackTangent((byte *)tangent, dv->tangent);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -388,7 +390,7 @@ static void RB_SurfaceVertsAndIndexes( int numVerts, srfVert_t *verts, int numIn
|
|||
dv = verts;
|
||||
lightdir = &tess.lightdir[ tess.numVertexes ];
|
||||
for ( i = 0 ; i < numVerts ; i++, dv++, lightdir++ )
|
||||
*lightdir = R_VaoPackNormal(dv->lightdir);
|
||||
R_VaoPackNormal((byte *)lightdir, dv->lightdir);
|
||||
}
|
||||
|
||||
#if 0 // nothing even uses vertex dlightbits
|
||||
|
@ -1147,7 +1149,7 @@ static void LerpMeshVertexes_scalar(mdvSurface_t *surf, float backlerp)
|
|||
VectorCopy(newVerts->xyz, outXyz);
|
||||
VectorCopy(newVerts->normal, normal);
|
||||
|
||||
*outNormal = R_VaoPackNormal(normal);
|
||||
R_VaoPackNormal((byte *)outNormal, normal);
|
||||
|
||||
newVerts++;
|
||||
outXyz += 4;
|
||||
|
@ -1172,7 +1174,7 @@ static void LerpMeshVertexes_scalar(mdvSurface_t *surf, float backlerp)
|
|||
VectorLerp(newVerts->normal, oldVerts->normal, backlerp, normal);
|
||||
VectorNormalize(normal);
|
||||
|
||||
*outNormal = R_VaoPackNormal(normal);
|
||||
R_VaoPackNormal((byte *)outNormal, normal);
|
||||
|
||||
newVerts++;
|
||||
oldVerts++;
|
||||
|
@ -1410,13 +1412,13 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
|
|||
|
||||
if ( tess.shader->vertexAttribs & ATTR_NORMAL )
|
||||
{
|
||||
*normal++ = R_VaoPackNormal(dv->normal);
|
||||
R_VaoPackNormal((byte *)normal++, dv->normal);
|
||||
}
|
||||
|
||||
#ifdef USE_VERT_TANGENT_SPACE
|
||||
if ( tess.shader->vertexAttribs & ATTR_TANGENT )
|
||||
{
|
||||
*tangent++ = R_VaoPackTangent(dv->tangent);
|
||||
R_VaoPackTangent((byte *)tangent++, dv->tangent);
|
||||
}
|
||||
#endif
|
||||
if ( tess.shader->vertexAttribs & ATTR_TEXCOORD )
|
||||
|
@ -1439,7 +1441,7 @@ static void RB_SurfaceGrid( srfBspSurface_t *srf ) {
|
|||
|
||||
if ( tess.shader->vertexAttribs & ATTR_LIGHTDIRECTION )
|
||||
{
|
||||
*lightdir++ = R_VaoPackNormal(dv->lightdir);
|
||||
R_VaoPackNormal((byte *)lightdir++, dv->lightdir);
|
||||
}
|
||||
|
||||
//*vDlightBits++ = dlightBits;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue