mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2025-03-14 23:12:41 +00:00
renders: dynamic allocate buffer in *_MarkLeaves
This commit is contained in:
parent
0a346113dd
commit
726e4616db
4 changed files with 42 additions and 10 deletions
|
@ -1242,7 +1242,7 @@ void
|
|||
R_MarkLeaves(void)
|
||||
{
|
||||
const byte *vis;
|
||||
YQ2_ALIGNAS_TYPE(int) byte fatvis[MAX_MAP_LEAFS / 8];
|
||||
byte *fatvis = NULL;
|
||||
mnode_t *node;
|
||||
int i;
|
||||
mleaf_t *leaf;
|
||||
|
@ -1289,6 +1289,7 @@ R_MarkLeaves(void)
|
|||
{
|
||||
int c;
|
||||
|
||||
fatvis = malloc(((r_worldmodel->numleafs + 31) / 32) * sizeof(int));
|
||||
memcpy(fatvis, vis, (r_worldmodel->numleafs + 7) / 8);
|
||||
vis = Mod_ClusterPVS(r_viewcluster2, r_worldmodel);
|
||||
c = (r_worldmodel->numleafs + 31) / 32;
|
||||
|
@ -1331,4 +1332,10 @@ R_MarkLeaves(void)
|
|||
while (node);
|
||||
}
|
||||
}
|
||||
|
||||
/* clean combined buffer */
|
||||
if (fatvis)
|
||||
{
|
||||
free(fatvis);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -797,11 +797,10 @@ void
|
|||
GL3_MarkLeaves(void)
|
||||
{
|
||||
const byte *vis;
|
||||
YQ2_ALIGNAS_TYPE(int) byte fatvis[MAX_MAP_LEAFS / 8];
|
||||
byte *fatvis = NULL;
|
||||
mnode_t *node;
|
||||
int i, c;
|
||||
int i;
|
||||
mleaf_t *leaf;
|
||||
int cluster;
|
||||
|
||||
if ((gl3_oldviewcluster == gl3_viewcluster) &&
|
||||
(gl3_oldviewcluster2 == gl3_viewcluster2) &&
|
||||
|
@ -843,6 +842,9 @@ GL3_MarkLeaves(void)
|
|||
/* may have to combine two clusters because of solid water boundaries */
|
||||
if (gl3_viewcluster2 != gl3_viewcluster)
|
||||
{
|
||||
int c;
|
||||
|
||||
fatvis = malloc(((gl3_worldmodel->numleafs + 31) / 32) * sizeof(int));
|
||||
memcpy(fatvis, vis, (gl3_worldmodel->numleafs + 7) / 8);
|
||||
vis = GL3_Mod_ClusterPVS(gl3_viewcluster2, gl3_worldmodel);
|
||||
c = (gl3_worldmodel->numleafs + 31) / 32;
|
||||
|
@ -859,6 +861,8 @@ GL3_MarkLeaves(void)
|
|||
i < gl3_worldmodel->numleafs;
|
||||
i++, leaf++)
|
||||
{
|
||||
int cluster;
|
||||
|
||||
cluster = leaf->cluster;
|
||||
|
||||
if (cluster == -1)
|
||||
|
@ -883,5 +887,10 @@ GL3_MarkLeaves(void)
|
|||
while (node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* clean combined buffer */
|
||||
if (fatvis)
|
||||
{
|
||||
free(fatvis);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -794,11 +794,10 @@ void
|
|||
GL4_MarkLeaves(void)
|
||||
{
|
||||
const byte *vis;
|
||||
YQ2_ALIGNAS_TYPE(int) byte fatvis[MAX_MAP_LEAFS / 8];
|
||||
byte *fatvis = NULL;
|
||||
mnode_t *node;
|
||||
int i, c;
|
||||
int i;
|
||||
mleaf_t *leaf;
|
||||
int cluster;
|
||||
|
||||
if ((gl4_oldviewcluster == gl4_viewcluster) &&
|
||||
(gl4_oldviewcluster2 == gl4_viewcluster2) &&
|
||||
|
@ -840,6 +839,9 @@ GL4_MarkLeaves(void)
|
|||
/* may have to combine two clusters because of solid water boundaries */
|
||||
if (gl4_viewcluster2 != gl4_viewcluster)
|
||||
{
|
||||
int c;
|
||||
|
||||
fatvis = malloc(((gl4_worldmodel->numleafs + 31) / 32) * sizeof(int));
|
||||
memcpy(fatvis, vis, (gl4_worldmodel->numleafs + 7) / 8);
|
||||
vis = GL4_Mod_ClusterPVS(gl4_viewcluster2, gl4_worldmodel);
|
||||
c = (gl4_worldmodel->numleafs + 31) / 32;
|
||||
|
@ -856,6 +858,8 @@ GL4_MarkLeaves(void)
|
|||
i < gl4_worldmodel->numleafs;
|
||||
i++, leaf++)
|
||||
{
|
||||
int cluster;
|
||||
|
||||
cluster = leaf->cluster;
|
||||
|
||||
if (cluster == -1)
|
||||
|
@ -880,5 +884,10 @@ GL4_MarkLeaves(void)
|
|||
while (node);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* clean combined buffer */
|
||||
if (fatvis)
|
||||
{
|
||||
free(fatvis);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -811,7 +811,7 @@ void
|
|||
R_MarkLeaves(void)
|
||||
{
|
||||
const byte *vis;
|
||||
YQ2_ALIGNAS_TYPE(int) byte fatvis[MAX_MAP_LEAFS / 8];
|
||||
byte *fatvis = NULL;
|
||||
mnode_t *node;
|
||||
int i;
|
||||
mleaf_t *leaf;
|
||||
|
@ -858,6 +858,7 @@ R_MarkLeaves(void)
|
|||
{
|
||||
int c;
|
||||
|
||||
fatvis = malloc(((r_worldmodel->numleafs + 31) / 32) * sizeof(int));
|
||||
memcpy(fatvis, vis, (r_worldmodel->numleafs + 7) / 8);
|
||||
vis = Mod_ClusterPVS(r_viewcluster2, r_worldmodel);
|
||||
c = (r_worldmodel->numleafs + 31) / 32;
|
||||
|
@ -900,4 +901,10 @@ R_MarkLeaves(void)
|
|||
while (node);
|
||||
}
|
||||
}
|
||||
|
||||
/* clean combined buffer */
|
||||
if (fatvis)
|
||||
{
|
||||
free(fatvis);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue