|
UFO: Alien Invasion
|
brush model loading More...
#include "r_local.h"#include "r_lightmap.h"#include "../../shared/parse.h"#include "r_light.h"#include "r_grass.h"
Go to the source code of this file.
Functions | |
| static void | R_ModLoadLighting (const lump_t *l) |
| Load the lightmap data. | |
| static void | R_ModLoadVertexes (const lump_t *l) |
| static void | R_ModLoadNormals (const lump_t *l) |
| static float | R_RadiusFromBounds (const vec3_t mins, const vec3_t maxs) |
| static void | R_ModLoadSubmodels (const lump_t *l) |
| Loads brush entities like func_door and func_breakable. | |
| static void | R_ModLoadEdges (const lump_t *l) |
| static void | R_ModLoadTexinfo (const char *mapZone, const lump_t *l) |
| static void | R_SetSurfaceExtents (mBspSurface_t *surf, const model_t *mod) |
| Fills in s->stmins[] and s->stmaxs[]. | |
| static void | R_ModLoadSurfaces (bool day, const lump_t *l) |
| static void | R_ModLoadNodes (const lump_t *l) |
| static void | R_ModLoadLeafs (const lump_t *l) |
| static void | R_ModLoadSurfedges (const lump_t *l) |
| static void | R_ModLoadPlanes (const lump_t *l) |
| static void | R_ModShiftTile (void) |
| Shift the verts for map assemblies. | |
| static void | R_LoadBspVertexArrays (model_t *mod) |
| Puts the map data into buffers. | |
| static void | R_SortSurfacesArrays_ (mBspSurfaces_t *surfs, mBspSurfaces_t **r_sorted_surfaces) |
| static void | R_SortSurfacesArrays (const model_t *mod) |
| Reorders all surfaces arrays for the specified model, grouping the surface pointers by texture. This dramatically reduces glBindTexture calls. | |
| static void | R_LoadSurfacesArrays_ (model_t *mod) |
| static void | R_LoadSurfacesArrays (void) |
| static void | R_GenerateTriangleSoup_ (model_t *mod) |
| static void | R_GenerateTriangleSoup () |
| static void | R_SetModel (mBspNode_t *node, model_t *mod) |
| static void | R_RecursiveSetModel (mBspNode_t *node, model_t *mod) |
| static void | R_SetupSubmodels (void) |
| Sets up bmodels (brush models) like doors and breakable objects. | |
| static void | R_SetupWorldModel (void) |
| Sets up surface range for the world model. | |
| static void | R_ModAddMapTile (const char *name, const char *mapZone, bool day, int sX, int sY, int sZ) |
| static void | R_ModEndLoading (const char *mapName) |
| void | R_ModBeginLoading (const char *tiles, bool day, const char *pos, const char *mapName, const char *mapZone) |
| Specifies the model that will be used as the world. | |
| void | R_ModReloadSurfacesArrays (void) |
Variables | |
| static const byte * | mod_base |
| The model base pointer - bases for the lump offsets. | |
| static ipos3_t | shift |
| The shift array is used for random map assemblies (RMA) to shift the mins/maxs and stuff like that. | |
| static model_t * | r_worldmodel |
| The currently loaded world model for the actual tile. | |
| static int | totalBspTriangles |
brush model loading
Definition in file r_model_brush.cpp.
|
static |
Definition at line 846 of file r_model_brush.cpp.
References Com_Printf(), i, mBspModel_t::index_buffer, mBspModel_t::indexes, mBspModel_t::numIndexes, R_GenerateTriangleSoup_(), r_mapTiles, r_modelsInline, r_numMapTiles, r_numModelsInline, and totalBspTriangles.
Referenced by R_ModEndLoading().
< owns vertex arrays
Definition at line 805 of file r_model_brush.cpp.
References model_t::bsp, Com_DPrintf(), mBspSurfaces_t::count, DEBUG_RENDERER, mBspModel_t::firstmodelsurface, mBspSurface_t::firstTriangle, i, mBspSurface_t::index, mBspModel_t::indexes, mBspModel_t::maptile, NUM_SURFACES_ARRAYS, mBspSurface_t::numedges, mBspModel_t::numIndexes, mBspModel_t::nummodelsurfaces, mBspSurface_t::numTriangles, r_mapTiles, mBspModel_t::sorted_surfaces, mBspSurfaces_t::surfaces, and totalBspTriangles.
Referenced by R_GenerateTriangleSoup().
Puts the map data into buffers.
Don't use the buffers from r_state here - they might overflow
Decrease MAX_GL_ARRAY_LENGTH to 32768 again when this is fixed
Definition at line 493 of file r_model_brush.cpp.
References model_t::bsp, DotProduct, mBspModel_t::edges, mBspSurface_t::firstedge, mBspSurface_t::firstTriangle, mBspSurface_t::flags, mBspTexInfo_t::flags, image_t::height, i, mBspTexInfo_t::image, index, mBspSurface_t::index, mBspModel_t::indexes, mBspSurface_t::isOriginBrushModel, mBspSurface_t::light_s, mBspSurface_t::light_t, mBspSurface_t::lightmap_scale, mBspModel_t::lmtexcoord_buffer, mBspModel_t::lmtexcoords, Mem_PoolAllocTypeN, MSURF_LIGHTMAP, mBspSurface_t::normal, mBspVertex_t::normal, mBspModel_t::normal_buffer, mBspModel_t::normals, mBspSurface_t::numedges, mBspModel_t::numsurfaces, mBspVertex_t::position, r_lightmaps, R_ReallocateStateArrays(), shift, mBspSurface_t::stmins, SURF_PHONG, mBspModel_t::surfaces, mBspModel_t::surfedges, mBspModel_t::tangent_buffer, mBspModel_t::tangents, TangentVectors(), mBspModel_t::texcoord_buffer, mBspModel_t::texcoords, mBspSurface_t::texinfo, mBspTexInfo_t::u_offset, mBspTexInfo_t::uv, mBspEdge_t::v, mBspTexInfo_t::v_offset, VectorAdd, VectorCopy, VectorNotEmpty, mBspModel_t::vertex_buffer, mBspModel_t::vertexes, mBspModel_t::verts, vid_modelPool, mBspTexInfo_t::vv, and image_t::width.
Referenced by R_ModAddMapTile().
Definition at line 792 of file r_model_brush.cpp.
References i, R_LoadSurfacesArrays_(), r_mapTiles, r_modelsInline, r_numMapTiles, and r_numModelsInline.
Referenced by R_ModEndLoading(), and R_ModReloadSurfacesArrays().
Definition at line 713 of file r_model_brush.cpp.
References model_t::bsp, mBspSurfaces_t::count, mBspModel_t::firstmodelsurface, material_t::flags, mBspTexInfo_t::flags, i, mBspTexInfo_t::image, image_t::material, Mem_PoolAllocType, Mem_PoolAllocTypeN, NUM_SURFACES_ARRAYS, mBspModel_t::nummodelsurfaces, R_AddSurfaceToArray, R_SortSurfacesArrays(), mBspModel_t::sorted_surfaces, STAGE_FLARE, STAGE_RENDER, SURF_ALPHATEST, SURF_BLEND33, SURF_BLEND66, SURF_WARP, mBspModel_t::surfaces, mBspSurfaces_t::surfaces, mBspSurface_t::texinfo, and vid_modelPool.
Referenced by R_LoadSurfacesArrays().
|
static |
| [in] | name | The name of the map. Relative to maps/ and without extension |
| [in] | mapZone | The terrain type for texture replacement |
| [in] | day | Load the day lightmap |
| [in] | sX | Shift x grid units |
| [in] | sY | Shift y grid units |
| [in] | sZ | Shift z grid units |
Definition at line 1005 of file r_model_brush.cpp.
References BSP_SwapHeader, BSPVERSION, Com_Error(), Com_sprintf(), ERR_DROP, FS_FreeFile(), FS_LoadFile(), i, LittleLong, LUMP_EDGES, LUMP_FACES, LUMP_LEAFS, LUMP_LIGHTING_DAY, LUMP_LIGHTING_NIGHT, LUMP_MODELS, LUMP_NODES, LUMP_NORMALS, LUMP_PLANES, LUMP_SURFEDGES, LUMP_TEXINFO, LUMP_VERTEXES, dBspHeader_t::lumps, mod_base, mod_bsp, name, OBJZERO, R_AllocModelSlot(), R_LoadBspVertexArrays(), r_mapTiles, R_ModLoadEdges(), R_ModLoadLeafs(), R_ModLoadLighting(), R_ModLoadNodes(), R_ModLoadNormals(), R_ModLoadPlanes(), R_ModLoadSubmodels(), R_ModLoadSurfaces(), R_ModLoadSurfedges(), R_ModLoadTexinfo(), R_ModLoadVertexes(), R_ModShiftTile(), r_numMapTiles, R_SetupSubmodels(), R_SetupWorldModel(), r_worldmodel, shift, UNIT_SIZE, VectorNotEmpty, VectorSet, and dBspHeader_t::version.
Referenced by R_ModBeginLoading().
| void R_ModBeginLoading | ( | const char * | tiles, |
| bool | day, | ||
| const char * | pos, | ||
| const char * | mapName, | ||
| const char * | mapZone ) |
Specifies the model that will be used as the world.
| [in] | tiles | The tiles string can be only one map or a list of space seperated map tiles for random assembly. In case of random assembly we also need the pos string. Every tile needs an entry in the pos string, too. |
| [in] | day | Load the day lightmap |
| [in] | pos | In case of a random map assembly this is the string that holds the world grid positions of the tiles. The positions are x, y and z values. They are just written one after another for every tile in the tiles string and every of the three components must exists for every tile. |
| [in] | mapName | The mapname that the get from the server (used to identify the correct name for the materials in case of a random assembly). |
| [in] | mapZone | The terrain type for texture replacement |
CM_LoadMap code only loads the collision and pathfinding stuff. Definition at line 1098 of file r_model_brush.cpp.
References Com_Error(), Com_Parse(), Com_sprintf(), ERR_DROP, i, mapName, MAX_QPATH, MAX_VAR, name, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, Q_strncpyz(), R_BeginBuildingLightmaps(), R_ClearGrass(), R_ClearStaticLights(), R_ModAddMapTile(), R_ModEndLoading(), r_numMapTiles, and r_numModelsInline.
Referenced by CL_ViewLoadMedia().
|
static |
Definition at line 1069 of file r_model_brush.cpp.
References mapName, R_EndBuildingLightmaps(), R_GenerateGrass(), R_GenerateTriangleSoup(), R_LoadMaterials(), and R_LoadSurfacesArrays().
Referenced by R_ModBeginLoading().
Definition at line 151 of file r_model_brush.cpp.
References Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleShort, Mem_PoolAllocTypeN, mod_base, r_worldmodel, dBspEdge_t::v, mBspEdge_t::v, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 392 of file r_model_brush.cpp.
References Com_DPrintf(), Com_Error(), dBspLeaf_t::contentFlags, mBspLeaf_t::contents, count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleLong, LittleShort, AABB::maxs, dBspLeaf_t::maxs, Mem_PoolAllocTypeN, mBspLeaf_t::minmaxs, AABB::mins, dBspLeaf_t::mins, mod_base, r_worldmodel, shift, and vid_modelPool.
Referenced by R_ModAddMapTile().
Load the lightmap data.
Definition at line 56 of file r_model_brush.cpp.
References lump_t::filelen, lump_t::fileofs, Mem_PoolAllocTypeN, mod_base, r_worldmodel, and vid_lightPool.
Referenced by R_ModAddMapTile().
Definition at line 338 of file r_model_brush.cpp.
References dBspNode_t::children, mBspNode_t::children, Com_DPrintf(), Com_Error(), mBspNode_t::contents, CONTENTS_NODE, CONTENTS_PATHFINDING_NODE, count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, dBspNode_t::firstface, mBspNode_t::firstsurface, i, LEAFNODE, LittleLong, LittleShort, AABB::maxs, dBspNode_t::maxs, Mem_PoolAllocTypeN, mBspNode_t::minmaxs, AABB::mins, dBspNode_t::mins, mod_base, dBspNode_t::numfaces, mBspNode_t::numsurfaces, mBspNode_t::plane, dBspNode_t::planenum, PLANENUM_LEAF, r_worldmodel, shift, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 87 of file r_model_brush.cpp.
References Com_Error(), count, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleFloat, mod_base, dBspNormal_t::normal, mBspVertex_t::normal, and r_worldmodel.
Referenced by R_ModAddMapTile().
Definition at line 437 of file r_model_brush.cpp.
References Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, cBspPlane_t::dist, dBspPlane_t::dist, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleFloat, LittleLong, Mem_PoolAllocTypeN, mod_base, cBspPlane_t::normal, dBspPlane_t::normal, r_worldmodel, cBspPlane_t::type, dBspPlane_t::type, and vid_modelPool.
Referenced by R_ModAddMapTile().
Loads brush entities like func_door and func_breakable.
Definition at line 124 of file r_model_brush.cpp.
References Com_DPrintf(), Com_Error(), count, dBspModel_t::dbmBox, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, dBspModel_t::firstface, mBspHeader_t::firstface, mBspHeader_t::hBox, dBspModel_t::headnode, mBspHeader_t::headnode, i, LittleFloat, LittleLong, AABB::maxs, Mem_PoolAllocTypeN, AABB::mins, mod_base, dBspModel_t::numfaces, mBspHeader_t::numfaces, dBspModel_t::origin, mBspHeader_t::origin, R_RadiusFromBounds(), r_worldmodel, mBspHeader_t::radius, shift, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 269 of file r_model_brush.cpp.
References Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, dBspSurface_t::firstedge, mBspSurface_t::firstedge, mBspSurface_t::flags, mBspTexInfo_t::flags, i, LIGHTMAP_DAY, LIGHTMAP_NIGHT, mBspSurface_t::lightmap_scale, dBspSurface_t::lightofs, LittleLong, LittleShort, Mem_PoolAllocTypeN, mod_base, MSURF_LIGHTMAP, MSURF_PLANEBACK, cBspPlane_t::normal, mBspSurface_t::normal, dBspSurface_t::numedges, mBspSurface_t::numedges, mBspSurface_t::plane, dBspSurface_t::planenum, R_CreateSurfaceLightmap(), r_numMapTiles, R_SetSurfaceExtents(), r_worldmodel, mBspSurface_t::samples, dBspSurface_t::side, SURF_WARP, dBspSurface_t::texinfo, mBspSurface_t::texinfo, mBspSurface_t::tile, VectorCopy, VectorNegate, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 414 of file r_model_brush.cpp.
References Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleLong, MAX_MAP_SURFEDGES, Mem_PoolAllocTypeN, mod_base, r_worldmodel, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 173 of file r_model_brush.cpp.
References Com_DPrintf(), Com_Error(), Com_sprintf(), count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, mBspTexInfo_t::flags, i, mBspTexInfo_t::image, it_world, LittleFloat, LittleLong, MAX_QPATH, Mem_PoolAllocTypeN, mod_base, name, Q_strvalid, R_FindImage(), r_worldmodel, dBspTexinfo_t::surfaceFlags, dBspTexinfo_t::texture, mBspTexInfo_t::u_offset, mBspTexInfo_t::uv, mBspTexInfo_t::v_offset, dBspTexinfo_t::vecs, vid_modelPool, and mBspTexInfo_t::vv.
Referenced by R_ModAddMapTile().
Definition at line 67 of file r_model_brush.cpp.
References Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleFloat, Mem_PoolAllocTypeN, mod_base, dBspVertex_t::point, mBspVertex_t::position, r_worldmodel, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 1167 of file r_model_brush.cpp.
References model_t::bsp, i, lengthof, Mem_Free, R_LoadSurfacesArrays(), r_mapTiles, r_numMapTiles, and mBspModel_t::sorted_surfaces.
Referenced by UI_MaterialEditorChangeValue_f().
Shift the verts for map assemblies.
Definition at line 467 of file r_model_brush.cpp.
References cBspPlane_t::dist, i, cBspPlane_t::normal, mBspVertex_t::position, r_worldmodel, and shift.
Referenced by R_ModAddMapTile().
Definition at line 109 of file r_model_brush.cpp.
References i, and VectorLength().
Referenced by R_ModLoadSubmodels().
|
static |
Definition at line 892 of file r_model_brush.cpp.
References mBspNode_t::children, mBspNode_t::contents, CONTENTS_PATHFINDING_NODE, R_RecursiveSetModel(), and R_SetModel().
Referenced by R_RecursiveSetModel(), and R_SetupSubmodels().
|
static |
Definition at line 877 of file r_model_brush.cpp.
References mBspNode_t::children, mBspNode_t::contents, CONTENTS_NODE, mBspNode_t::model, and R_SetModel().
Referenced by R_RecursiveSetModel(), and R_SetModel().
|
static |
Fills in s->stmins[] and s->stmaxs[].
Definition at line 210 of file r_model_brush.cpp.
References model_t::bsp, mBspSurface_t::center, DotProduct, mBspModel_t::edges, mBspSurface_t::firstedge, AABB::getCenter(), i, mBspSurface_t::lightmap_scale, mBspSurface_t::mbsBox, mBspSurface_t::numedges, AABB::set(), shift, mBspSurface_t::stcenter, mBspSurface_t::stextents, mBspSurface_t::stmaxs, mBspSurface_t::stmins, mBspModel_t::surfedges, mBspSurface_t::texinfo, mBspTexInfo_t::u_offset, mBspTexInfo_t::uv, mBspEdge_t::v, v, mBspTexInfo_t::v_offset, Vector2Set, VectorCopy, VectorSet, mBspModel_t::vertexes, and mBspTexInfo_t::vv.
Referenced by R_ModLoadSurfaces().
Sets up bmodels (brush models) like doors and breakable objects.
Definition at line 906 of file r_model_brush.cpp.
References model_t::bsp, Com_Error(), Com_sprintf(), ERR_DROP, mBspHeader_t::firstface, mBspModel_t::firstmodelsurface, mBspModel_t::firstnode, mBspTexInfo_t::flags, mBspHeader_t::hBox, mBspHeader_t::headnode, i, mBspSurface_t::isOriginBrushModel, mBspModel_t::maptile, mod_bsp_submodel, model_t::modBox, model_t::name, mBspModel_t::nodes, NUM_REGULAR_MODELS, mBspHeader_t::numfaces, mBspModel_t::nummodelsurfaces, r_modelsInline, r_numMapTiles, r_numModelsInline, R_RecursiveSetModel(), r_worldmodel, mBspHeader_t::radius, model_t::radius, AABB::set(), SURF_ORIGIN, mBspModel_t::surfaces, mBspSurface_t::texinfo, and model_t::type.
Referenced by R_ModAddMapTile().
Sets up surface range for the world model.
Definition at line 951 of file r_model_brush.cpp.
References Com_DPrintf(), Com_Printf(), DEBUG_RENDERER, mBspHeader_t::firstface, i, NUM_REGULAR_MODELS, mBspHeader_t::numfaces, and r_worldmodel.
Referenced by R_ModAddMapTile().
Reorders all surfaces arrays for the specified model, grouping the surface pointers by texture. This dramatically reduces glBindTexture calls.
Definition at line 662 of file r_model_brush.cpp.
References model_t::bsp, Com_DPrintf(), mBspSurfaces_t::count, DEBUG_RENDERER, mBspModel_t::firstmodelsurface, i, mBspTexInfo_t::image, index, Mem_AllocTypeN, Mem_Free, Mem_PoolAllocType, Mem_PoolAllocTypeN, NUM_SURFACES_ARRAYS, mBspModel_t::nummodelsurfaces, R_GetImageIndex(), r_numImages, R_SortSurfacesArrays_(), mBspModel_t::sorted_surfaces, mBspModel_t::surfaces, mBspSurfaces_t::surfaces, mBspSurface_t::texinfo, and vid_modelPool.
Referenced by R_LoadSurfacesArrays_().
|
static |
Definition at line 634 of file r_model_brush.cpp.
References Com_Error(), mBspSurfaces_t::count, ERR_FATAL, i, mBspTexInfo_t::image, MAX_GL_TEXTURES, R_AddSurfaceToArray, R_GetImageIndex(), r_numImages, mBspSurfaces_t::surfaces, and mBspSurface_t::texinfo.
Referenced by R_SortSurfacesArrays().
|
static |
The model base pointer - bases for the lump offsets.
Definition at line 41 of file r_model_brush.cpp.
Referenced by R_ModAddMapTile(), R_ModLoadEdges(), R_ModLoadLeafs(), R_ModLoadLighting(), R_ModLoadNodes(), R_ModLoadNormals(), R_ModLoadPlanes(), R_ModLoadSubmodels(), R_ModLoadSurfaces(), R_ModLoadSurfedges(), R_ModLoadTexinfo(), and R_ModLoadVertexes().
|
static |
The currently loaded world model for the actual tile.
Definition at line 51 of file r_model_brush.cpp.
Referenced by R_ModAddMapTile(), R_ModLoadEdges(), R_ModLoadLeafs(), R_ModLoadLighting(), R_ModLoadNodes(), R_ModLoadNormals(), R_ModLoadPlanes(), R_ModLoadSubmodels(), R_ModLoadSurfaces(), R_ModLoadSurfedges(), R_ModLoadTexinfo(), R_ModLoadVertexes(), R_ModShiftTile(), R_SetupSubmodels(), and R_SetupWorldModel().
|
static |
The shift array is used for random map assemblies (RMA) to shift the mins/maxs and stuff like that.
Definition at line 46 of file r_model_brush.cpp.
Referenced by CL_ClipMoveToLEs(), CM_AddMapTile(), CM_LoadBsp(), CMod_LoadEntityString(), CMod_LoadNodes(), CMod_LoadPlanes(), CMod_LoadSubmodels(), R_DrawCircle(), R_LoadBspVertexArrays(), R_ModAddMapTile(), R_ModLoadLeafs(), R_ModLoadNodes(), R_ModLoadSubmodels(), R_ModShiftTile(), R_SetSurfaceExtents(), AABB::set(), and TexinfoForBrushTexture().
|
static |
Definition at line 803 of file r_model_brush.cpp.
Referenced by R_GenerateTriangleSoup(), and R_GenerateTriangleSoup_().