summaryrefslogtreecommitdiffstats
path: root/src/render
diff options
context:
space:
mode:
authoraap <aap@papnet.eu>2020-05-19 10:23:08 +0200
committeraap <aap@papnet.eu>2020-05-19 10:23:08 +0200
commit62db8cd9b0030f042403e996b20c3ceca5cd4f7a (patch)
treea528e7b7f79e13a0e9915b67ab3448915391037c /src/render
parentsome less certainly fps fixes (diff)
downloadre3-62db8cd9b0030f042403e996b20c3ceca5cd4f7a.tar
re3-62db8cd9b0030f042403e996b20c3ceca5cd4f7a.tar.gz
re3-62db8cd9b0030f042403e996b20c3ceca5cd4f7a.tar.bz2
re3-62db8cd9b0030f042403e996b20c3ceca5cd4f7a.tar.lz
re3-62db8cd9b0030f042403e996b20c3ceca5cd4f7a.tar.xz
re3-62db8cd9b0030f042403e996b20c3ceca5cd4f7a.tar.zst
re3-62db8cd9b0030f042403e996b20c3ceca5cd4f7a.zip
Diffstat (limited to 'src/render')
-rw-r--r--src/render/Occlusion.cpp36
-rw-r--r--src/render/Occlusion.h19
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);
};