Skip to content

Commit 0532337

Browse files
committed
tr_model_skel: parallel MD5 model loading
1 parent 864083b commit 0532337

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

src/engine/renderer/tr_model_skel.cpp

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
2222
*/
2323
// tr_models.c -- model loading and caching
2424
#include "tr_local.h"
25+
#include "framework/Omp.h"
2526
#include "GLUtils.h"
2627

2728
bool R_AddTriangleToVBOTriangleList(
@@ -154,24 +155,26 @@ srfVBOMD5Mesh_t *R_GenerateMD5VBOSurface(
154155
}
155156
}
156157

157-
for ( j = 0; j < vertexesNum; j++ )
158+
auto task = [&]( const size_t& i ) -> void
158159
{
159-
R_TBNtoQtangents( surf->verts[ j ].tangent, surf->verts[ j ].binormal,
160-
surf->verts[ j ].normal, qtangents[ j ] );
160+
R_TBNtoQtangents( surf->verts[ i ].tangent, surf->verts[ i ].binormal,
161+
surf->verts[ i ].normal, qtangents[ i ] );
161162

162163
for (unsigned k = 0; k < MAX_WEIGHTS; k++ )
163164
{
164-
if ( k < surf->verts[ j ].numWeights )
165+
if ( k < surf->verts[ i ].numWeights )
165166
{
166-
uint16_t boneIndex = vboSurf->boneRemap[ surf->verts[ j ].boneIndexes[ k ] ];
167-
boneFactors[ j ][ k ] = boneFactor( boneIndex, surf->verts[ j ].boneWeights[ k ] );
167+
uint16_t boneIndex = vboSurf->boneRemap[ surf->verts[ i ].boneIndexes[ k ] ];
168+
boneFactors[ i ][ k ] = boneFactor( boneIndex, surf->verts[ i ].boneWeights[ k ] );
168169
}
169170
else
170171
{
171-
boneFactors[ j ][ k ] = 0;
172+
boneFactors[ i ][ k ] = 0;
172173
}
173174
}
174-
}
175+
};
176+
177+
Omp::Tasker( task, vertexesNum );
175178

176179
// MD5 does not have color, but shaders always require the color vertex attribute, so we have
177180
// to provide this 0 color.

0 commit comments

Comments
 (0)