diff options
author | Sergeanur <s.anureev@yandex.ua> | 2021-07-17 23:03:57 +0200 |
---|---|---|
committer | Sergeanur <s.anureev@yandex.ua> | 2021-07-17 23:03:57 +0200 |
commit | c937bdbfea8f522d14d7a41f24372bddf5bdafcc (patch) | |
tree | eb8f97f6cf9fac31d7ab90388af232d51cc9c137 /src/renderer/Occlusion.h | |
parent | Merge pull request #1219 from withmorten/miami-ini (diff) | |
download | re3-c937bdbfea8f522d14d7a41f24372bddf5bdafcc.tar re3-c937bdbfea8f522d14d7a41f24372bddf5bdafcc.tar.gz re3-c937bdbfea8f522d14d7a41f24372bddf5bdafcc.tar.bz2 re3-c937bdbfea8f522d14d7a41f24372bddf5bdafcc.tar.lz re3-c937bdbfea8f522d14d7a41f24372bddf5bdafcc.tar.xz re3-c937bdbfea8f522d14d7a41f24372bddf5bdafcc.tar.zst re3-c937bdbfea8f522d14d7a41f24372bddf5bdafcc.zip |
Diffstat (limited to 'src/renderer/Occlusion.h')
-rw-r--r-- | src/renderer/Occlusion.h | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/src/renderer/Occlusion.h b/src/renderer/Occlusion.h new file mode 100644 index 00000000..e0edef53 --- /dev/null +++ b/src/renderer/Occlusion.h @@ -0,0 +1,62 @@ +#pragma once + +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); +}; + +class COccluder +{ +public: + int16 length, width, height; + int16 x, y, z; + uint16 angle; + int16 listIndex; + + bool NearCamera(); + bool ProcessOneOccluder(CActiveOccluder *occl); + bool ProcessLineSegment(int corner1, int corner2, CActiveOccluder* occl); + float GetAngle(void) { return angle*TWOPI/UINT16_MAX; } +}; + +class COcclusion +{ +public: + static int32 NumOccludersOnMap; + static int16 FarAwayList; + static int16 NearbyList; + static int16 ListWalkThroughFA; + static int16 PreviousListWalkThroughFA; + static int16 NumActiveOccluders; + + static COccluder aOccluders[NUMOCCLUSIONVOLUMES]; + static CActiveOccluder aActiveOccluders[NUMACTIVEOCCLUDERS]; + + static void Init(void); + static void AddOne(float x, float y, float z, float width, float length, float height, float angle); + 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); +#ifndef MASTER + static void Render(); +#endif +}; + +bool CalcScreenCoors(CVector const &in, CVector *out, float *outw, float *outh); +bool CalcScreenCoors(CVector const &in, CVector *out); + +#ifndef MASTER +extern bool bDispayOccDebugStuff; +#endif
\ No newline at end of file |