mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-13 08:27:39 +00:00
[model] Move visframe out of mleaf_t
This is next critical step to making BSP rendering thread-safe. visframe was replaced with cluster (not used yet) in anticipation of BSP cluster reconstruction (which will be necessary for dealing with large maps like ad_tears).
This commit is contained in:
parent
4e5eec0277
commit
d40769c21d
10 changed files with 16 additions and 12 deletions
|
@ -193,7 +193,7 @@ typedef struct mnode_s {
|
||||||
typedef struct mleaf_s {
|
typedef struct mleaf_s {
|
||||||
// common with node
|
// common with node
|
||||||
int contents; // wil be a negative contents number
|
int contents; // wil be a negative contents number
|
||||||
int visframe; // node needs to be traversed if current
|
int cluster; // cluster to which this leaf bleongs XXX
|
||||||
|
|
||||||
// for bounding box culling
|
// for bounding box culling
|
||||||
float mins[3];
|
float mins[3];
|
||||||
|
|
|
@ -74,8 +74,10 @@ struct entity_s;
|
||||||
struct animation_s;
|
struct animation_s;
|
||||||
void R_DrawAliasModel (struct entity_s *e);
|
void R_DrawAliasModel (struct entity_s *e);
|
||||||
|
|
||||||
void R_MarkLeaves (struct mleaf_s *viewleaf, int *node_visframes);
|
void R_MarkLeaves (struct mleaf_s *viewleaf, int *node_visframes,
|
||||||
|
int *leaf_visframes);
|
||||||
extern int *r_node_visframes;
|
extern int *r_node_visframes;
|
||||||
|
extern int *r_leaf_visframes;
|
||||||
|
|
||||||
void GL_SetPalette (void *data, const byte *palette);
|
void GL_SetPalette (void *data, const byte *palette);
|
||||||
void GLSL_SetPalette (void *data, const byte *palette);
|
void GLSL_SetPalette (void *data, const byte *palette);
|
||||||
|
|
|
@ -173,7 +173,7 @@ gl_R_NewScene (scene_t *scene)
|
||||||
brush->leafs[i].efrags = NULL;
|
brush->leafs[i].efrags = NULL;
|
||||||
|
|
||||||
// Force a vis update
|
// Force a vis update
|
||||||
R_MarkLeaves (0, 0);
|
R_MarkLeaves (0, 0, 0);
|
||||||
|
|
||||||
R_ClearParticles ();
|
R_ClearParticles ();
|
||||||
|
|
||||||
|
|
|
@ -199,7 +199,7 @@ glsl_R_NewScene (scene_t *scene)
|
||||||
r_refdef.worldmodel = scene->worldmodel;
|
r_refdef.worldmodel = scene->worldmodel;
|
||||||
|
|
||||||
// Force a vis update
|
// Force a vis update
|
||||||
R_MarkLeaves (0, 0);
|
R_MarkLeaves (0, 0, 0);
|
||||||
|
|
||||||
R_ClearParticles ();
|
R_ClearParticles ();
|
||||||
glsl_R_RegisterTextures (scene->models, scene->num_models);
|
glsl_R_RegisterTextures (scene->models, scene->num_models);
|
||||||
|
|
|
@ -47,7 +47,7 @@ static mleaf_t *r_oldviewleaf;
|
||||||
static set_t *solid;
|
static set_t *solid;
|
||||||
|
|
||||||
void
|
void
|
||||||
R_MarkLeaves (mleaf_t *viewleaf, int *node_visframes)
|
R_MarkLeaves (mleaf_t *viewleaf, int *node_visframes, int *leaf_visframes)
|
||||||
{
|
{
|
||||||
set_t *vis;
|
set_t *vis;
|
||||||
int c;
|
int c;
|
||||||
|
@ -84,7 +84,7 @@ R_MarkLeaves (mleaf_t *viewleaf, int *node_visframes)
|
||||||
mark++;
|
mark++;
|
||||||
} while (--c);
|
} while (--c);
|
||||||
}
|
}
|
||||||
leaf->visframe = r_visframecount;
|
leaf_visframes[i + 1] = r_visframecount;
|
||||||
int node_id = brush->leaf_parents[leaf - brush->leafs];
|
int node_id = brush->leaf_parents[leaf - brush->leafs];
|
||||||
while (node_id >= 0) {
|
while (node_id >= 0) {
|
||||||
if (node_visframes[node_id] == r_visframecount)
|
if (node_visframes[node_id] == r_visframecount)
|
||||||
|
|
|
@ -294,7 +294,7 @@ R_MarkLights (vec4f_t lightorigin, dlight_t *light, int lightnum,
|
||||||
mleaf_t *leaf = &brush->leafs[leafnum + 1];
|
mleaf_t *leaf = &brush->leafs[leafnum + 1];
|
||||||
if (!(vis_bits & b))
|
if (!(vis_bits & b))
|
||||||
continue;
|
continue;
|
||||||
if (leaf->visframe != r_visframecount)
|
if (r_leaf_visframes[leafnum + 1] != r_visframecount)
|
||||||
continue;
|
continue;
|
||||||
if (leaf->mins[0] > maxs[0] || leaf->maxs[0] < mins[0]
|
if (leaf->mins[0] > maxs[0] || leaf->maxs[0] < mins[0]
|
||||||
|| leaf->mins[1] > maxs[1] || leaf->maxs[1] < mins[1]
|
|| leaf->mins[1] > maxs[1] || leaf->maxs[1] < mins[1]
|
||||||
|
|
|
@ -62,6 +62,7 @@ int scr_copytop;
|
||||||
byte *draw_chars; // 8*8 graphic characters FIXME location
|
byte *draw_chars; // 8*8 graphic characters FIXME location
|
||||||
qboolean r_cache_thrash; // set if surface cache is thrashing
|
qboolean r_cache_thrash; // set if surface cache is thrashing
|
||||||
int *r_node_visframes; //FIXME per renderer
|
int *r_node_visframes; //FIXME per renderer
|
||||||
|
int *r_leaf_visframes; //FIXME per renderer
|
||||||
|
|
||||||
qboolean scr_skipupdate;
|
qboolean scr_skipupdate;
|
||||||
static qboolean scr_initialized;// ready to draw
|
static qboolean scr_initialized;// ready to draw
|
||||||
|
@ -283,7 +284,7 @@ SCR_UpdateScreen (transform_t *camera, double realtime, SCR_Func *scr_funcs)
|
||||||
warp_buffer = r_funcs->create_frame_buffer (r_data->vid->width,
|
warp_buffer = r_funcs->create_frame_buffer (r_data->vid->width,
|
||||||
r_data->vid->height);
|
r_data->vid->height);
|
||||||
}
|
}
|
||||||
R_MarkLeaves (scr_scene->viewleaf, r_node_visframes);
|
R_MarkLeaves (scr_scene->viewleaf, r_node_visframes, r_leaf_visframes);
|
||||||
}
|
}
|
||||||
R_PushDlights (vec3_origin);
|
R_PushDlights (vec3_origin);
|
||||||
|
|
||||||
|
@ -515,8 +516,9 @@ SCR_NewScene (scene_t *scene)
|
||||||
scr_scene = scene;
|
scr_scene = scene;
|
||||||
if (scene) {
|
if (scene) {
|
||||||
mod_brush_t *brush = &scr_scene->worldmodel->brush;
|
mod_brush_t *brush = &scr_scene->worldmodel->brush;
|
||||||
int size = brush->numnodes * sizeof (int);
|
int size = (brush->numnodes + brush->modleafs) * sizeof (int);
|
||||||
r_node_visframes = Hunk_AllocName (0, size, "visframes");
|
r_node_visframes = Hunk_AllocName (0, size, "visframes");
|
||||||
|
r_leaf_visframes = r_node_visframes + brush->numnodes;
|
||||||
r_funcs->set_fov (tan_fov_x, tan_fov_y);
|
r_funcs->set_fov (tan_fov_x, tan_fov_y);
|
||||||
r_funcs->R_NewScene (scene);
|
r_funcs->R_NewScene (scene);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -234,7 +234,7 @@ R_RecursiveClipBPoly (entity_t *ent, bedge_t *pedges, mnode_t *pnode,
|
||||||
// we're done with this branch if the node or leaf isn't in the PVS
|
// we're done with this branch if the node or leaf isn't in the PVS
|
||||||
if (child_id < 0) {
|
if (child_id < 0) {
|
||||||
mleaf_t *leaf = r_refdef.worldmodel->brush.leafs + ~child_id;
|
mleaf_t *leaf = r_refdef.worldmodel->brush.leafs + ~child_id;
|
||||||
if (leaf->visframe == r_visframecount
|
if (r_leaf_visframes[~child_id] == r_visframecount
|
||||||
&& leaf->contents != CONTENTS_SOLID) {
|
&& leaf->contents != CONTENTS_SOLID) {
|
||||||
r_currentbkey = leaf->key;
|
r_currentbkey = leaf->key;
|
||||||
R_RenderBmodelFace (ent, psideedges[i], psurf);
|
R_RenderBmodelFace (ent, psideedges[i], psurf);
|
||||||
|
|
|
@ -167,7 +167,7 @@ R_NewScene (scene_t *scene)
|
||||||
R_InitSky (brush->skytexture);
|
R_InitSky (brush->skytexture);
|
||||||
|
|
||||||
// Force a vis update
|
// Force a vis update
|
||||||
R_MarkLeaves (0, 0);
|
R_MarkLeaves (0, 0, 0);
|
||||||
|
|
||||||
R_ClearParticles ();
|
R_ClearParticles ();
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ Vulkan_NewScene (scene_t *scene, vulkan_ctx_t *ctx)
|
||||||
r_refdef.worldmodel = scene->worldmodel;
|
r_refdef.worldmodel = scene->worldmodel;
|
||||||
|
|
||||||
// Force a vis update
|
// Force a vis update
|
||||||
R_MarkLeaves (0, 0);
|
R_MarkLeaves (0, 0, 0);
|
||||||
|
|
||||||
R_ClearParticles ();
|
R_ClearParticles ();
|
||||||
Vulkan_RegisterTextures (scene->models, scene->num_models, ctx);
|
Vulkan_RegisterTextures (scene->models, scene->num_models, ctx);
|
||||||
|
|
Loading…
Reference in a new issue