mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-03-22 18:31:27 +00:00
Fix sw and sw32's R_RecursiveWorldNode node stack.
I guess I had forgotten to make the node stack dynamically allocated for these renderers. Now ITS works in all four renderers.
This commit is contained in:
parent
76a69d9a53
commit
9758302023
2 changed files with 22 additions and 14 deletions
|
@ -28,6 +28,7 @@
|
|||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include <alloca.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "QF/render.h"
|
||||
|
@ -443,15 +444,21 @@ test_node (mnode_t *node, int *clipflags)
|
|||
|
||||
//FIXME no longer recursive: need a new name
|
||||
static void
|
||||
R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
||||
R_RecursiveWorldNode (model_t *model, int clipflags)
|
||||
{
|
||||
struct {
|
||||
typedef struct {
|
||||
mnode_t *node;
|
||||
int side, clipflags;
|
||||
} *node_ptr, node_stack[256];
|
||||
} rstack_t;
|
||||
rstack_t *node_ptr;
|
||||
rstack_t *node_stack;
|
||||
mnode_t *node;
|
||||
mnode_t *front;
|
||||
int side, cf;
|
||||
|
||||
node = model->nodes;
|
||||
// +2 for paranoia
|
||||
node_stack = alloca ((model->depth + 2) * sizeof (rstack_t));
|
||||
node_ptr = node_stack;
|
||||
|
||||
cf = clipflags;
|
||||
|
@ -461,9 +468,6 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
|||
side = get_side (node);
|
||||
front = node->children[side];
|
||||
if (test_node (front, &cf)) {
|
||||
if (node_ptr - node_stack
|
||||
== sizeof (node_stack) / sizeof (node_stack[0]))
|
||||
Sys_Error ("node_stack overflow");
|
||||
node_ptr->node = node;
|
||||
node_ptr->side = side;
|
||||
node_ptr->clipflags = clipflags;
|
||||
|
@ -658,7 +662,7 @@ R_RenderWorld (void)
|
|||
clmodel = currententity->model;
|
||||
r_pcurrentvertbase = clmodel->vertexes;
|
||||
|
||||
R_RecursiveWorldNode (clmodel->nodes, 15);
|
||||
R_RecursiveWorldNode (clmodel, 15);
|
||||
|
||||
// if the driver wants the polygons back to front, play the visible ones
|
||||
// back in that order
|
||||
|
|
|
@ -31,6 +31,7 @@
|
|||
#define NH_DEFINE
|
||||
#include "namehack.h"
|
||||
|
||||
#include <alloca.h>
|
||||
#include <math.h>
|
||||
|
||||
#include "QF/render.h"
|
||||
|
@ -446,15 +447,21 @@ test_node (mnode_t *node, int *clipflags)
|
|||
|
||||
//FIXME no longer recursive: need a new name
|
||||
static void
|
||||
R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
||||
R_RecursiveWorldNode (model_t *model, int clipflags)
|
||||
{
|
||||
struct {
|
||||
typedef struct {
|
||||
mnode_t *node;
|
||||
int side, clipflags;
|
||||
} *node_ptr, node_stack[256];
|
||||
} rstack_t;
|
||||
rstack_t *node_ptr;
|
||||
rstack_t *node_stack;
|
||||
mnode_t *node;
|
||||
mnode_t *front;
|
||||
int side, cf;
|
||||
|
||||
node = model->nodes;
|
||||
// +2 for paranoia
|
||||
node_stack = alloca ((model->depth + 2) * sizeof (rstack_t));
|
||||
node_ptr = node_stack;
|
||||
|
||||
cf = clipflags;
|
||||
|
@ -464,9 +471,6 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
|||
side = get_side (node);
|
||||
front = node->children[side];
|
||||
if (test_node (front, &cf)) {
|
||||
if (node_ptr - node_stack
|
||||
== sizeof (node_stack) / sizeof (node_stack[0]))
|
||||
Sys_Error ("node_stack overflow");
|
||||
node_ptr->node = node;
|
||||
node_ptr->side = side;
|
||||
node_ptr->clipflags = clipflags;
|
||||
|
@ -661,7 +665,7 @@ sw32_R_RenderWorld (void)
|
|||
clmodel = currententity->model;
|
||||
r_pcurrentvertbase = clmodel->vertexes;
|
||||
|
||||
R_RecursiveWorldNode (clmodel->nodes, 15);
|
||||
R_RecursiveWorldNode (clmodel, 15);
|
||||
|
||||
// if the driver wants the polygons back to front, play the visible ones
|
||||
// back in that order
|
||||
|
|
Loading…
Reference in a new issue