diff options
Diffstat (limited to '')
-rw-r--r-- | src/render/Occlusion.cpp | 36 | ||||
-rw-r--r-- | src/render/Occlusion.h | 19 |
2 files changed, 55 insertions, 0 deletions
diff --git a/src/render/Occlusion.cpp b/src/render/Occlusion.cpp index b33b1d01..1c4e4266 100644 --- a/src/render/Occlusion.cpp +++ b/src/render/Occlusion.cpp @@ -2,6 +2,42 @@ #include "Occlusion.h" +int32 COcclusion::NumOccludersOnMap; +int16 COcclusion::FarAwayList; +int16 COcclusion::NearbyList; +int16 COcclusion::ListWalkThroughFA; +int16 COcclusion::PreviousListWalkThroughFA; +COccluder COcclusion::aOccluders[NUMOCCLUSIONVOLUMES]; + +void +COcclusion::Init(void) +{ + NumOccludersOnMap = 0; + FarAwayList = -1; + NearbyList = -1; + ListWalkThroughFA = -1; + PreviousListWalkThroughFA = -1; +} + +void +COcclusion::AddOne(float x, float y, float z, float width, float length, float height, float angle) +{ + if(NumOccludersOnMap >= NUMOCCLUSIONVOLUMES) + return; + + aOccluders[NumOccludersOnMap].x = x; + aOccluders[NumOccludersOnMap].y = y; + aOccluders[NumOccludersOnMap].z = z; + aOccluders[NumOccludersOnMap].width = width; + aOccluders[NumOccludersOnMap].length = length; + aOccluders[NumOccludersOnMap].height = height; + while(angle < 0.0f) angle += 360.0f; + while(angle > 360.0f) angle -= 360.0f; + aOccluders[NumOccludersOnMap].angle = angle * UINT16_MAX/360.0f; + aOccluders[NumOccludersOnMap].listIndex = FarAwayList; + FarAwayList = NumOccludersOnMap++; +} + void COcclusion::ProcessBeforeRendering(void) { diff --git a/src/render/Occlusion.h b/src/render/Occlusion.h index 977649b8..ac0ede5e 100644 --- a/src/render/Occlusion.h +++ b/src/render/Occlusion.h @@ -1,7 +1,26 @@ #pragma once +class COccluder +{ +public: + int16 width, length, height; + int16 x, y, z; + uint16 angle; + int16 listIndex; +}; + class COcclusion { public: + static int32 NumOccludersOnMap; + static int16 FarAwayList; + static int16 NearbyList; + static int16 ListWalkThroughFA; + static int16 PreviousListWalkThroughFA; + + static COccluder aOccluders[NUMOCCLUSIONVOLUMES]; + + 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); }; |