Search
lxdream.org :: lxdream :: r1143:8ec0f1f990aa
lxdream 0.9.1
released Jun 29
Download Now
changeset1143:8ec0f1f990aa
parent1142:fd82bfba61c4
child1144:00dd49743974
authornkeynes
dateFri Oct 29 07:52:45 2010 +1000 (9 years ago)
Fix triangle extraction when the tile entry is a triangle but the polygon is
actually a strip (lead to extracting too many triangles)
src/pvr2/rendsort.c
1.1 --- a/src/pvr2/rendsort.c Tue Oct 26 18:41:01 2010 +1000
1.2 +++ b/src/pvr2/rendsort.c Fri Oct 29 07:52:45 2010 +1000
1.3 @@ -116,13 +116,29 @@
1.4 case 0x0E:
1.5 tile_list = (uint32_t *)(pvr2_main_ram + (entry&0x007FFFFF));
1.6 break;
1.7 - case 0x08: case 0x09: case 0x0A: case 0x0B:
1.8 + case 0x08: case 0x09:
1.9 strip_count = ((entry >> 25) & 0x0F)+1;
1.10 poly = pvr2_scene.buf_to_poly_map[entry&0x000FFFFF];
1.11 while( strip_count > 0 ) {
1.12 assert( poly != NULL );
1.13 - for( i=0; i+2<poly->vertex_count; i++ ) {
1.14 - /* Note: tris + quads can't have sub-polys */
1.15 + if( poly->vertex_count != 0 ) {
1.16 + /* Triangle could point to a strip, but we only want
1.17 + * the first one in this case
1.18 + */
1.19 + sort_add_triangle( &triangles[count], poly, 0 );
1.20 + count++;
1.21 + }
1.22 + poly = poly->next;
1.23 + strip_count--;
1.24 + }
1.25 + break;
1.26 + case 0x0A: case 0x0B:
1.27 + strip_count = ((entry >> 25) & 0x0F)+1;
1.28 + poly = pvr2_scene.buf_to_poly_map[entry&0x000FFFFF];
1.29 + while( strip_count > 0 ) {
1.30 + assert( poly != NULL );
1.31 + for( i=0; i+2<poly->vertex_count && i < 2; i++ ) {
1.32 + /* Note: quads can't have sub-polys */
1.33 sort_add_triangle( &triangles[count], poly, i );
1.34 count++;
1.35 }
.