- /* handle patches */
- case MST_PATCH:
- /* subdivide the surface */
- srcMesh.width = ds->patchWidth;
- srcMesh.height = ds->patchHeight;
- srcMesh.verts = &bspDrawVerts[ ds->firstVert ];
- //% subdivided = SubdivideMesh( srcMesh, 8, 512 );
- subdivided = SubdivideMesh2( srcMesh, info->patchIterations );
-
- /* fit it to the curve and remove colinear verts on rows/columns */
- PutMeshOnCurve( *subdivided );
- mesh = RemoveLinearMeshColumnsRows( subdivided );
- FreeMesh( subdivided );
-
- /* set verts */
- verts = mesh->verts;
-
- /* subdivide each quad to place the models */
- for( y = 0; y < (mesh->height - 1); y++ )
- {
- for( x = 0; x < (mesh->width - 1); x++ )
- {
- /* set indexes */
- pw[ 0 ] = x + (y * mesh->width);
- pw[ 1 ] = x + ((y + 1) * mesh->width);
- pw[ 2 ] = x + 1 + ((y + 1) * mesh->width);
- pw[ 3 ] = x + 1 + (y * mesh->width);
- pw[ 4 ] = x + (y * mesh->width); /* same as pw[ 0 ] */
-
- /* set radix */
- r = (x + y) & 1;
-
- /* make first triangle */
- VectorCopy( verts[ pw[ r + 0 ] ].xyz, tw.v[ 0 ].xyz );
- Vector2Copy( verts[ pw[ r + 0 ] ].st, tw.v[ 0 ].st );
- VectorCopy( verts[ pw[ r + 1 ] ].xyz, tw.v[ 1 ].xyz );
- Vector2Copy( verts[ pw[ r + 1 ] ].st, tw.v[ 1 ].st );
- VectorCopy( verts[ pw[ r + 2 ] ].xyz, tw.v[ 2 ].xyz );
- Vector2Copy( verts[ pw[ r + 2 ] ].st, tw.v[ 2 ].st );
- m4x4_transform_point( transform, tw.v[ 0 ].xyz );
- m4x4_transform_point( transform, tw.v[ 1 ].xyz );
- m4x4_transform_point( transform, tw.v[ 2 ].xyz );
- FilterTraceWindingIntoNodes_r( &tw, nodeNum );
-
- /* make second triangle */
- VectorCopy( verts[ pw[ r + 0 ] ].xyz, tw.v[ 0 ].xyz );
- Vector2Copy( verts[ pw[ r + 0 ] ].st, tw.v[ 0 ].st );
- VectorCopy( verts[ pw[ r + 2 ] ].xyz, tw.v[ 1 ].xyz );
- Vector2Copy( verts[ pw[ r + 2 ] ].st, tw.v[ 1 ].st );
- VectorCopy( verts[ pw[ r + 3 ] ].xyz, tw.v[ 2 ].xyz );
- Vector2Copy( verts[ pw[ r + 3 ] ].st, tw.v[ 2 ].st );
- m4x4_transform_point( transform, tw.v[ 0 ].xyz );
- m4x4_transform_point( transform, tw.v[ 1 ].xyz );
- m4x4_transform_point( transform, tw.v[ 2 ].xyz );
- FilterTraceWindingIntoNodes_r( &tw, nodeNum );
- }
- }
-
- /* free the subdivided mesh */
- FreeMesh( mesh );
- break;
-
- /* handle triangle surfaces */
- case MST_TRIANGLE_SOUP:
- case MST_PLANAR:
- /* set verts and indexes */
- verts = &bspDrawVerts[ ds->firstVert ];
- indexes = &bspDrawIndexes[ ds->firstIndex ];
-
- /* walk the triangle list */
- for( j = 0; j < ds->numIndexes; j += 3 )
+ /* handle patches */
+ case MST_PATCH:
+ /* subdivide the surface */
+ srcMesh.width = ds->patchWidth;
+ srcMesh.height = ds->patchHeight;
+ srcMesh.verts = &bspDrawVerts[ ds->firstVert ];
+ //% subdivided = SubdivideMesh( srcMesh, 8, 512 );
+ subdivided = SubdivideMesh2( srcMesh, info->patchIterations );
+
+ /* fit it to the curve and remove colinear verts on rows/columns */
+ PutMeshOnCurve( *subdivided );
+ mesh = RemoveLinearMeshColumnsRows( subdivided );
+ FreeMesh( subdivided );
+
+ /* set verts */
+ verts = mesh->verts;
+
+ /* subdivide each quad to place the models */
+ for ( y = 0; y < ( mesh->height - 1 ); y++ )
+ {
+ for ( x = 0; x < ( mesh->width - 1 ); x++ )