Skip to content

Commit

Permalink
feat: portals stuff RE.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Perapechka committed Oct 21, 2024
1 parent 5df90c5 commit 1ac5d9d
Show file tree
Hide file tree
Showing 11 changed files with 339 additions and 47 deletions.
26 changes: 26 additions & 0 deletions include/RE/B/BSCompoundFrustum.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
#pragma once

#include "RE/B/BSTArray.h"
#include "RE/N/NiFrustumPlanes.h"
#include "RE/N/NiPoint3.h"

namespace RE
{
class NiCamera;

class BSCompoundFrustum
{
public:
// members
BSTArray<void*> unk00; // 00
BSTArray<void*> unk18; // 18
NiFrustumPlanes frustumPlanes; // 30
NiPoint3 unkA0; // A0
NiCamera* camera; // B0
uint32_t unkB8; // B8
uint32_t unkBC; // BC
uint32_t unkC0; // C0
uint16_t unkC4; // C4
};
static_assert(sizeof(BSCompoundFrustum) == 0xC8);
}
65 changes: 34 additions & 31 deletions include/RE/B/BSLight.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@
namespace RE
{
class BSCullingProcess;
class BSLensFlareRenderData;
class BSMultiBoundRoom;
class BSPortal;
class BSPortalGraph;
class BSPortalSharedNode;
class BSTriShape;
class NiAVObject;
class BSLensFlareRenderData;
class NiLight;

class BSLight : public NiRefObject
Expand Down Expand Up @@ -44,36 +47,36 @@ namespace RE
virtual bool IsShadowLight(); // 03

// members
float luminance; // 010
float lodDimmer; // 014
Data unk018; // 018
std::uint64_t unk038; // 038
std::uint32_t unk040; // 040
bool pointLight; // 044
bool ambientLight; // 045
bool dynamic; // 046
bool portalStrict; // 047
NiPointer<NiLight> light; // 048
NiPoint3 worldTranslate; // 050
std::uint32_t frustrumCull; // 05C
std::uint8_t unk060; // 060
bool affectLand; // 061
bool affectWater; // 062
bool neverFades; // 063
std::uint32_t unk064; // 064
std::uint64_t unk068; // 068
std::uint8_t unk070[96]; // 070
std::uint8_t unk0D0; // 0D0
std::uint8_t pad0D1; // 0D1
std::uint16_t pad0D2; // 0D2
std::uint32_t pad0D4; // 0D4
BSTArray<void*> unk0D8; // 0D8
BSTArray<void*> unk0F0; // 0F0
BSTArray<void*> unk108; // 108
BSPortalGraph* portalGraph; // 120
BSCullingProcess* cullingProcess; // 128
NiPointer<NiAVObject> objectNode; // 130
BSLensFlareRenderData* lensFlareData; // 138
float luminance; // 010
float lodDimmer; // 014
Data unk018; // 018
std::uint64_t unk038; // 038
std::uint32_t unk040; // 040
bool pointLight; // 044
bool ambientLight; // 045
bool dynamic; // 046
bool portalStrict; // 047
NiPointer<NiLight> light; // 048
NiPoint3 worldTranslate; // 050
std::uint32_t frustrumCull; // 05C
std::uint8_t unk060; // 060
bool affectLand; // 061
bool affectWater; // 062
bool neverFades; // 063
std::uint32_t unk064; // 064
std::uint64_t unk068; // 068
std::uint8_t unk070[96]; // 070
std::uint8_t unk0D0; // 0D0
std::uint8_t pad0D1; // 0D1
std::uint16_t pad0D2; // 0D2
std::uint32_t pad0D4; // 0D4
BSTArray<BSMultiBoundRoom*> rooms; // 0D8
BSTArray<BSPortal*> portals; // 0F0
BSTArray<BSPortalSharedNode*> portalSharedNodes; // 108
BSPortalGraph* portalGraph; // 120
BSCullingProcess* cullingProcess; // 128
NiPointer<NiAVObject> objectNode; // 130
BSLensFlareRenderData* lensFlareData; // 138
};
static_assert(sizeof(BSLight) == 0x140);
}
51 changes: 51 additions & 0 deletions include/RE/B/BSOcclusionBox.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#pragma once

#include "RE/B/BSCompoundFrustum.h"
#include "RE/B/BSOcclusionShape.h"
#include "RE/N/NiPoint2.h"

