This is an automated email from the git hooks/post-receive script. smcv pushed a commit to annotated tag 1.42d in repository iortcw.
commit ec3318172a827f75c60940ed1a798273db5db72b Author: SmileTheory <smilethe...@gmail.com> Date: Mon Mar 16 22:19:24 2015 -0700 All: Make RB_SurfaceAnim() use glIndex_t for correct index size. This fixes buggy MDS model rendering on OpenGLES. --- MP/code/rend2/tr_animation.c | 18 +++++++----------- MP/code/renderer/tr_animation.c | 18 +++++++----------- SP/code/rend2/tr_animation.c | 18 +++++++----------- SP/code/renderer/tr_animation.c | 18 +++++++----------- 4 files changed, 28 insertions(+), 44 deletions(-) diff --git a/MP/code/rend2/tr_animation.c b/MP/code/rend2/tr_animation.c index 4a26f4e..d34bf65 100644 --- a/MP/code/rend2/tr_animation.c +++ b/MP/code/rend2/tr_animation.c @@ -49,7 +49,8 @@ frame. static float frontlerp, backlerp; static float torsoFrontlerp, torsoBacklerp; -static int *triangles, *boneRefs, *pIndexes; +static int *triangles, *boneRefs; +static glIndex_t *pIndexes; static int indexes; static int baseIndex, baseVertex, oldIndexes; static int numVerts; @@ -1112,18 +1113,13 @@ void RB_SurfaceAnim( mdsSurface_t *surface ) { tess.numVertexes += render_count; - pIndexes = (int*)&tess.indexes[baseIndex]; + pIndexes = (glIndex_t *)&tess.indexes[baseIndex]; //DBG_SHOWTIME if ( render_count == surface->numVerts ) { - memcpy( pIndexes, triangles, sizeof( triangles[0] ) * indexes ); - if ( baseVertex ) { - int *indexesEnd; - for ( indexesEnd = pIndexes + indexes ; pIndexes < indexesEnd ; pIndexes++ ) { - *pIndexes += baseVertex; - } - } + for ( j = 0; j < indexes; j++ ) + pIndexes[j] = triangles[j] + baseVertex; tess.numIndexes += indexes; } else { @@ -1243,7 +1239,7 @@ void RB_SurfaceAnim( mdsSurface_t *surface ) { qglBegin( GL_LINES ); qglColor3f( .0,.0,.8 ); - pIndexes = (int*)&tess.indexes[oldIndexes]; + pIndexes = (glIndex_t *)&tess.indexes[oldIndexes]; for ( j = 0; j < render_indexes / 3; j++, pIndexes += 3 ) { qglVertex3fv( tempVert + 4 * pIndexes[0] ); qglVertex3fv( tempVert + 4 * pIndexes[1] ); @@ -1694,7 +1690,7 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) oldFrame = (mdrFrame_t *)((byte *)header + header->ofsFrames + backEnd.currentEntity->e.oldframe * frameSize ); - RB_CheckOverflow( surface->numVerts, surface->numTriangles ); + RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 ); triangles = (int *) ((byte *)surface + surface->ofsTriangles); indexes = surface->numTriangles * 3; diff --git a/MP/code/renderer/tr_animation.c b/MP/code/renderer/tr_animation.c index 40bf2ec..f27549c 100644 --- a/MP/code/renderer/tr_animation.c +++ b/MP/code/renderer/tr_animation.c @@ -49,7 +49,8 @@ frame. static float frontlerp, backlerp; static float torsoFrontlerp, torsoBacklerp; -static int *triangles, *pIndexes; +static int *triangles; +static glIndex_t *pIndexes; #ifndef USE_OPENGLES static int *boneRefs; #endif @@ -1113,18 +1114,13 @@ void RB_SurfaceAnim( mdsSurface_t *surface ) { tess.numVertexes += render_count; - pIndexes = (int*)&tess.indexes[baseIndex]; + pIndexes = (glIndex_t *)&tess.indexes[baseIndex]; //DBG_SHOWTIME if ( render_count == surface->numVerts ) { - memcpy( pIndexes, triangles, sizeof( triangles[0] ) * indexes ); - if ( baseVertex ) { - int *indexesEnd; - for ( indexesEnd = pIndexes + indexes ; pIndexes < indexesEnd ; pIndexes++ ) { - *pIndexes += baseVertex; - } - } + for ( j = 0; j < indexes; j++ ) + pIndexes[j] = triangles[j] + baseVertex; tess.numIndexes += indexes; } else { @@ -1242,7 +1238,7 @@ void RB_SurfaceAnim( mdsSurface_t *surface ) { qglBegin( GL_LINES ); qglColor3f( .0,.0,.8 ); - pIndexes = (int*)&tess.indexes[oldIndexes]; + pIndexes = (glIndex_t *)&tess.indexes[oldIndexes]; for ( j = 0; j < render_indexes / 3; j++, pIndexes += 3 ) { qglVertex3fv( tempVert + 4 * pIndexes[0] ); qglVertex3fv( tempVert + 4 * pIndexes[1] ); @@ -1692,7 +1688,7 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) oldFrame = (mdrFrame_t *)((byte *)header + header->ofsFrames + backEnd.currentEntity->e.oldframe * frameSize ); - RB_CheckOverflow( surface->numVerts, surface->numTriangles ); + RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 ); triangles = (int *) ((byte *)surface + surface->ofsTriangles); indexes = surface->numTriangles * 3; diff --git a/SP/code/rend2/tr_animation.c b/SP/code/rend2/tr_animation.c index f2f777c..26b0afd 100644 --- a/SP/code/rend2/tr_animation.c +++ b/SP/code/rend2/tr_animation.c @@ -49,7 +49,8 @@ frame. static float frontlerp, backlerp; static float torsoFrontlerp, torsoBacklerp; -static int *triangles, *boneRefs, *pIndexes; +static int *triangles, *boneRefs; +static glIndex_t *pIndexes; static int indexes; static int baseIndex, baseVertex, oldIndexes; static int numVerts; @@ -1124,18 +1125,13 @@ void RB_SurfaceAnim( mdsSurface_t *surface ) { tess.numVertexes += render_count; - pIndexes = (int*)&tess.indexes[baseIndex]; + pIndexes = (glIndex_t *)&tess.indexes[baseIndex]; //DBG_SHOWTIME if ( render_count == surface->numVerts ) { - memcpy( pIndexes, triangles, sizeof( triangles[0] ) * indexes ); - if ( baseVertex ) { - int *indexesEnd; - for ( indexesEnd = pIndexes + indexes ; pIndexes < indexesEnd ; pIndexes++ ) { - *pIndexes += baseVertex; - } - } + for ( j = 0; j < indexes; j++ ) + pIndexes[j] = triangles[j] + baseVertex; tess.numIndexes += indexes; } else { @@ -1254,7 +1250,7 @@ void RB_SurfaceAnim( mdsSurface_t *surface ) { qglBegin( GL_LINES ); qglColor3f( .0,.0,.8 ); - pIndexes = (int*)&tess.indexes[oldIndexes]; + pIndexes = (glIndex_t *)&tess.indexes[oldIndexes]; for ( j = 0; j < render_indexes / 3; j++, pIndexes += 3 ) { qglVertex3fv( tempVert + 4 * pIndexes[0] ); qglVertex3fv( tempVert + 4 * pIndexes[1] ); @@ -1686,7 +1682,7 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) oldFrame = (mdrFrame_t *)((byte *)header + header->ofsFrames + backEnd.currentEntity->e.oldframe * frameSize ); - RB_CheckOverflow( surface->numVerts, surface->numTriangles ); + RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 ); triangles = (int *) ((byte *)surface + surface->ofsTriangles); indexes = surface->numTriangles * 3; diff --git a/SP/code/renderer/tr_animation.c b/SP/code/renderer/tr_animation.c index d1c2ef8..31d8565 100644 --- a/SP/code/renderer/tr_animation.c +++ b/SP/code/renderer/tr_animation.c @@ -49,7 +49,8 @@ frame. static float frontlerp, backlerp; static float torsoFrontlerp, torsoBacklerp; -static int *triangles, *pIndexes; +static int *triangles; +static glIndex_t *pIndexes; #ifndef USE_OPENGLES static int *boneRefs; #endif @@ -1125,18 +1126,13 @@ void RB_SurfaceAnim( mdsSurface_t *surface ) { tess.numVertexes += render_count; - pIndexes = (int*)&tess.indexes[baseIndex]; + pIndexes = (glIndex_t *)&tess.indexes[baseIndex]; //DBG_SHOWTIME if ( render_count == surface->numVerts ) { - memcpy( pIndexes, triangles, sizeof( triangles[0] ) * indexes ); - if ( baseVertex ) { - int *indexesEnd; - for ( indexesEnd = pIndexes + indexes ; pIndexes < indexesEnd ; pIndexes++ ) { - *pIndexes += baseVertex; - } - } + for ( j = 0; j < indexes; j++ ) + pIndexes[j] = triangles[j] + baseVertex; tess.numIndexes += indexes; } else { @@ -1253,7 +1249,7 @@ void RB_SurfaceAnim( mdsSurface_t *surface ) { qglBegin( GL_LINES ); qglColor3f( .0,.0,.8 ); - pIndexes = (int*)&tess.indexes[oldIndexes]; + pIndexes = (glIndex_t *)&tess.indexes[oldIndexes]; for ( j = 0; j < render_indexes / 3; j++, pIndexes += 3 ) { qglVertex3fv( tempVert + 4 * pIndexes[0] ); qglVertex3fv( tempVert + 4 * pIndexes[1] ); @@ -1682,7 +1678,7 @@ void RB_MDRSurfaceAnim( mdrSurface_t *surface ) oldFrame = (mdrFrame_t *)((byte *)header + header->ofsFrames + backEnd.currentEntity->e.oldframe * frameSize ); - RB_CheckOverflow( surface->numVerts, surface->numTriangles ); + RB_CheckOverflow( surface->numVerts, surface->numTriangles * 3 ); triangles = (int *) ((byte *)surface + surface->ofsTriangles); indexes = surface->numTriangles * 3; -- Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/iortcw.git _______________________________________________ Pkg-games-commits mailing list Pkg-games-commits@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/pkg-games-commits