diff options
author | SmileTheory <SmileTheory@gmail.com> | 2014-11-03 19:10:35 -0800 |
---|---|---|
committer | Tim Angus <tim@ngus.net> | 2015-03-17 11:38:54 +0000 |
commit | f2cd353409185a408d175367ff1bc81a9c74a8ed (patch) | |
tree | d4a94ba395715f53ca7ee8e7989041c2fdc5736c /src/renderergl2/tr_surface.c | |
parent | f3fe657d5e529f9f5235823d7b356d5a55aa04b3 (diff) |
OpenGL2: Support half floats for texcoords and vertex colors.
Diffstat (limited to 'src/renderergl2/tr_surface.c')
-rw-r--r-- | src/renderergl2/tr_surface.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/src/renderergl2/tr_surface.c b/src/renderergl2/tr_surface.c index 6d2cb4ca..d8871b9b 100644 --- a/src/renderergl2/tr_surface.c +++ b/src/renderergl2/tr_surface.c @@ -89,6 +89,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 ); @@ -124,10 +125,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); @@ -347,7 +349,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 @@ -356,7 +358,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 @@ -389,7 +391,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 @@ -1148,7 +1150,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; @@ -1173,7 +1175,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++; @@ -1411,13 +1413,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 ) @@ -1440,7 +1442,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; |