namespace RE
{
class BSOcclusionBox : public BSOcclusionShape
{
public:
inline static constexpr auto RTTI = RTTI_BSOcclusionBox;
inline static constexpr auto Ni_RTTI = NiRTTI_BSOcclusionBox;
inline static constexpr auto VTABLE = VTABLE_BSOcclusionBox;

~BSOcclusionBox() override; // 00

// override (BSOcclusionShape)
const NiRTTI* GetRTTI() const override; // 02
NiObject* CreateClone(NiCloningProcess& a_cloning) override; // 17
bool IsOcclusionPlane() const override; // 25
bool IsOcclusionBox() const override; // 25

// members
NiPoint3 size; // 048
NiFrustumPlanes frustumPlanes[2]; // 054
uint64_t unk138; // 138
uint64_t unk140; // 140
uint64_t unk148; // 148
uint64_t unk150; // 150
uint64_t unk158; // 158
uint64_t unk160; // 160
uint64_t unk168; // 168
uint64_t unk170; // 170
uint64_t unk178; // 178
uint64_t unk180; // 180
uint64_t unk188; // 188
uint64_t unk190; // 190
uint64_t unk198; // 198
uint64_t unk1A0; // 1A0
uint64_t unk1A8; // 1A8
uint64_t unk1B0; // 1B0
uint64_t unk1B8; // 1B8
uint64_t unk1C0; // 1C0
uint64_t unk1C8; // 1C8
uint64_t unk1D0; // 1D0
uint64_t unk1D8; // 1D8
uint64_t unk1E0; // 1E0
};
static_assert(sizeof(BSOcclusionBox) == 0x1E8);
}
29 changes: 29 additions & 0 deletions include/RE/B/BSOcclusionPlane.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include "RE/B/BSCompoundFrustum.h"
#include "RE/B/BSOcclusionShape.h"
#include "RE/N/NiPoint2.h"

namespace RE
{
class BSOcclusionPlane : public BSOcclusionShape
{
public:
inline static constexpr auto RTTI = RTTI_BSOcclusionPlane;
inline static constexpr auto Ni_RTTI = NiRTTI_BSOcclusionPlane;
inline static constexpr auto VTABLE = VTABLE_BSOcclusionPlane;

~BSOcclusionPlane() override; // 00

// override (BSOcclusionShape)
const NiRTTI* GetRTTI() const override; // 02
NiObject* CreateClone(NiCloningProcess& a_cloning) override; // 17
bool IsOcclusionPlane() const override; // 25
bool IsOcclusionBox() const override; // 25

// members
NiPoint2 size; // 48
BSCompoundFrustum frustum; // 50
};
static_assert(sizeof(BSOcclusionPlane) == 0x118);
}
33 changes: 33 additions & 0 deletions include/RE/B/BSOcclusionShape.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#pragma once

#include "RE/N/NiMatrix3.h"
#include "RE/N/NiObject.h"
#include "RE/N/NiPoint3.h"

namespace RE
{
class BSOcclusionShape : public NiObject
{
public:
inline static constexpr auto RTTI = RTTI_BSOcclusionShape;
inline static constexpr auto Ni_RTTI = NiRTTI_BSOcclusionShape;
inline static constexpr auto VTABLE = VTABLE_BSOcclusionShape;

~BSOcclusionShape() override; // 00

// override (NiObject)
const NiRTTI* GetRTTI() const override; // 02
NiObject* CreateClone(NiCloningProcess& a_cloning) override; // 17

// add
virtual bool IsOcclusionPlane() const = 0; // 25
virtual bool IsOcclusionBox() const = 0; // 25

// members
NiPoint3 translation; // 10
NiMatrix3 rotation; // 1C
float unk40; // 40
bool unk44; // 44
};
static_assert(sizeof(BSOcclusionShape) == 0x48);
}
35 changes: 35 additions & 0 deletions include/RE/B/BSParabolicCullingProcess.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#pragma once

#include "RE/B/BSCullingProcess.h"

namespace RE
{
class BSShaderAccumulator;

class BSParabolicCullingProcess : public BSCullingProcess
{
public:
inline static constexpr auto RTTI = RTTI_BSParabolicCullingProcess;
inline static constexpr auto VTABLE = VTABLE_BSParabolicCullingProcess;

// override (BSCullingProcess)
const NiRTTI* GetRTTI() const override; // 00

~BSParabolicCullingProcess() override; // 15

virtual void Process1(NiAVObject* a_object, std::uint32_t a_arg2) override; // 16
virtual void Process2(const NiCamera* a_camera, NiAVObject* a_scene, NiVisibleArray* a_visibleSet) override; // 17
virtual void AppendNonAccum(NiAVObject& a_object) override; // 19
virtual bool TestBaseVisibility1(BSMultiBound& a_bound) override; // 1A
virtual bool TestBaseVisibility2(BSOcclusionPlane& a_bound) override; // 1B
[[nodiscard]] virtual bool TestBaseVisibility3(const NiBound& a_bound) const override; // 1C

float unk301F8; // 301F8
NiPointer<BSShaderAccumulator> backHemisphereAccumulator; // 30200
NiPlane equatorialPlane; // 30208
NiPoint3 lightPosition; // 30218
float lightRadius; // 30224
NiPointer<NiCamera> lightCamera; // 30228
};
static_assert(sizeof(BSParabolicCullingProcess) == 0x30230);
}
29 changes: 29 additions & 0 deletions include/RE/B/BSPortal.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#pragma once

