1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
// worldocull.cpp: occlusion map and occlusion test
#include "cube.h"
#import "Command.h"
#import "DynamicEntity.h"
#define NUMRAYS 512
float rdist[NUMRAYS];
bool ocull = true;
float odist = 256;
COMMAND(toggleocull, ARG_NONE, ^{
ocull = !ocull;
})
// constructs occlusion map: cast rays in all directions on the 2d plane and
// record distance. done exactly once per frame.
void
computeraytable(float vx, float vy)
{
if (!ocull)
return;
odist = getvar(@"fog") * 1.5f;
float apitch = (float)fabs(player1.pitch);
float af = getvar(@"fov") / 2 + apitch / 1.5f + 3;
|
|
>
>
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
// worldocull.cpp: occlusion map and occlusion test
#include "cube.h"
#import "Command.h"
#import "Player.h"
#define NUMRAYS 512
float rdist[NUMRAYS];
bool ocull = true;
float odist = 256;
COMMAND(toggleocull, ARG_NONE, ^{
ocull = !ocull;
})
// constructs occlusion map: cast rays in all directions on the 2d plane and
// record distance. done exactly once per frame.
void
computeraytable(float vx, float vy)
{
Player *player1 = Player.player1;
if (!ocull)
return;
odist = getvar(@"fog") * 1.5f;
float apitch = (float)fabs(player1.pitch);
float af = getvar(@"fov") / 2 + apitch / 1.5f + 3;
|