#include "cmdlib.h"
#include "mathlib.h"
#include "scriplib.h"
#include "polylib.h"
#include "imagelib.h"
#include "threads.h"
#include "bspfile.h"
#include "shaders.h"
#include "mesh.h"
Include dependency graph for qbsp.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
|
|
|
|
|
Definition at line 451 of file qbsp.h. Referenced by ParsePatch(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Definition at line 265 of file qbsp.h. Referenced by LoadMapFile(). |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Referenced by EmitLeaf(), FilterMapDrawSurfIntoTree(), FilterMapDrawSurfIntoTree_r(), and FilterSideIntoTree_r(). |
|
|
|
|
|
|
Referenced by AdjustBrushesForOrigin(), BeginModel(), MoveBrushesToWorld(), ParsePatch(), and PatchMapDrawSurfs(). |
|
|
|
|
|
|
|
|
|
|
|
Definition at line 428 of file misc_model.c. References _printf(), c_triangleIndexes, c_triangleModels, c_triangleSurfaces, c_triangleVertexes, entities, entity_num, FloatForKey(), GetVectorForKey(), InsertASEModel(), InsertMD3Model(), Q_stricmp(), qprintf(), strstr(), tree(), ValueForKey(), and vec3_t. Referenced by ProcessWorldModel(). 00428 {
00429 int entity_num;
00430 entity_t *entity;
00431
00432 qprintf("----- AddTriangleModels -----\n");
00433
00434 for ( entity_num=1 ; entity_num< num_entities ; entity_num++ ) {
00435 entity = &entities[entity_num];
00436
00437 // convert misc_models into raw geometry
00438 if ( !Q_stricmp( "misc_model", ValueForKey( entity, "classname" ) ) ) {
00439 const char *model;
00440 vec3_t origin;
00441 float angle;
00442
00443 // get the angle for rotation FIXME: support full matrix positioning
00444 angle = FloatForKey( entity, "angle" );
00445
00446 GetVectorForKey( entity, "origin", origin );
00447
00448 model = ValueForKey( entity, "model" );
00449 if ( !model[0] ) {
00450 _printf("WARNING: misc_model at %i %i %i without a model key\n", (int)origin[0],
00451 (int)origin[1], (int)origin[2] );
00452 continue;
00453 }
00454 if ( strstr( model, ".md3" ) || strstr( model, ".MD3" ) ) {
00455 InsertMD3Model( model, origin, angle, tree );
00456 continue;
00457 }
00458 if ( strstr( model, ".ase" ) || strstr( model, ".ASE" ) ) {
00459 InsertASEModel( model, origin, angle, tree );
00460 continue;
00461 }
00462 _printf( "Unknown misc_model type: %s\n", model );
00463 continue;
00464 }
00465 }
00466
00467 qprintf( "%5i triangle models\n", c_triangleModels );
00468 qprintf( "%5i triangle surfaces\n", c_triangleSurfaces );
00469 qprintf( "%5i triangle vertexes\n", c_triangleVertexes );
00470 qprintf( "%5i triangle indexes\n", c_triangleIndexes );
00471 }
|
Here is the call graph for this function:

|
|
Definition at line 328 of file lightmaps.c. References AllocateLightmapForSurface(), c_exactLightmap, e, Error(), entity_t::firstDrawSurf, i, j, LIGHTMAP_HEIGHT, LIGHTMAP_WIDTH, drawsurf_s::lightmapNum, drawsurf_s::lightmapVecs, mapDrawSurface_t, mapDrawSurfs, mapplanes, drawsurf_s::miscModel, drawsurf_s::nextOnShader, numLightmaps, numSortShaders, drawsurf_s::numVerts, drawsurf_s::patch, side_s::planenum, qprintf(), drawsurf_s::shaderInfo, shaderInfo_t, drawsurf_s::side, shaderInfo_s::surfaceFlags, surfsOnShader, and VectorCopy. Referenced by ProcessSubModel(), and ProcessWorldModel(). 00328 {
00329 int i, j;
00330 mapDrawSurface_t *ds;
00331 shaderInfo_t *si;
00332
00333 qprintf ("--- AllocateLightmaps ---\n");
00334
00335
00336 // sort all surfaces by shader so common shaders will usually
00337 // be in the same lightmap
00338 numSortShaders = 0;
00339
00340 for ( i = e->firstDrawSurf ; i < numMapDrawSurfs ; i++ ) {
00341 ds = &mapDrawSurfs[i];
00342 if ( !ds->numVerts ) {
00343 continue; // leftover from a surface subdivision
00344 }
00345 if ( ds->miscModel ) {
00346 continue;
00347 }
00348 if ( !ds->patch ) {
00349 VectorCopy( mapplanes[ds->side->planenum].normal, ds->lightmapVecs[2] );
00350 }
00351
00352 // search for this shader
00353 for ( j = 0 ; j < numSortShaders ; j++ ) {
00354 if ( ds->shaderInfo == surfsOnShader[j]->shaderInfo ) {
00355 ds->nextOnShader = surfsOnShader[j];
00356 surfsOnShader[j] = ds;
00357 break;
00358 }
00359 }
00360 if ( j == numSortShaders ) {
00361 if ( numSortShaders >= MAX_MAP_SHADERS ) {
00362 Error( "MAX_MAP_SHADERS" );
00363 }
00364 surfsOnShader[j] = ds;
00365 numSortShaders++;
00366 }
00367 }
00368 qprintf( "%5i unique shaders\n", numSortShaders );
00369
00370 // for each shader, allocate lightmaps for each surface
00371
00372 // numLightmaps = 0;
00373 // PrepareNewLightmap();
00374
00375 for ( i = 0 ; i < numSortShaders ; i++ ) {
00376 si = surfsOnShader[i]->shaderInfo;
00377
00378 for ( ds = surfsOnShader[i] ; ds ; ds = ds->nextOnShader ) {
00379 // some surfaces don't need lightmaps allocated for them
00380 if ( si->surfaceFlags & SURF_NOLIGHTMAP ) {
00381 ds->lightmapNum = -1;
00382 } else if ( si->surfaceFlags & SURF_POINTLIGHT ) {
00383 ds->lightmapNum = -3;
00384 } else {
00385 AllocateLightmapForSurface( ds );
00386 }
00387 }
00388 }
00389
00390 qprintf( "%7i exact lightmap texels\n", c_exactLightmap );
00391 qprintf( "%7i block lightmap texels\n", numLightmaps * LIGHTMAP_WIDTH*LIGHTMAP_HEIGHT );
00392 }
|
Here is the call graph for this function:

|
|
Definition at line 422 of file brushbsp.c. References bspbrush_t, c, c_active_brushes, c_brushmemory, c_peak_brushmemory, GetMemory(), malloc(), MemorySize(), memset(), and numthreads. Referenced by BrushFromBounds(), CopyBrush(), HL_SplitBrush(), LoadMapFile(), MakeBspBrushList(), Q1_SplitBrush(), SplitBrush(), and TryMergeBrushes(). 00423 {
00424 bspbrush_t *bb;
00425 int c;
00426
00427 c = (int)&(((bspbrush_t *)0)->sides[numsides]);
00428 bb = GetMemory(c);
00429 memset (bb, 0, c);
00430 if (numthreads == 1)
00431 {
00432 c_active_brushes++;
00433 c_brushmemory += MemorySize(bb);
00434 if (c_brushmemory > c_peak_brushmemory)
00435 c_peak_brushmemory = c_brushmemory;
00436 } //end if
00437 return bb;
00438 } //end of the function AllocBrush
|
Here is the call graph for this function:

|
|
Definition at line 42 of file surface.c. References Error(), mapDrawSurface_t, mapDrawSurfs, and numMapDrawSurfs. Referenced by CreateFlareSurface(), CreateTerrainSurface(), DrawSurfaceForMesh(), DrawSurfaceForSide(), InsertASEModel(), and InsertMD3Model(). 00042 {
00043 mapDrawSurface_t *ds;
00044
00045 if ( numMapDrawSurfs >= MAX_MAP_DRAW_SURFS ) {
00046 Error( "MAX_MAP_DRAW_SURFS");
00047 }
00048 ds = &mapDrawSurfs[ numMapDrawSurfs ];
00049 numMapDrawSurfs++;
00050
00051 return ds;
00052 }
|
Here is the call graph for this function:

|
|
Definition at line 404 of file brushbsp.c. References c_nodememory, GetMemory(), malloc(), MemorySize(), memset(), node_t, and numthreads. 00405 {
00406 node_t *node;
00407
00408 node = GetMemory(sizeof(*node));
00409 memset (node, 0, sizeof(*node));
00410 if (numthreads == 1)
00411 {
00412 c_nodememory += MemorySize(node);
00413 } //end if
00414 return node;
00415 } //end of the function AllocNode
|
Here is the call graph for this function:

|
|
Definition at line 546 of file brush.c. References ClearBounds(), malloc(), memset(), and tree(). Referenced by FaceBSP(), and ProcessSubModel(). 00547 {
00548 tree_t *tree;
00549
00550 tree = malloc(sizeof(*tree));
00551 memset (tree, 0, sizeof(*tree));
00552 ClearBounds (tree->mins, tree->maxs);
00553
00554 return tree;
00555 }
|
Here is the call graph for this function:

|
|
Definition at line 477 of file writebsp.c. References dleaf_t::contents, dleafs, numbrushsides, numedges, numfaces, numleafbrushes, numleaffaces, numleafs, numleafsurfaces, nummodels, numnodes, numsurfedges, and numvertexes. 00478 {
00479 // these values may actually be initialized
00480 // if the file existed when loaded, so clear them explicitly
00481 nummodels = 0;
00482 numfaces = 0;
00483 numnodes = 0;
00484 numbrushsides = 0;
00485 numvertexes = 0;
00486 numleaffaces = 0;
00487 numleafbrushes = 0;
00488 numsurfedges = 0;
00489
00490 // edge 0 is not used, because 0 can't be negated
00491 numedges = 1;
00492
00493 // leave vertex 0 as an error
00494 numvertexes = 1;
00495
00496 // leave leaf 0 as an error
00497 numleafs = 1;
00498 dleafs[0].contents = CONTENTS_SOLID;
00499 }
|
|
Here is the call graph for this function:

|
|
Definition at line 237 of file brushbsp.c. References AddPointToBounds(), bspbrush_t, ClearBounds(), i, j, MAX_WORLD_COORD, bspbrush_s::maxs, MIN_WORLD_COORD, bspbrush_s::mins, winding_t::numpoints, bspbrush_s::numsides, winding_t::p, qboolean, bspbrush_s::sides, w, and side_s::winding. Referenced by CheckBSPBrush(), CreateBrushWindings(), HL_SplitBrush(), Q1_SplitBrush(), SplitBrush(), and TryMergeBrushes(). 00238 {
00239 int i, j;
00240 winding_t *w;
00241
00242 ClearBounds (brush->mins, brush->maxs);
00243 for (i=0 ; i<brush->numsides ; i++)
00244 {
00245 w = brush->sides[i].winding;
00246 if (!w)
00247 continue;
00248 for (j=0 ; j<w->numpoints ; j++)
00249 AddPointToBounds (w->p[j], brush->mins, brush->maxs);
00250 }
00251 } //end of the function BoundBrush
|
Here is the call graph for this function:

|
||||||||||||||||
|
Definition at line 579 of file brushbsp.c. References plane_t::dist, plane_t::normal, p, and plane_t::type. Referenced by CM_BoxLeafnums_r(), QuickTestBrushToPlanenum(), R_BoxSurfaces_r(), R_RecursiveWorldNode(), and TestBrushToPlanenum(). 00580 {
00581 float dist1, dist2;
00582 int sides;
00583
00584 // axial planes are easy
00585 if (p->type < 3)
00586 {
00587 sides = 0;
00588 if (emaxs[p->type] > p->dist+PLANESIDE_EPSILON) sides |= PSIDE_FRONT;
00589 if (emins[p->type] < p->dist-PLANESIDE_EPSILON) sides |= PSIDE_BACK;
00590 return sides;
00591 } //end if
00592
00593 // general case
00594 switch (p->signbits)
00595 {
00596 case 0:
00597 dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
00598 dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
00599 break;
00600 case 1:
00601 dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
00602 dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
00603 break;
00604 case 2:
00605 dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
00606 dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
00607 break;
00608 case 3:
00609 dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
00610 dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
00611 break;
00612 case 4:
00613 dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
00614 dist2 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
00615 break;
00616 case 5:
00617 dist1 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emins[2];
00618 dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emaxs[2];
00619 break;
00620 case 6:
00621 dist1 = p->normal[0]*emaxs[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
00622 dist2 = p->normal[0]*emins[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
00623 break;
00624 case 7:
00625 dist1 = p->normal[0]*emins[0] + p->normal[1]*emins[1] + p->normal[2]*emins[2];
00626 dist2 = p->normal[0]*emaxs[0] + p->normal[1]*emaxs[1] + p->normal[2]*emaxs[2];
00627 break;
00628 default:
00629 dist1 = dist2 = 0; // shut up compiler
00630 // assert( 0 );
00631 break;
00632 }
00633
00634 sides = 0;
00635 if (dist1 - p->dist >= PLANESIDE_EPSILON) sides = PSIDE_FRONT;
00636 if (dist2 - p->dist < PLANESIDE_EPSILON) sides |= PSIDE_BACK;
00637
00638 // assert(sides != 0);
00639
00640 return sides;
00641 }
|
|
||||||||||||||||