#include "RE/B/BSOcclusionPlane.h"

namespace RE
{
class BSMultiBoundRoom;
class BSPortalSharedNode;

class BSPortal : public BSOcclusionPlane
{
public:
inline static constexpr auto RTTI = RTTI_BSPortal;
inline static constexpr auto Ni_RTTI = NiRTTI_BSPortal;
inline static constexpr auto VTABLE = VTABLE_BSPortal;

~BSPortal() override; // 00

// override (BSOcclusionPlane)
const NiRTTI* GetRTTI() const override; // 02
NiObject* CreateClone(NiCloningProcess& a_cloning) override; // 17

// members
BSMultiBoundRoom* entranceRoom; // 118
BSMultiBoundRoom* exitRoom; // 120
NiPointer<BSPortalSharedNode> portalSharedNode; // 128
};
static_assert(sizeof(BSPortal) == 0x130);
}
48 changes: 32 additions & 16 deletions include/RE/B/BSPortalGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

namespace RE
{
class BSMultiBoundRoom;
class BSOcclusionShape;
class BSPortal;
class BSPortalSharedNode;
class NiAVObject;
class NiNode;

Expand All @@ -15,25 +19,37 @@ namespace RE
inline static constexpr auto RTTI = RTTI_BSPortalGraph;
inline static constexpr auto VTABLE = VTABLE_BSPortalGraph;

template <typename T>
struct ListEntry
{
ListEntry<T>* next; // 00
ListEntry<T>* prev; // 08
T* value; // 10
};
static_assert(sizeof(ListEntry<BSPortal>) == 0x18);

template <typename T>
struct List
{
ListEntry<T>* first; // 00
ListEntry<T>* last; // 08
uint32_t count; // 10
};
static_assert(sizeof(List<BSPortal>) == 0x18);

~BSPortalGraph() override; // 00

// members
std::uint64_t unk10; // 10
std::uint64_t unk18; // 18
std::uint32_t unk20; // 20
std::uint32_t unk24; // 24
std::uint64_t unk28; // 28
std::uint64_t unk30; // 30
std::uint32_t unk38; // 38
std::uint32_t unk3C; // 3C
BSTArray<void*> unk40; // 40
BSTArray<void*> unk58; // 58
NiPointer<NiNode> portalSharedNode; // 70
BSTArray<NiPointer<NiAVObject>> unk78; // 78
BSTArray<NiPointer<NiAVObject>> unk90; // 90
BSTArray<void*> unkA8; // A8
FormID cellID; // C0
std::uint32_t padC4; // C4
List<BSOcclusionShape> occlusionShapes; // 10
List<BSPortal> portals; // 28
BSTArray<NiPointer<BSMultiBoundRoom>> rooms; // 40
BSTArray<NiPointer<NiAVObject>> unk58; // 58
NiPointer<BSPortalSharedNode> portalSharedNode; // 70
BSTArray<NiPointer<NiAVObject>> unk78; // 78
BSTArray<NiPointer<NiAVObject>> unk90; // 90
BSTArray<void*> unkA8; // A8
FormID cellID; // C0
std::uint32_t padC4; // C4
};
static_assert(sizeof(BSPortalGraph) == 0xC8);
}
32 changes: 32 additions & 0 deletions include/RE/B/BSPortalGraphEntry.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include "RE/B/BSCompoundFrustum.h"
#include "RE/B/BSTHashMap.h"
#include "RE/N/NiRefObject.h"
#include "RE/N/NiSmartPointer.h"

namespace RE
{
class BSMultiBoundRoom;
class BSPortalGraph;
class NiNode;

class BSPortalGraphEntry : public NiRefObject
{
public:
inline static constexpr auto RTTI = RTTI_BSPortalGraphEntry;
inline static constexpr auto VTABLE = VTABLE_BSPortalGraphEntry;

~BSPortalGraphEntry() override; // 00

// members
BSPortalGraph* portalGraph; // 10
BSTArray<NiPointer<BSMultiBoundRoom>> rooms; // 18
NiPointer<BSMultiBoundRoom> room; // 30
BSTHashMap<NiNode*, BSCompoundFrustum*> nodes; // 38
BSCompoundFrustum compoundFrustum; // 68
uint64_t unk130; // 130
uint32_t cellId; // 138
};
static_assert(sizeof(BSPortalGraphEntry) == 0x140);
}
Loading

0 comments on commit 1ac5d9d

Please sign in to comment.