mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2025-05-31 08:41:11 +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"
|
# include "config.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#include <alloca.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "QF/render.h"
|
#include "QF/render.h"
|
||||||
|
@ -443,15 +444,21 @@ test_node (mnode_t *node, int *clipflags)
|
||||||
|
|
||||||
//FIXME no longer recursive: need a new name
|
//FIXME no longer recursive: need a new name
|
||||||
static void
|
static void
|
||||||
R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
R_RecursiveWorldNode (model_t *model, int clipflags)
|
||||||
{
|
{
|
||||||
struct {
|
typedef struct {
|
||||||
mnode_t *node;
|
mnode_t *node;
|
||||||
int side, clipflags;
|
int side, clipflags;
|
||||||
} *node_ptr, node_stack[256];
|
} rstack_t;
|
||||||
|
rstack_t *node_ptr;
|
||||||
|
rstack_t *node_stack;
|
||||||
|
mnode_t *node;
|
||||||
mnode_t *front;
|
mnode_t *front;
|
||||||
int side, cf;
|
int side, cf;
|
||||||
|
|
||||||
|
node = model->nodes;
|
||||||
|
// +2 for paranoia
|
||||||
|
node_stack = alloca ((model->depth + 2) * sizeof (rstack_t));
|
||||||
node_ptr = node_stack;
|
node_ptr = node_stack;
|
||||||
|
|
||||||
cf = clipflags;
|
cf = clipflags;
|
||||||
|
@ -461,9 +468,6 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
||||||
side = get_side (node);
|
side = get_side (node);
|
||||||
front = node->children[side];
|
front = node->children[side];
|
||||||
if (test_node (front, &cf)) {
|
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->node = node;
|
||||||
node_ptr->side = side;
|
node_ptr->side = side;
|
||||||
node_ptr->clipflags = clipflags;
|
node_ptr->clipflags = clipflags;
|
||||||
|
@ -658,7 +662,7 @@ R_RenderWorld (void)
|
||||||
clmodel = currententity->model;
|
clmodel = currententity->model;
|
||||||
r_pcurrentvertbase = clmodel->vertexes;
|
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
|
// if the driver wants the polygons back to front, play the visible ones
|
||||||
// back in that order
|
// back in that order
|
||||||
|
|
|
@ -31,6 +31,7 @@
|
||||||
#define NH_DEFINE
|
#define NH_DEFINE
|
||||||
#include "namehack.h"
|
#include "namehack.h"
|
||||||
|
|
||||||
|
#include <alloca.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "QF/render.h"
|
#include "QF/render.h"
|
||||||
|
@ -446,15 +447,21 @@ test_node (mnode_t *node, int *clipflags)
|
||||||
|
|
||||||
//FIXME no longer recursive: need a new name
|
//FIXME no longer recursive: need a new name
|
||||||
static void
|
static void
|
||||||
R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
R_RecursiveWorldNode (model_t *model, int clipflags)
|
||||||
{
|
{
|
||||||
struct {
|
typedef struct {
|
||||||
mnode_t *node;
|
mnode_t *node;
|
||||||
int side, clipflags;
|
int side, clipflags;
|
||||||
} *node_ptr, node_stack[256];
|
} rstack_t;
|
||||||
|
rstack_t *node_ptr;
|
||||||
|
rstack_t *node_stack;
|
||||||
|
mnode_t *node;
|
||||||
mnode_t *front;
|
mnode_t *front;
|
||||||
int side, cf;
|
int side, cf;
|
||||||
|
|
||||||
|
node = model->nodes;
|
||||||
|
// +2 for paranoia
|
||||||
|
node_stack = alloca ((model->depth + 2) * sizeof (rstack_t));
|
||||||
node_ptr = node_stack;
|
node_ptr = node_stack;
|
||||||
|
|
||||||
cf = clipflags;
|
cf = clipflags;
|
||||||
|
@ -464,9 +471,6 @@ R_RecursiveWorldNode (mnode_t *node, int clipflags)
|
||||||
side = get_side (node);
|
side = get_side (node);
|
||||||
front = node->children[side];
|
front = node->children[side];
|
||||||
if (test_node (front, &cf)) {
|
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->node = node;
|
||||||
node_ptr->side = side;
|
node_ptr->side = side;
|
||||||
node_ptr->clipflags = clipflags;
|
node_ptr->clipflags = clipflags;
|
||||||
|
@ -661,7 +665,7 @@ sw32_R_RenderWorld (void)
|
||||||
clmodel = currententity->model;
|
clmodel = currententity->model;
|
||||||
r_pcurrentvertbase = clmodel->vertexes;
|
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
|
// if the driver wants the polygons back to front, play the visible ones
|
||||||
// back in that order
|
// back in that order
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue