2020-05-11 15:03:32 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-07-05 20:45:09 +00:00
|
|
|
struct ActiveOccluderLine {
|
|
|
|
CVector2D origin;
|
|
|
|
CVector2D direction;
|
|
|
|
float length;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CActiveOccluder {
|
|
|
|
|
|
|
|
public:
|
|
|
|
ActiveOccluderLine lines[6];
|
|
|
|
int32 linesCount;
|
|
|
|
float radius;
|
|
|
|
|
|
|
|
bool IsPointWithinOcclusionArea(float x, float y, float area);
|
|
|
|
};
|
|
|
|
|
2020-05-19 08:23:08 +00:00
|
|
|
class COccluder
|
|
|
|
{
|
|
|
|
public:
|
2020-07-20 21:25:04 +00:00
|
|
|
int16 length, width, height;
|
2020-05-19 08:23:08 +00:00
|
|
|
int16 x, y, z;
|
|
|
|
uint16 angle;
|
|
|
|
int16 listIndex;
|
2020-07-05 20:45:09 +00:00
|
|
|
|
|
|
|
bool NearCamera();
|
|
|
|
bool ProcessOneOccluder(CActiveOccluder *occl);
|
|
|
|
bool ProcessLineSegment(int corner1, int corner2, CActiveOccluder* occl);
|
2020-07-20 21:25:04 +00:00
|
|
|
float GetAngle(void) { return angle*TWOPI/UINT16_MAX; }
|
2020-05-19 08:23:08 +00:00
|
|
|
};
|
|
|
|
|
2020-05-11 15:03:32 +00:00
|
|
|
class COcclusion
|
|
|
|
{
|
|
|
|
public:
|
2020-05-19 08:23:08 +00:00
|
|
|
static int32 NumOccludersOnMap;
|
|
|
|
static int16 FarAwayList;
|
|
|
|
static int16 NearbyList;
|
|
|
|
static int16 ListWalkThroughFA;
|
|
|
|
static int16 PreviousListWalkThroughFA;
|
2020-07-05 20:45:09 +00:00
|
|
|
static int16 NumActiveOccluders;
|
2020-05-19 08:23:08 +00:00
|
|
|
|
|
|
|
static COccluder aOccluders[NUMOCCLUSIONVOLUMES];
|
2020-07-05 20:45:09 +00:00
|
|
|
static CActiveOccluder aActiveOccluders[NUMACTIVEOCCLUDERS];
|
2020-05-19 08:23:08 +00:00
|
|
|
|
|
|
|
static void Init(void);
|
|
|
|
static void AddOne(float x, float y, float z, float width, float length, float height, float angle);
|
2020-07-05 20:45:09 +00:00
|
|
|
static void ProcessBeforeRendering(void);
|
|
|
|
static bool OccluderHidesBehind(CActiveOccluder *occl1, CActiveOccluder *occl2);
|
|
|
|
static bool IsAABoxOccluded(CVector pos, float width, float length, float height);
|
|
|
|
static bool IsPositionOccluded(CVector pos, float side);
|
|
|
|
static void Render();
|
2020-05-11 15:03:32 +00:00
|
|
|
};
|
2020-07-05 20:45:09 +00:00
|
|
|
|
|
|
|
bool CalcScreenCoors(CVector const &in, CVector *out, float *outw, float *outh);
|
2020-07-20 21:25:04 +00:00
|
|
|
bool CalcScreenCoors(CVector const &in, CVector *out);
|
|
|
|
|
|
|
|
extern bool bDisplayOccDebugStuff;
|