r_model_brush.c File Reference

brush model loading More...

#include "r_local.h"
#include "r_lightmap.h"
#include "../../shared/parse.h"
#include "r_light.h"
Include dependency graph for r_model_brush.c:

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 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 (qboolean 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)
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_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_ModAddMapTile (const char *name, qboolean day, int sX, int sY, int sZ)
static void R_ModEndLoading (const char *mapName)
void R_ModBeginLoading (const char *tiles, qboolean day, const char *pos, const char *mapName)
 Specifies the model that will be used as the world.
void R_ModReloadSurfacesArrays (void)

Variables

static const bytemod_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_tr_worldmodel
 The currently loaded world model for the actual tile.
static mBspSurfaces_tr_sorted_surfaces [MAX_GL_TEXTURES]
 temporary space for sorting surfaces by texture index

Detailed Description

brush model loading

Definition in file r_model_brush.c.


Function Documentation

static void R_LoadBspVertexArrays ( model_t mod  )  [static]

Puts the map data into buffers.

See also:
R_ModAddMapTile
Note:
Shift the verts after the texcoords for diffuse and lightmap are loaded
See also:
R_ModShiftTile
Todo:

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 525 of file r_model_brush.c.

References model_s::bsp, Com_Error(), DotProduct, mBspModel_s::edges, ERR_DROP, mBspSurface_s::firstedge, mBspTexInfo_s::flags, mBspSurface_s::flags, image_s::height, i, mBspTexInfo_s::image, mBspSurface_s::index, mBspSurface_s::isOriginBrushModel, mBspSurface_s::light_s, mBspSurface_s::light_t, mBspSurface_s::lightmap_scale, mBspModel_s::lmtexcoord_buffer, mBspModel_s::lmtexcoords, MAX_GL_ARRAY_LENGTH, Mem_PoolAlloc, MSURF_LIGHTMAP, mBspSurface_s::normal, mBspVertex_s::normal, mBspModel_s::normal_buffer, mBspModel_s::normals, mBspSurface_s::numedges, mBspModel_s::numsurfaces, mBspVertex_s::position, r_lightmaps, 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, vec3_origin, VectorAdd, VectorCompare, VectorCopy, mBspModel_s::vertex_buffer, mBspModel_s::vertexes, mBspModel_s::verts, vid_modelPool, mBspTexInfo_s::vv, and image_s::width.

Referenced by R_ModAddMapTile().

static void R_LoadSurfacesArrays ( void   )  [static]
static void R_LoadSurfacesArrays_ ( model_t mod  )  [static]
static void R_ModAddMapTile ( const char *  name,
qboolean  day,
int  sX,
int  sY,
int  sZ 
) [static]
void R_ModBeginLoading ( const char *  tiles,
qboolean  day,
const char *  pos,
const char *  mapName 
)

Specifies the model that will be used as the world.

Parameters:
[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).
See also:
R_ModAddMapTile
CM_LoadMap
Note:
This function is called for listen servers, too. This loads the bsp struct for rendering it. The CM_LoadMap code only loads the collision and pathfinding stuff.
See also:
UI_BuildRadarImageList

Definition at line 1017 of file r_model_brush.c.

References Com_Error(), Com_Parse(), Com_sprintf(), ERR_DROP, i, MAX_QPATH, MAX_VAR, name, PATHFINDING_HEIGHT, PATHFINDING_WIDTH, Q_strncpyz(), R_BeginBuildingLightmaps(), R_ClearActiveLights(), R_FreeWorldImages(), R_ModAddMapTile(), R_ModEndLoading(), r_numMapTiles, and r_numModelsInline.

Referenced by CL_ViewLoadMedia().

static void R_ModEndLoading ( const char *  mapName  )  [static]

Definition at line 991 of file r_model_brush.c.

References R_EndBuildingLightmaps(), R_LoadMaterials(), and R_LoadSurfacesArrays().

