@@ -1052,66 +1052,71 @@ static void Tess_SurfaceMD5( md5Surface_t *srf )
10521052 tessIndex[ 2 ] = tess.numVertexes + surfaceTriangle->indexes [ 2 ];
10531053 }
10541054
1055- shaderVertex_t *tessVertex = tess.verts + tess.numVertexes ;
1056- shaderVertex_t *lastVertex = tessVertex + srf->numVerts ;
1055+ shaderVertex_t *modelTessVertex = tess.verts + tess.numVertexes ;
10571056
10581057 // Deform the vertices by the lerped bones.
10591058 if ( tess.skipTangents )
10601059 {
1061- for ( ; tessVertex < lastVertex; tessVertex++,
1062- surfaceVertex++ )
1060+ auto task = [&]( size_t i ) -> void
10631061 {
1064- vec3_t position = {};
1062+ shaderVertex_t *tessVertex = modelTessVertex + i;
1063+ md5Vertex_t *vertex = surfaceVertex + i;
10651064
1066- float *boneWeight = surfaceVertex->boneWeights ;
1067- float *lastWeight = boneWeight + surfaceVertex->numWeights ;
1068- uint32_t *boneIndex = surfaceVertex->boneIndexes ;
1069- vec4_t *surfacePosition = &surfaceVertex->position ;
1065+ vec4_t *vertexPosition = &vertex->position ;
10701066
1071- for ( ; boneWeight < lastWeight; boneWeight++,
1072- boneIndex++ )
1067+ float *boneWeight = vertex->boneWeights ;
1068+ float *lastWeight = boneWeight + vertex->numWeights ;
1069+ uint32_t *boneIndex = vertex->boneIndexes ;
1070+
1071+ vec3_t position = {};
1072+
1073+ for ( ; boneWeight < lastWeight; boneWeight++, boneIndex++ )
10731074 {
10741075 vec3_t tmp;
10751076
1076- TransformPoint ( &bones[ *boneIndex ], *surfacePosition , tmp );
1077+ TransformPoint ( &bones[ *boneIndex ], *vertexPosition , tmp );
10771078 VectorMA ( position, *boneWeight, tmp, position );
10781079 }
10791080
10801081 VectorCopy ( position, tessVertex->xyz );
10811082
1082- Vector2Copy ( surfaceVertex->texCoords , tessVertex->texCoords );
1083- }
1083+ Vector2Copy ( vertex->texCoords , tessVertex->texCoords );
1084+ };
1085+
1086+ Omp::Tasker ( task, srf->numVerts );
10841087 }
10851088 else
10861089 {
1087- for ( ; tessVertex < lastVertex; tessVertex++,
1088- surfaceVertex++ )
1090+ auto task = [&]( size_t i ) -> void
10891091 {
1090- vec3_t tangent = {}, binormal = {}, normal = {}, position = {};
1092+ shaderVertex_t *tessVertex = modelTessVertex + i;
1093+ md5Vertex_t *vertex = surfaceVertex + i;
1094+
1095+ vec4_t *vertexPosition = &vertex->position ;
1096+ vec4_t *vertexNormal = &vertex->normal ;
1097+ vec4_t *vertexTangent = &vertex->tangent ;
1098+ vec4_t *vertexBinormal = &vertex->binormal ;
1099+
1100+ float *boneWeight = vertex->boneWeights ;
1101+ float *lastWeight = boneWeight + vertex->numWeights ;
1102+ uint32_t *boneIndex = vertex->boneIndexes ;
10911103
1092- float *boneWeight = surfaceVertex->boneWeights ;
1093- float *lastWeight = boneWeight + surfaceVertex->numWeights ;
1094- uint32_t *boneIndex = surfaceVertex->boneIndexes ;
1095- vec4_t *surfacePosition = &surfaceVertex->position ;
1096- vec4_t *surfaceNormal = &surfaceVertex->normal ;
1097- vec4_t *surfaceTangent = &surfaceVertex->tangent ;
1098- vec4_t *surfaceBinormal = &surfaceVertex->binormal ;
1104+ vec3_t tangent = {}, binormal = {}, normal = {}, position = {};
10991105
1100- for ( ; boneWeight < lastWeight; boneWeight++,
1101- boneIndex++ )
1106+ for ( ; boneWeight < lastWeight; boneWeight++, boneIndex++ )
11021107 {
11031108 vec3_t tmp;
11041109
1105- TransformPoint ( &bones[ *boneIndex ], *surfacePosition , tmp );
1110+ TransformPoint ( &bones[ *boneIndex ], *vertexPosition , tmp );
11061111 VectorMA ( position, *boneWeight, tmp, position );
11071112
1108- TransformNormalVector ( &bones[ *boneIndex ], *surfaceNormal , tmp );
1113+ TransformNormalVector ( &bones[ *boneIndex ], *vertexNormal , tmp );
11091114 VectorMA ( normal, *boneWeight, tmp, normal );
11101115
1111- TransformNormalVector ( &bones[ *boneIndex ], *surfaceTangent , tmp );
1116+ TransformNormalVector ( &bones[ *boneIndex ], *vertexTangent , tmp );
11121117 VectorMA ( tangent, *boneWeight, tmp, tangent );
11131118
1114- TransformNormalVector ( &bones[ *boneIndex ], *surfaceBinormal , tmp );
1119+ TransformNormalVector ( &bones[ *boneIndex ], *vertexBinormal , tmp );
11151120 VectorMA ( binormal, *boneWeight, tmp, binormal );
11161121 }
11171122
@@ -1122,8 +1127,10 @@ static void Tess_SurfaceMD5( md5Surface_t *srf )
11221127
11231128 R_TBNtoQtangentsFast ( tangent, binormal, normal, tessVertex->qtangents );
11241129
1125- Vector2Copy ( surfaceVertex->texCoords , tessVertex->texCoords );
1126- }
1130+ Vector2Copy ( vertex->texCoords , tessVertex->texCoords );
1131+ };
1132+
1133+ Omp::Tasker ( task, srf->numVerts );
11271134 }
11281135
11291136 tess.numIndexes += numIndexes;
0 commit comments