/* * @brief */ static void EmitFace(face_t *f) { d_bsp_face_t *df; int32_t i; int32_t e; f->output_number = -1; if (f->num_points < 3) { return; // degenerated } if (f->merged || f->split[0] || f->split[1]) { return; // not a final face } // save output number so leaffaces can use f->output_number = d_bsp.num_faces; if (d_bsp.num_faces >= MAX_BSP_FACES) Com_Error(ERR_FATAL, "MAX_BSP_FACES\n"); df = &d_bsp.faces[d_bsp.num_faces]; d_bsp.num_faces++; // plane_num is used by qlight, but not quake df->plane_num = f->plane_num & (~1); df->side = f->plane_num & 1; df->first_edge = d_bsp.num_face_edges; df->num_edges = f->num_points; df->texinfo = f->texinfo; for (i = 0; i < f->num_points; i++) { e = GetEdge2(f->vertexnums[i], f->vertexnums[(i + 1) % f->num_points], f); if (d_bsp.num_face_edges >= MAX_BSP_FACE_EDGES) Com_Error(ERR_FATAL, "MAX_BSP_FACE_EDGES\n"); d_bsp.face_edges[d_bsp.num_face_edges] = e; d_bsp.num_face_edges++; } df->light_ofs = -1; }
/* ================== EmitFace ================== */ void EmitFace (face_t *f) { dface_t *df; int i; int e; f->outputnumber = -1; if (f->numpoints < 3) { return; // degenerated } if (f->merged || f->split[0] || f->split[1]) { return; // not a final face } // save output number so leaffaces can use f->outputnumber = numfaces; if (numfaces >= MAX_MAP_FACES) Error ("numfaces == MAX_MAP_FACES"); df = &dfaces[numfaces]; numfaces++; // planenum is used by qlight, but not quake df->planenum = f->planenum & (~1); df->side = f->planenum & 1; df->firstedge = numsurfedges; df->numedges = f->numpoints; df->texinfo = f->texinfo; for (i=0 ; i<f->numpoints ; i++) { // e = GetEdge (f->pts[i], f->pts[(i+1)%f->numpoints], f); e = GetEdge2 (f->vertexnums[i], f->vertexnums[(i+1)%f->numpoints], f); if (numsurfedges >= MAX_MAP_SURFEDGES) Error ("numsurfedges == MAX_MAP_SURFEDGES"); dsurfedges[numsurfedges] = e; numsurfedges++; } }
/* ================== EmitFace ================== */ void EmitFace( face_t *f, qboolean onNode ) { dface_t *df; int i; int e; // void SubdivideFaceBySubdivSize( face_t *f ); // garymcthack // SubdivideFaceBySubdivSize( f ); // set initial output number f->outputnumber = -1; // degenerated if( f->numpoints < 3 ) return; // not a final face if( f->merged || f->split[0] || f->split[1] ) return; // don't emit NODRAW faces for runtime if ( texinfo[f->texinfo].flags & SURF_NODRAW ) { // keep NODRAW terrain surfaces though if ( f->dispinfo == -1 ) return; Warning("NODRAW on terrain surface!\n"); } // save output number so leaffaces can use f->outputnumber = numfaces; // // get the next available .bsp face slot // if (numfaces >= MAX_MAP_FACES) Error( "Too many faces in map, max = %d", MAX_MAP_FACES ); df = &dfaces[numfaces]; // Save the correlation between dfaces and faces -- since dfaces doesnt have worldcraft face id dfaceids.AddToTail(); dfaceids[numfaces].hammerfaceid = f->originalface->id; numfaces++; // // plane info - planenum is used by qlight, but not quake // df->planenum = f->planenum; df->onNode = onNode; df->side = f->planenum & 1; // // material info // df->texinfo = f->texinfo; df->dispinfo = f->dispinfo; df->smoothingGroups = f->smoothingGroups; // save the original "side"/face data df->origFace = FindOrCreateOrigFace( f ); df->surfaceFogVolumeID = -1; dfacenodes[numfaces-1] = f->fogVolumeLeaf; if ( f->fogVolumeLeaf ) { Assert( f->fogVolumeLeaf->planenum == PLANENUM_LEAF ); } // // edge info // df->firstedge = numsurfedges; df->numedges = f->numpoints; // UNDONE: Nodraw faces have no winding - revisit to see if this is necessary if ( f->w ) { df->area = WindingArea( f->w ); } else { df->area = 0; } df->firstPrimID = f->firstPrimID; df->SetNumPrims( f->numPrims ); df->SetDynamicShadowsEnabled( f->originalface->m_bDynamicShadowsEnabled ); // // save off points -- as edges // for( i = 0; i < f->numpoints; i++ ) { //e = GetEdge (f->pts[i], f->pts[(i+1)%f->numpoints], f); e = GetEdge2 (f->vertexnums[i], f->vertexnums[(i+1)%f->numpoints], f); if (numsurfedges >= MAX_MAP_SURFEDGES) Error( "Too much brush geometry in bsp, numsurfedges == MAX_MAP_SURFEDGES" ); dsurfedges[numsurfedges] = e; numsurfedges++; } // Create overlay face lists. side_t *pSide = f->originalface; if ( pSide ) { int nOverlayCount = pSide->aOverlayIds.Count(); if ( nOverlayCount > 0 ) { Overlay_AddFaceToLists( ( numfaces - 1 ), pSide ); } nOverlayCount = pSide->aWaterOverlayIds.Count(); if ( nOverlayCount > 0 ) { OverlayTransition_AddFaceToLists( ( numfaces - 1 ), pSide ); } } }