OpenGL2: Store normals/tangents as int16_t[4].

This commit is contained in:
SmileTheory 2016-09-06 00:57:15 -07:00
parent 762f50757d
commit dfbaf50324
13 changed files with 288 additions and 1042 deletions

View file

@ -1024,9 +1024,9 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
int i;
vec4_t *outXYZ;
uint32_t *outNormal;
int16_t *outNormal;
#ifdef USE_VERT_TANGENT_SPACE
uint32_t *outTangent;
int16_t *outTangent;
#endif
vec2_t (*outTexCoord)[2];
vec4_t *outColor;
@ -1042,9 +1042,9 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
RB_CHECKOVERFLOW( surf->num_vertexes, surf->num_triangles * 3 );
outXYZ = &tess.xyz[tess.numVertexes];
outNormal = &tess.normal[tess.numVertexes];
outNormal = tess.normal[tess.numVertexes];
#ifdef USE_VERT_TANGENT_SPACE
outTangent = &tess.tangent[tess.numVertexes];
outTangent = tess.tangent[tess.numVertexes];
#endif
outTexCoord = &tess.texCoords[tess.numVertexes];
outColor = &tess.vertexColors[tess.numVertexes];
@ -1056,7 +1056,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
// transform vertexes and fill other data
for( i = 0; i < surf->num_vertexes;
i++, outXYZ++, outNormal++, outTexCoord++, outColor++ ) {
i++, outXYZ++, outNormal+=4, outTexCoord++, outColor++ ) {
int j, k;
float vtxMat[12];
float nrmMat[9];
@ -1130,7 +1130,7 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
normal[1] = DotProduct(&nrmMat[3], &data->normals[3*vtx]);
normal[2] = DotProduct(&nrmMat[6], &data->normals[3*vtx]);
R_VaoPackNormal((byte *)outNormal, normal);
R_VaoPackNormal(outNormal, normal);
#ifdef USE_VERT_TANGENT_SPACE
tangent[0] = DotProduct(&nrmMat[0], &data->tangents[4*vtx]);
@ -1138,7 +1138,8 @@ void RB_IQMSurfaceAnim( surfaceType_t *surface ) {
tangent[2] = DotProduct(&nrmMat[6], &data->tangents[4*vtx]);
tangent[3] = data->tangents[4*vtx+3];
R_VaoPackTangent((byte *)outTangent++, tangent);
R_VaoPackTangent(outTangent, tangent);
outTangent+=4;
#endif
}