static void EmitFaceVertexes (node_t* node, face_t* f) { if (f->merged || f->split[0] || f->split[1]) return; winding_t* w = f->w; for (int i = 0; i < w->numpoints; i++) { /* make every point unique */ if (config.noweld) { if (curTile->numvertexes == MAX_MAP_VERTS) Sys_Error("MAX_MAP_VERTS (%i)", curTile->numvertexes); superverts[i] = curTile->numvertexes; VectorCopy(w->p[i], curTile->vertexes[curTile->numvertexes].point); curTile->numvertexes++; curTile->numnormals++; c_uniqueverts++; c_totalverts++; } else superverts[i] = GetVertexnum(w->p[i]); } numsuperverts = w->numpoints; /* this may fragment the face if > MAXEDGES */ FaceFromSuperverts(node, f, 0); }
//----------------------------------------------------------------------------- //----------------------------------------------------------------------------- int CreateOrigFace( face_t *f ) { int i, j; dface_t *of; side_t *side; int vIndices[128]; int eIndex[2]; winding_t *pWinding; // not a real face! if( !f->w ) return -1; // get the original face -- the "side" side = f->originalface; // get the original face winding if( !side->winding ) { return -1; } // // get the next original face // if( numorigfaces >= MAX_MAP_FACES ) Error( "Too many faces in map, max = %d", MAX_MAP_FACES ); of = &dorigfaces[numorigfaces]; numorigfaces++; // set original face to -1 -- it is an origianl face! of->origFace = -1; // // add side to plane list // side->next = pOrigFaceSideList[f->planenum]; pOrigFaceSideList[f->planenum] = side; side->origIndex = numorigfaces - 1; pWinding = CopyWinding( side->winding ); // // plane info // of->planenum = side->planenum; if ( side->contents & CONTENTS_DETAIL ) of->onNode = 0; else of->onNode = 1; of->side = side->planenum & 1; // // edge info // of->firstedge = numsurfedges; of->numedges = side->winding->numpoints; // // material info // of->texinfo = side->texinfo; of->dispinfo = f->dispinfo; // // save the vertices // for( i = 0; i < pWinding->numpoints; i++ ) { // // compare vertices // vIndices[i] = GetVertexnum( pWinding->p[i] ); } // // save off points -- as edges // for( i = 0; i < pWinding->numpoints; i++ ) { // // look for matching edges first // eIndex[0] = vIndices[i]; eIndex[1] = vIndices[(i+1)%pWinding->numpoints]; for( j = firstmodeledge; j < numedges; j++ ) { if( ( eIndex[0] == dedges[j].v[1] ) && ( eIndex[1] == dedges[j].v[0] ) && ( edgefaces[j][0]->contents == f->contents ) ) { // check for multiple backward edges!! -- shouldn't have if( edgefaces[j][1] ) continue; // set back edge edgefaces[j][1] = f; // // get next surface edge // if( numsurfedges >= MAX_MAP_SURFEDGES ) Error( "Too much brush geometry in bsp, numsurfedges == MAX_MAP_SURFEDGES" ); dsurfedges[numsurfedges] = -j; numsurfedges++; break; } } if( j == numedges ) { // // get next edge // AddEdge( eIndex[0], eIndex[1], f ); // // get next surface edge // if( numsurfedges >= MAX_MAP_SURFEDGES ) Error( "Too much brush geometry in bsp, numsurfedges == MAX_MAP_SURFEDGES" ); dsurfedges[numsurfedges] = ( numedges - 1 ); numsurfedges++; } } // return the index return ( numorigfaces - 1 ); }