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. More... | |
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. More... | |
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[]. More... | |
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. More... | |
static void | R_LoadBspVertexArrays (model_t *mod) |
Puts the map data into buffers. More... | |
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. More... | |
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. More... | |
static void | R_SetupWorldModel (void) |
Sets up surface range for the world model. More... | |
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. More... | |
void | R_ModReloadSurfacesArrays (void) |
Variables | |
static const byte * | mod_base |
The model base pointer - bases for the lump offsets. More... | |
static ipos3_t | shift |
The shift array is used for random map assemblies (RMA) to shift the mins/maxs and stuff like that. More... | |
static model_t * | r_worldmodel |
The currently loaded world model for the actual tile. More... | |
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 model_s::bsp, Com_Printf(), i, mBspModel_s::index_buffer, mBspModel_s::indexes, mBspModel_s::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_s::bsp, Com_DPrintf(), mBspSurfaces_s::count, DEBUG_RENDERER, mBspModel_s::firstmodelsurface, mBspSurface_s::firstTriangle, i, mBspSurface_s::index, mBspModel_s::indexes, mBspModel_s::maptile, NUM_SURFACES_ARRAYS, mBspSurface_s::numedges, mBspModel_s::numIndexes, mBspModel_s::nummodelsurfaces, mBspSurface_s::numTriangles, r_mapTiles, mBspModel_s::sorted_surfaces, mBspSurfaces_s::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_s::bsp, DotProduct, mBspModel_s::edges, mBspSurface_s::firstedge, mBspSurface_s::firstTriangle, mBspTexInfo_s::flags, mBspSurface_s::flags, image_s::height, i, mBspTexInfo_s::image, mBspSurface_s::index, index, mBspModel_s::indexes, mBspSurface_s::isOriginBrushModel, mBspSurface_s::light_s, mBspSurface_s::light_t, mBspSurface_s::lightmap_scale, mBspModel_s::lmtexcoord_buffer, mBspModel_s::lmtexcoords, Mem_PoolAllocTypeN, MSURF_LIGHTMAP, mBspVertex_s::normal, mBspSurface_s::normal, mBspModel_s::normal_buffer, mBspModel_s::normals, mBspSurface_s::numedges, mBspModel_s::numsurfaces, mBspVertex_s::position, r_lightmaps, R_ReallocateStateArrays(), shift, lightmaps_s::size, mBspSurface_s::stmins, SURF_PHONG, mBspModel_s::surfaces, mBspModel_s::surfedges, mBspModel_s::tangent_buffer, mBspModel_s::tangents, TangentVectors(), mBspModel_s::texcoord_buffer, mBspModel_s::texcoords, mBspSurface_s::texinfo, mBspTexInfo_s::u_offset, mBspTexInfo_s::uv, mBspEdge_s::v, mBspTexInfo_s::v_offset, VectorAdd, VectorCopy, VectorNotEmpty, mBspModel_s::vertex_buffer, mBspModel_s::vertexes, mBspModel_s::verts, vid_modelPool, mBspTexInfo_s::vv, and image_s::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_s::bsp, mBspSurfaces_s::count, mBspModel_s::firstmodelsurface, mBspTexInfo_s::flags, material_s::flags, i, mBspTexInfo_s::image, image_s::material, Mem_PoolAllocType, Mem_PoolAllocTypeN, NUM_SURFACES_ARRAYS, mBspModel_s::nummodelsurfaces, R_AddSurfaceToArray, R_SortSurfacesArrays(), mBspModel_s::sorted_surfaces, STAGE_FLARE, STAGE_RENDER, SURF_ALPHATEST, SURF_BLEND33, SURF_BLEND66, SURF_WARP, mBspSurfaces_s::surfaces, mBspModel_s::surfaces, mBspSurface_s::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 model_s::bsp, 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, mBspModel_s::maptile, mod_base, mod_bsp, model_s::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, model_s::type, 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, 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 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 model_s::bsp, Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, mBspModel_s::edges, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleShort, Mem_PoolAllocTypeN, mod_base, model_s::name, mBspModel_s::numedges, mBspEdge_s::v, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 392 of file r_model_brush.cpp.
References model_s::bsp, Com_DPrintf(), Com_Error(), mBspLeaf_s::contents, count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, mBspModel_s::leafs, LittleLong, LittleShort, AABB::maxs, Mem_PoolAllocTypeN, mBspLeaf_s::minmaxs, AABB::mins, mod_base, model_s::name, mBspModel_s::numleafs, shift, and vid_modelPool.
Referenced by R_ModAddMapTile().
Load the lightmap data.
Definition at line 56 of file r_model_brush.cpp.
References model_s::bsp, lump_t::filelen, lump_t::fileofs, mBspModel_s::lightdata, mBspModel_s::lightquant, Mem_PoolAllocTypeN, mod_base, and vid_lightPool.
Referenced by R_ModAddMapTile().
Definition at line 338 of file r_model_brush.cpp.
References model_s::bsp, mBspNode_s::children, Com_DPrintf(), Com_Error(), mBspNode_s::contents, CONTENTS_NODE, CONTENTS_PATHFINDING_NODE, count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, mBspNode_s::firstsurface, i, LEAFNODE, mBspModel_s::leafs, LittleLong, LittleShort, AABB::maxs, Mem_PoolAllocTypeN, mBspNode_s::minmaxs, AABB::mins, mod_base, model_s::name, mBspModel_s::nodes, mBspModel_s::numleafs, mBspModel_s::numnodes, mBspNode_s::numsurfaces, mBspNode_s::parent, mBspNode_s::plane, PLANENUM_LEAF, mBspModel_s::planes, shift, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 87 of file r_model_brush.cpp.
References model_s::bsp, Com_Error(), count, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleFloat, mod_base, model_s::name, mBspVertex_s::normal, mBspModel_s::numvertexes, and mBspModel_s::vertexes.
Referenced by R_ModAddMapTile().
Definition at line 437 of file r_model_brush.cpp.
References model_s::bsp, Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, cBspPlane_s::dist, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleFloat, LittleLong, Mem_PoolAllocTypeN, mod_base, model_s::name, cBspPlane_s::normal, mBspModel_s::numplanes, mBspModel_s::planes, cBspPlane_s::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 model_s::bsp, Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, mBspHeader_s::firstface, mBspHeader_s::hBox, mBspHeader_s::headnode, i, LittleFloat, LittleLong, AABB::maxs, Mem_PoolAllocTypeN, AABB::mins, mod_base, model_s::name, mBspHeader_s::numfaces, mBspModel_s::numsubmodels, mBspHeader_s::origin, R_RadiusFromBounds(), mBspHeader_s::radius, shift, mBspModel_s::submodels, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 269 of file r_model_brush.cpp.
References model_s::bsp, Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, mBspSurface_s::firstedge, mBspTexInfo_s::flags, mBspSurface_s::flags, i, mBspModel_s::lightdata, LIGHTMAP_DAY, LIGHTMAP_NIGHT, mBspSurface_s::lightmap_scale, mBspModel_s::lightquant, LittleLong, LittleShort, Mem_PoolAllocTypeN, mod_base, MSURF_LIGHTMAP, MSURF_PLANEBACK, model_s::name, cBspPlane_s::normal, mBspSurface_s::normal, mBspSurface_s::numedges, mBspModel_s::numsurfaces, mBspModel_s::numtexinfo, mBspSurface_s::plane, mBspModel_s::planes, R_CreateSurfaceLightmap(), r_numMapTiles, R_SetSurfaceExtents(), mBspSurface_s::samples, SURF_WARP, mBspModel_s::surfaces, mBspSurface_s::texinfo, mBspModel_s::texinfo, mBspSurface_s::tile, VectorCopy, VectorNegate, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 414 of file r_model_brush.cpp.
References model_s::bsp, Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleLong, MAX_MAP_SURFEDGES, Mem_PoolAllocTypeN, mod_base, model_s::name, mBspModel_s::numsurfedges, mBspModel_s::surfedges, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 173 of file r_model_brush.cpp.
References model_s::bsp, Com_DPrintf(), Com_Error(), Com_sprintf(), count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, mBspTexInfo_s::flags, i, mBspTexInfo_s::image, it_world, LittleFloat, LittleLong, MAX_QPATH, Mem_PoolAllocTypeN, mod_base, model_s::name, name, mBspModel_s::numtexinfo, Q_strvalid, R_FindImage(), mBspModel_s::texinfo, mBspTexInfo_s::u_offset, mBspTexInfo_s::uv, mBspTexInfo_s::v_offset, vid_modelPool, and mBspTexInfo_s::vv.
Referenced by R_ModAddMapTile().
Definition at line 67 of file r_model_brush.cpp.
References model_s::bsp, Com_DPrintf(), Com_Error(), count, DEBUG_RENDERER, ERR_DROP, lump_t::filelen, lump_t::fileofs, i, LittleFloat, Mem_PoolAllocTypeN, mod_base, model_s::name, mBspModel_s::numvertexes, mBspVertex_s::position, mBspModel_s::vertexes, and vid_modelPool.
Referenced by R_ModAddMapTile().
Definition at line 1167 of file r_model_brush.cpp.
References model_s::bsp, i, lengthof, Mem_Free, R_LoadSurfacesArrays(), r_mapTiles, r_numMapTiles, and mBspModel_s::sorted_surfaces.
Referenced by UI_MaterialEditorChangeValue_f().
Shift the verts for map assemblies.
Definition at line 467 of file r_model_brush.cpp.
References model_s::bsp, cBspPlane_s::dist, i, cBspPlane_s::normal, mBspModel_s::planes, mBspVertex_s::position, shift, and mBspModel_s::vertexes.
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_s::children, mBspNode_s::contents, CONTENTS_PATHFINDING_NODE, and R_SetModel().
Referenced by R_SetupSubmodels().
|
static |
Definition at line 877 of file r_model_brush.cpp.
References mBspNode_s::children, mBspNode_s::contents, CONTENTS_NODE, and mBspNode_s::model.
Referenced by R_RecursiveSetModel().
|
static |
Fills in s->stmins[] and s->stmaxs[].
Definition at line 210 of file r_model_brush.cpp.
References model_s::bsp, mBspSurface_s::center, DotProduct, mBspModel_s::edges, mBspSurface_s::firstedge, AABB::getCenter(), i, mBspSurface_s::lightmap_scale, mBspSurface_s::mbsBox, mBspSurface_s::numedges, mBspVertex_s::position, AABB::set(), shift, mBspSurface_s::stcenter, mBspSurface_s::stextents, mBspSurface_s::stmaxs, mBspSurface_s::stmins, mBspModel_s::surfedges, mBspSurface_s::texinfo, mBspTexInfo_s::u_offset, mBspTexInfo_s::uv, mBspEdge_s::v, v, mBspTexInfo_s::v_offset, Vector2Set, VectorCopy, VectorSet, mBspModel_s::vertexes, and mBspTexInfo_s::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_s::bsp, Com_Error(), Com_sprintf(), ERR_DROP, mBspHeader_s::firstface, mBspModel_s::firstmodelsurface, mBspModel_s::firstnode, mBspTexInfo_s::flags, mBspHeader_s::hBox, mBspHeader_s::headnode, i, mBspSurface_s::isOriginBrushModel, mBspModel_s::maptile, mod_bsp_submodel, model_s::modBox, model_s::name, mBspModel_s::nodes, NUM_REGULAR_MODELS, mBspHeader_s::numfaces, mBspModel_s::nummodelsurfaces, mBspModel_s::numnodes, mBspModel_s::numsubmodels, r_modelsInline, r_numMapTiles, r_numModelsInline, R_RecursiveSetModel(), r_worldmodel, mBspHeader_s::radius, model_s::radius, AABB::set(), mBspModel_s::submodels, SURF_ORIGIN, mBspModel_s::surfaces, mBspSurface_s::texinfo, and model_s::type.
Referenced by R_ModAddMapTile().
Sets up surface range for the world model.
Definition at line 951 of file r_model_brush.cpp.
References model_s::bsp, Com_DPrintf(), Com_Printf(), DEBUG_RENDERER, mBspHeader_s::firstface, mBspModel_s::firstmodelsurface, i, NUM_REGULAR_MODELS, mBspHeader_s::numfaces, mBspModel_s::nummodelsurfaces, mBspModel_s::numsubmodels, mBspModel_s::numsurfaces, and mBspModel_s::submodels.
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_s::bsp, Com_DPrintf(), mBspSurfaces_s::count, DEBUG_RENDERER, mBspModel_s::firstmodelsurface, i, mBspTexInfo_s::image, index, Mem_AllocTypeN, Mem_Free, Mem_PoolAllocType, Mem_PoolAllocTypeN, NUM_SURFACES_ARRAYS, mBspModel_s::nummodelsurfaces, R_GetImageIndex(), r_numImages, R_SortSurfacesArrays_(), mBspModel_s::sorted_surfaces, mBspSurfaces_s::surfaces, mBspModel_s::surfaces, mBspSurface_s::texinfo, and vid_modelPool.
Referenced by R_LoadSurfacesArrays_().
|
static |
Definition at line 634 of file r_model_brush.cpp.
References Com_Error(), mBspSurfaces_s::count, ERR_FATAL, i, mBspTexInfo_s::image, MAX_GL_TEXTURES, R_AddSurfaceToArray, R_GetImageIndex(), r_numImages, mBspSurfaces_s::surfaces, and mBspSurface_s::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(), and R_SetupSubmodels().
|
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(), R_LoadBspVertexArrays(), R_ModAddMapTile(), R_ModLoadLeafs(), R_ModLoadNodes(), R_ModLoadSubmodels(), R_ModShiftTile(), R_SetSurfaceExtents(), and TexinfoForBrushTexture().
|
static |
Definition at line 803 of file r_model_brush.cpp.
Referenced by R_GenerateTriangleSoup(), and R_GenerateTriangleSoup_().