/* ============ ProcessModels ============ */ void ProcessModels (void) { qboolean oldVerbose; entity_t *entity; oldVerbose = verbose; BeginBSPFile (); for ( entity_num=0 ; entity_num< num_entities ; entity_num++ ) { entity = &entities[entity_num]; if ( !entity->brushes && !entity->patches ) { continue; } qprintf ("############### model %i ###############\n", nummodels); if (entity_num == 0) ProcessWorldModel (); else ProcessSubModel (); if (!verboseentities) verbose = qfalse; // don't bother printing submodels } verbose = oldVerbose; }
/* ================= ProcessFile ================= */ void ProcessFile (char *sourcebase, char *filename_bsp1) { if (!onlyents) { remove (filename_bsp); remove (filename_prt); remove (filename_pts); remove (filename_lin); remove (filename_lit); remove (filename_dlit); remove (filename_lights); } // load brushes and entities LoadMapFile (sourcebase); if (onlyents) { LoadBSPFile (filename_bsp); UpdateEntLump (); WriteBSPFile (filename_bsp, false); return; } // init the tables to be shared by all models BeginBSPFile (); // the clipping hulls will be written out to text files by forked processes CreateHulls (); UpdateEntLump (); WriteMiptex (); FinishBSPFile (); }
/* ============ ProcessModels ============ */ void ProcessModels(void) { int i; entity_t *entity; const char *classname; const char *model; BeginBSPFile(); for(i = 0; i < numEntities; i++) { entity = &entities[i]; classname = ValueForKey(entity, "classname"); model = ValueForKey(entity, "model"); if(entity->brushes || entity->patches || (!entity->brushes && !entity->patches && model[0] != '\0' && Q_stricmp("misc_model", classname))) { Sys_FPrintf(SYS_VRB, "############### model %i ###############\n", numModels); if(i == 0) ProcessWorldModel(); else ProcessSubModel(i); } } }
/* ================= ProcessFile ================= */ void ProcessFile (char *sourcebase, char *bspfilename1) { // create filenames strcpy (bspfilename, bspfilename1); StripExtension (bspfilename); strcat (bspfilename, ".bsp"); strcpy (hullfilename, bspfilename1); StripExtension (hullfilename); strcat (hullfilename, ".h0"); strcpy (portfilename, bspfilename1); StripExtension (portfilename); strcat (portfilename, ".prt"); strcpy (pointfilename, bspfilename1); StripExtension (pointfilename); strcat (pointfilename, ".pts"); if (!onlyents) { remove (bspfilename); if (!usehulls) { hullfilename[strlen(hullfilename)-1] = '1'; remove (hullfilename); hullfilename[strlen(hullfilename)-1] = '2'; remove (hullfilename); } remove (portfilename); remove (pointfilename); } // load brushes and entities LoadMapFile (sourcebase); if (onlyents) { UpdateEntLump (); return; } // init the tables to be shared by all models BeginBSPFile (); // the clipping hulls will be written out to text files by forked processes CreateHulls (); ReadClipHull (1); ReadClipHull (2); WriteEntitiesToString(); FinishBSPFile (); }
void ProcessModels( void ){ qboolean oldVerbose; entity_t *entity; /* preserve -v setting */ oldVerbose = verbose; /* start a new bsp */ BeginBSPFile(); /* create map fogs */ CreateMapFogs(); /* walk entity list */ for ( mapEntityNum = 0; mapEntityNum < numEntities; mapEntityNum++ ) { /* get entity */ entity = &entities[ mapEntityNum ]; if ( entity->brushes == NULL && entity->patches == NULL ) { continue; } /* process the model */ Sys_FPrintf( SYS_VRB, "############### model %i ###############\n", numBSPModels ); if ( mapEntityNum == 0 ) { ProcessWorldModel(); } else{ ProcessSubModel(); } /* potentially turn off the deluge of text */ verbose = verboseEntities; } /* restore -v setting */ verbose = oldVerbose; /* write fogs */ EmitFogs(); /* vortex: emit meta stats */ EmitMetaStats(); }
/* ============ ProcessModels ============ */ void ProcessModels (void) { BeginBSPFile (); // Mark sides that have no dynamic shadows. MarkNoDynamicShadowSides(); // emit the displacement surfaces EmitInitialDispInfos(); // Clip occluder brushes against each other, // Remove them from the list of models to process below EmitOccluderBrushes( ); for ( entity_num=0; entity_num < num_entities; ++entity_num ) { entity_t *pEntity = &entities[entity_num]; if ( !pEntity->numbrushes ) continue; qprintf ("############### model %i ###############\n", nummodels); BeginModel (); if (entity_num == 0) { ProcessWorldModel(); } else { ProcessSubModel( ); } EndModel (); if (!verboseentities) { verbose = false; // don't bother printing submodels } } // Turn the skybox into a cubemap in case we don't build env_cubemap textures. Cubemap_CreateDefaultCubemaps(); EndBSPFile (); }
/* * @brief */ static void ProcessModels(void) { BeginBSPFile(); for (entity_num = 0; entity_num < num_entities; entity_num++) { if (!entities[entity_num].num_brushes) continue; Com_Verbose("############### model %i ###############\n", d_bsp.num_models); BeginModel(); if (entity_num == 0) ProcessWorldModel(); else ProcessSubModel(); EndModel(); } EndBSPFile(); }
/* ============ ProcessModels ============ */ void ProcessModels (void) { BeginBSPFile (); for (entity_num=0 ; entity_num< num_entities ; entity_num++) { if (!entities[entity_num].numbrushes) continue; qprintf ("############### model %i ###############\n", nummodels); BeginModel (); if (entity_num == 0) ProcessWorldModel (); else ProcessSubModel (); EndModel (); if (!verboseentities) verbose = false; // don't bother printing submodels } EndBSPFile (); }
/** * @sa ProcessWorldModel * @sa ProcessSubModel */ void ProcessModels (const char* filename) { int entity_num; BeginBSPFile(); for (entity_num = 0; entity_num < num_entities; entity_num++) { if (!entities[entity_num].numbrushes) continue; Verb_Printf(VERB_EXTRA, "############### model %i ###############\n", curTile->nummodels); if (entity_num == 0) ProcessWorldModel(entity_num); else ProcessSubModel(entity_num); if (!config.verboseentities) config.verbose = false; /* don't bother printing submodels */ } EndBSPFile(filename); }
/* ================= ProcessFile ================= */ static void ProcessFile (char *sourcebase, char *bspfilename1) { int i; // FILE *FH; // char radfilename[1024]; // create filenames strcpy (bspfilename, bspfilename1); StripExtension (bspfilename); strcat (bspfilename, ".bsp"); strcpy (hullfilename, bspfilename1); StripExtension (hullfilename); strcat (hullfilename, ".h0"); strcpy (portfilename, bspfilename1); StripExtension (portfilename); strcat (portfilename, ".prt"); strcpy (pointfilename, bspfilename1); StripExtension (pointfilename); strcat (pointfilename, ".pts"); if (!onlyents) { remove (bspfilename); if (!usehulls && hullnum == 0) { hullfilename[strlen(hullfilename)-1] = '1'; remove (hullfilename); hullfilename[strlen(hullfilename)-1] = '2'; remove (hullfilename); hullfilename[strlen(hullfilename)-1] = '3'; remove (hullfilename); hullfilename[strlen(hullfilename)-1] = '4'; remove (hullfilename); hullfilename[strlen(hullfilename)-1] = '5'; remove (hullfilename); } remove (portfilename); remove (pointfilename); } // load brushes and entities LoadMapFile (sourcebase); if (onlyents) { UpdateEntLump (); return; } // init the tables to be shared by all models BeginBSPFile (); for (i = 0 ; i < MAX_MAP_CLIPNODES ; i++) LightValues[i] = -2; // the clipping hulls will be written out to text files by forked processes CreateHulls (); ReadClipHull (1); ReadClipHull (2); ReadClipHull (3); ReadClipHull (4); ReadClipHull (5); WriteEntitiesToString(); FinishBSPFile (); /* strcpy (radfilename, bspfilename1); StripExtension (radfilename); strcat (radfilename, ".rad"); FH = fopen(radfilename,"w"); for (i = 0 ; i < numfaces ; i++) fprintf(FH,"%d\n",LightValues[i]); fclose(FH); */ }
/* PseudoCompileBSP() a stripped down ProcessModels */ void PseudoCompileBSP( qboolean need_tree, const char *BSPFilePath, const char *surfaceFilePath ){ int models; char modelValue[10]; entity_t *entity; face_t *faces; tree_t *tree; node_t *node; brush_t *brush; side_t *side; int i; SetDrawSurfacesBuffer(); mapDrawSurfs = safe_malloc( sizeof( mapDrawSurface_t ) * MAX_MAP_DRAW_SURFS ); memset( mapDrawSurfs, 0, sizeof( mapDrawSurface_t ) * MAX_MAP_DRAW_SURFS ); numMapDrawSurfs = 0; BeginBSPFile(); models = 1; for ( mapEntityNum = 0; mapEntityNum < numEntities; mapEntityNum++ ) { /* get entity */ entity = &entities[ mapEntityNum ]; if ( entity->brushes == NULL && entity->patches == NULL ) { continue; } if ( mapEntityNum != 0 ) { sprintf( modelValue, "*%d", models++ ); SetKeyValue( entity, "model", modelValue ); } /* process the model */ Sys_FPrintf( SYS_VRB, "############### model %i ###############\n", numBSPModels ); BeginModel(); entity->firstDrawSurf = numMapDrawSurfs; ClearMetaTriangles(); PatchMapDrawSurfs( entity ); if ( mapEntityNum == 0 && need_tree ) { faces = MakeStructuralBSPFaceList( entities[0].brushes ); tree = FaceBSP( faces ); node = tree->headnode; } else { node = AllocNode(); node->planenum = PLANENUM_LEAF; tree = AllocTree(); tree->headnode = node; } /* a minimized ClipSidesIntoTree */ for ( brush = entity->brushes; brush; brush = brush->next ) { /* walk the brush sides */ for ( i = 0; i < brush->numsides; i++ ) { /* get side */ side = &brush->sides[ i ]; if ( side->winding == NULL ) { continue; } /* shader? */ if ( side->shaderInfo == NULL ) { continue; } /* save this winding as a visible surface */ DrawSurfaceForSide( entity, brush, side, side->winding ); } } if ( meta ) { ClassifyEntitySurfaces( entity ); MakeEntityDecals( entity ); MakeEntityMetaTriangles( entity ); SmoothMetaTriangles(); MergeMetaTriangles(); } FilterDrawsurfsIntoTree( entity, tree ); FilterStructuralBrushesIntoTree( entity, tree ); FilterDetailBrushesIntoTree( entity, tree ); EmitBrushes( entity->brushes, &entity->firstBrush, &entity->numBrushes ); EndModel( entity, node ); } EndBSPFile( qfalse, BSPFilePath, surfaceFilePath ); }