- break;
-
- case SURFACE_PATCH:
- /* make a mesh from the drawsurf */
- srcMesh.width = src->patchWidth;
- srcMesh.height = src->patchHeight;
- srcMesh.verts = src->verts;
- subdivided = SubdivideMesh( srcMesh, 8, 512 );
-
- /* fit it to the curve and remove colinear verts on rows/columns */
- PutMeshOnCurve( *subdivided );
- mesh = RemoveLinearMeshColumnsRows( subdivided );
- FreeMesh( subdivided );
-
- /* get verts */
- verts = mesh->verts;
-
- /* map the mesh quads */
- 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;
-
- /* get drawverts and map first triangle */
- dv[ 0 ] = &verts[ pw[ r + 0 ] ];
- dv[ 1 ] = &verts[ pw[ r + 1 ] ];
- dv[ 2 ] = &verts[ pw[ r + 2 ] ];
- SubdivideFoliageTriangle_r( src, foliage, dv );
-
- /* get drawverts and map second triangle */
- dv[ 0 ] = &verts[ pw[ r + 0 ] ];
- dv[ 1 ] = &verts[ pw[ r + 2 ] ];
- dv[ 2 ] = &verts[ pw[ r + 3 ] ];
- SubdivideFoliageTriangle_r( src, foliage, dv );
- }
- }
-
- /* free the mesh */
- FreeMesh( mesh );
- break;
-
- default:
- break;