1
2
3
4
5
6
7
8
9
10
11
12
13
|
// worldrender.cpp: goes through all cubes in top down quad tree fashion,
// determines what has to be rendered and how (depending on neighbouring cubes),
// then calls functions in rendercubes.cpp
#include "cube.h"
void
render_wall(sqr *o, sqr *s, int x1, int y1, int x2, int y2, int mip, sqr *d1,
sqr *d2, bool topleft)
{
if (SOLID(o) || o->type == SEMISOLID) {
float c1 = s->floor;
float c2 = s->floor;
|
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
// worldrender.cpp: goes through all cubes in top down quad tree fashion,
// determines what has to be rendered and how (depending on neighbouring cubes),
// then calls functions in rendercubes.cpp
#include "cube.h"
#import "DynamicEntity.h"
void
render_wall(sqr *o, sqr *s, int x1, int y1, int x2, int y2, int mip, sqr *d1,
sqr *d2, bool topleft)
{
if (SOLID(o) || o->type == SEMISOLID) {
float c1 = s->floor;
float c2 = s->floor;
|
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
int ry = vyy + lodbot;
float fsize = (float)(1 << mip);
for (int ox = x; ox < xs; ox++) {
// first collect occlusion information for this block
for (int oy = y; oy < ys; oy++) {
SWS(w, ox, oy, sz)->occluded =
isoccluded(player1->o.x, player1->o.y,
(float)(ox << mip), (float)(oy << mip), fsize);
}
}
int pvx = (int)vx >> mip;
int pvy = (int)vy >> mip;
if (pvx >= 0 && pvy >= 0 && pvx < sz && pvy < sz) {
// SWS(w,vxx,vyy,sz)->occluded = 0;
SWS(w, pvx, pvy, sz)->occluded =
0; // player cell never occluded
}
#define df(x) s->floor - (x->vdelta / 4.0f)
#define dc(x) s->ceil + (x->vdelta / 4.0f)
// loop through the rect 3 times (for floor/ceil/walls seperately, to
// facilitate dynamic stripify) for each we skip occluded cubes
|
|
>
|
<
|
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
|
int ry = vyy + lodbot;
float fsize = (float)(1 << mip);
for (int ox = x; ox < xs; ox++) {
// first collect occlusion information for this block
for (int oy = y; oy < ys; oy++) {
SWS(w, ox, oy, sz)->occluded =
isoccluded(player1.o.x, player1.o.y,
(float)(ox << mip), (float)(oy << mip), fsize);
}
}
int pvx = (int)vx >> mip;
int pvy = (int)vy >> mip;
if (pvx >= 0 && pvy >= 0 && pvx < sz && pvy < sz) {
// SWS(w,vxx,vyy,sz)->occluded = 0;
// player cell never occluded
SWS(w, pvx, pvy, sz)->occluded = 0;
}
#define df(x) s->floor - (x->vdelta / 4.0f)
#define dc(x) s->ceil + (x->vdelta / 4.0f)
// loop through the rect 3 times (for floor/ceil/walls seperately, to
// facilitate dynamic stripify) for each we skip occluded cubes
|