Referenced by R_ModBeginLoading().

static void R_ModLoadEdges ( const lump_t l  )  [static]
static void R_ModLoadLeafs ( const lump_t l  )  [static]
static void R_ModLoadLighting ( const lump_t l  )  [static]
static void R_ModLoadNodes ( const lump_t l  )  [static]
static void R_ModLoadNormals ( const lump_t l  )  [static]
static void R_ModLoadPlanes ( const lump_t l  )  [static]
static void R_ModLoadSubmodels ( const lump_t l  )  [static]
static void R_ModLoadSurfaces ( qboolean  day,
const lump_t l 
) [static]
static void R_ModLoadSurfedges ( const lump_t l  )  [static]
static void R_ModLoadTexinfo ( const lump_t l  )  [static]
static void R_ModLoadVertexes ( const lump_t l  )  [static]
void R_ModReloadSurfacesArrays ( void   ) 
Todo:
fix this for threaded renderer mode

Definition at line 1087 of file r_model_brush.c.

References model_s::bsp, i, lengthof, Mem_Free, R_LoadSurfacesArrays(), r_mapTiles, r_numMapTiles, and mBspModel_s::sorted_surfaces.

Referenced by UI_MaterialEditorChangeValue_f().

static void R_ModShiftTile ( void   )  [static]

Shift the verts for map assemblies.

Note:
This is needed because you want to place a bsp file to a given position on the grid - see R_ModAddMapTile for the shift vector calculation This vector differs for every map - and depends on the grid position the bsp map tile is placed in the world
Call this after the buffers were generated in R_LoadBspVertexArrays
See also:
R_LoadBspVertexArrays

Definition at line 499 of file r_model_brush.c.

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().

static float R_RadiusFromBounds ( const vec3_t  mins,
const vec3_t  maxs 
) [inline, static]

Definition at line 115 of file r_model_brush.c.

References i, and VectorLength().

Referenced by R_ModLoadSubmodels().

static void R_RecursiveSetModel ( mBspNode_t node,
model_t mod 
) [static]
See also:
R_RecurseSetParent

Definition at line 858 of file r_model_brush.c.

References mBspNode_s::children, mBspNode_s::contents, CONTENTS_PATHFINDING_NODE, and R_SetModel().

Referenced by R_SetupSubmodels().

static void R_SetModel ( mBspNode_t node,
model_t mod 
) [static]
See also:
R_SetParent

Definition at line 843 of file r_model_brush.c.

References mBspNode_s::children, mBspNode_s::contents, CONTENTS_NODE, and mBspNode_s::model.

Referenced by R_RecursiveSetModel().

static void R_SetSurfaceExtents ( mBspSurface_t surf,
const model_t mod 
) [static]
static void R_SetupSubmodels ( void   )  [static]
static void R_SortSurfacesArrays ( const model_t mod  )  [static]
static void R_SortSurfacesArrays_ ( mBspSurfaces_t surfs  )  [static]

Variable Documentation

const byte* mod_base [static]
mBspSurfaces_t* r_sorted_surfaces[MAX_GL_TEXTURES] [static]

temporary space for sorting surfaces by texture index

Definition at line 663 of file r_model_brush.c.

model_t* r_worldmodel [static]

The currently loaded world model for the actual tile.

See also:
r_mapTiles

Definition at line 50 of file r_model_brush.c.

ipos3_t shift [static]

The shift array is used for random map assemblies (RMA) to shift the mins/maxs and stuff like that.

Definition at line 45 of file r_model_brush.c.

Referenced by CL_ClipMoveToLEs(), CM_AddMapTile(), R_LoadBspVertexArrays(), R_ModAddMapTile(), R_ModLoadLeafs(), R_ModLoadNodes(), R_ModLoadSubmodels(), R_ModShiftTile(), R_SetSurfaceExtents(), and TexinfoForBrushTexture().


Generated by  doxygen 1.6.2