From 1ac5d9d12ca828300194be193b974818d208816c Mon Sep 17 00:00:00 2001 From: Ilya Perapechka Date: Mon, 21 Oct 2024 17:02:04 +0300 Subject: [PATCH 1/2] feat: portals stuff RE. --- include/RE/B/BSCompoundFrustum.h | 26 ++++++++++ include/RE/B/BSLight.h | 65 +++++++++++++----------- include/RE/B/BSOcclusionBox.h | 51 +++++++++++++++++++ include/RE/B/BSOcclusionPlane.h | 29 +++++++++++ include/RE/B/BSOcclusionShape.h | 33 ++++++++++++ include/RE/B/BSParabolicCullingProcess.h | 35 +++++++++++++ include/RE/B/BSPortal.h | 29 +++++++++++ include/RE/B/BSPortalGraph.h | 48 +++++++++++------ include/RE/B/BSPortalGraphEntry.h | 32 ++++++++++++ include/RE/B/BSPortalSharedNode.h | 30 +++++++++++ include/RE/Skyrim.h | 8 +++ 11 files changed, 339 insertions(+), 47 deletions(-) create mode 100644 include/RE/B/BSCompoundFrustum.h create mode 100644 include/RE/B/BSOcclusionBox.h create mode 100644 include/RE/B/BSOcclusionPlane.h create mode 100644 include/RE/B/BSOcclusionShape.h create mode 100644 include/RE/B/BSParabolicCullingProcess.h create mode 100644 include/RE/B/BSPortal.h create mode 100644 include/RE/B/BSPortalGraphEntry.h create mode 100644 include/RE/B/BSPortalSharedNode.h diff --git a/include/RE/B/BSCompoundFrustum.h b/include/RE/B/BSCompoundFrustum.h new file mode 100644 index 000000000..04f6bda29 --- /dev/null +++ b/include/RE/B/BSCompoundFrustum.h @@ -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 unk00; // 00 + BSTArray 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); +} diff --git a/include/RE/B/BSLight.h b/include/RE/B/BSLight.h index 145a88ec0..9ecc2c01e 100644 --- a/include/RE/B/BSLight.h +++ b/include/RE/B/BSLight.h @@ -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 @@ -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 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 unk0D8; // 0D8 - BSTArray unk0F0; // 0F0 - BSTArray unk108; // 108 - BSPortalGraph* portalGraph; // 120 - BSCullingProcess* cullingProcess; // 128 - NiPointer 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 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 rooms; // 0D8 + BSTArray portals; // 0F0 + BSTArray portalSharedNodes; // 108 + BSPortalGraph* portalGraph; // 120 + BSCullingProcess* cullingProcess; // 128 + NiPointer objectNode; // 130 + BSLensFlareRenderData* lensFlareData; // 138 }; static_assert(sizeof(BSLight) == 0x140); } diff --git a/include/RE/B/BSOcclusionBox.h b/include/RE/B/BSOcclusionBox.h new file mode 100644 index 000000000..b38c75d72 --- /dev/null +++ b/include/RE/B/BSOcclusionBox.h @@ -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); +} diff --git a/include/RE/B/BSOcclusionPlane.h b/include/RE/B/BSOcclusionPlane.h new file mode 100644 index 000000000..7a50d4291 --- /dev/null +++ b/include/RE/B/BSOcclusionPlane.h @@ -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); +} diff --git a/include/RE/B/BSOcclusionShape.h b/include/RE/B/BSOcclusionShape.h new file mode 100644 index 000000000..e86625c51 --- /dev/null +++ b/include/RE/B/BSOcclusionShape.h @@ -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); +} diff --git a/include/RE/B/BSParabolicCullingProcess.h b/include/RE/B/BSParabolicCullingProcess.h new file mode 100644 index 000000000..ffdedc474 --- /dev/null +++ b/include/RE/B/BSParabolicCullingProcess.h @@ -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 backHemisphereAccumulator; // 30200 + NiPlane equatorialPlane; // 30208 + NiPoint3 lightPosition; // 30218 + float lightRadius; // 30224 + NiPointer lightCamera; // 30228 + }; + static_assert(sizeof(BSParabolicCullingProcess) == 0x30230); +} diff --git a/include/RE/B/BSPortal.h b/include/RE/B/BSPortal.h new file mode 100644 index 000000000..8d6e3117e --- /dev/null +++ b/include/RE/B/BSPortal.h @@ -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 portalSharedNode; // 128 + }; + static_assert(sizeof(BSPortal) == 0x130); +} diff --git a/include/RE/B/BSPortalGraph.h b/include/RE/B/BSPortalGraph.h index 6425aa81e..d3a25c6d5 100644 --- a/include/RE/B/BSPortalGraph.h +++ b/include/RE/B/BSPortalGraph.h @@ -6,6 +6,10 @@ namespace RE { + class BSMultiBoundRoom; + class BSOcclusionShape; + class BSPortal; + class BSPortalSharedNode; class NiAVObject; class NiNode; @@ -15,25 +19,37 @@ namespace RE inline static constexpr auto RTTI = RTTI_BSPortalGraph; inline static constexpr auto VTABLE = VTABLE_BSPortalGraph; + template + struct ListEntry + { + ListEntry* next; // 00 + ListEntry* prev; // 08 + T* value; // 10 + }; + static_assert(sizeof(ListEntry) == 0x18); + + template + struct List + { + ListEntry* first; // 00 + ListEntry* last; // 08 + uint32_t count; // 10 + }; + static_assert(sizeof(List) == 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 unk40; // 40 - BSTArray unk58; // 58 - NiPointer portalSharedNode; // 70 - BSTArray> unk78; // 78 - BSTArray> unk90; // 90 - BSTArray unkA8; // A8 - FormID cellID; // C0 - std::uint32_t padC4; // C4 + List occlusionShapes; // 10 + List portals; // 28 + BSTArray> rooms; // 40 + BSTArray> unk58; // 58 + NiPointer portalSharedNode; // 70 + BSTArray> unk78; // 78 + BSTArray> unk90; // 90 + BSTArray unkA8; // A8 + FormID cellID; // C0 + std::uint32_t padC4; // C4 }; static_assert(sizeof(BSPortalGraph) == 0xC8); } diff --git a/include/RE/B/BSPortalGraphEntry.h b/include/RE/B/BSPortalGraphEntry.h new file mode 100644 index 000000000..aa0d5a8e1 --- /dev/null +++ b/include/RE/B/BSPortalGraphEntry.h @@ -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> rooms; // 18 + NiPointer room; // 30 + BSTHashMap nodes; // 38 + BSCompoundFrustum compoundFrustum; // 68 + uint64_t unk130; // 130 + uint32_t cellId; // 138 + }; + static_assert(sizeof(BSPortalGraphEntry) == 0x140); +} diff --git a/include/RE/B/BSPortalSharedNode.h b/include/RE/B/BSPortalSharedNode.h new file mode 100644 index 000000000..ba6582f3b --- /dev/null +++ b/include/RE/B/BSPortalSharedNode.h @@ -0,0 +1,30 @@ +#pragma once + +#include "RE/B/BSTArray.h" +#include "RE/N/NiNode.h" + +namespace RE +{ + class BSLight; + class BSPortal; + + class BSPortalSharedNode : public NiNode + { + public: + inline static constexpr auto RTTI = RTTI_BSPortalSharedNode; + inline static constexpr auto Ni_RTTI = NiRTTI_BSPortalSharedNode; + inline static constexpr auto VTABLE = VTABLE_BSPortalSharedNode; + + ~BSPortalSharedNode() override; // 00 + + // override (NiNode) + const NiRTTI* GetRTTI() const override; // 02 + NiObject* CreateClone(NiCloningProcess& a_cloning) override; // 17 + void OnVisible(NiCullingProcess& a_process) override; // 34 + + // members + BSTArray lights; // 128 + BSPortal* portal; // 140 + }; + static_assert(sizeof(BSPortalSharedNode) == 0x148); +} diff --git a/include/RE/Skyrim.h b/include/RE/Skyrim.h index 8c806340c..38197b515 100644 --- a/include/RE/Skyrim.h +++ b/include/RE/Skyrim.h @@ -218,6 +218,7 @@ #include "RE/B/BSBitField.h" #include "RE/B/BSBloodSplatterShaderProperty.h" #include "RE/B/BSBound.h" +#include "RE/B/BSCompoundFrustum.h" #include "RE/B/BSComputeShader.h" #include "RE/B/BSContainer.h" #include "RE/B/BSCullingProcess.h" @@ -296,10 +297,14 @@ #include "RE/B/BSNavmeshInfoMap.h" #include "RE/B/BSNiAllocator.h" #include "RE/B/BSNiNode.h" +#include "RE/B/BSOcclusionBox.h" +#include "RE/B/BSOcclusionPlane.h" +#include "RE/B/BSOcclusionShape.h" #include "RE/B/BSOrderedNode.h" #include "RE/B/BSPCGamepadDeviceDelegate.h" #include "RE/B/BSPCGamepadDeviceHandler.h" #include "RE/B/BSPCOrbisGamepadDevice.h" +#include "RE/B/BSParabolicCullingProcess.h" #include "RE/B/BSParticleShaderCubeEmitter.h" #include "RE/B/BSParticleShaderEmitter.h" #include "RE/B/BSParticleShaderObjectEmitter.h" @@ -310,7 +315,10 @@ #include "RE/B/BSPointerHandle.h" #include "RE/B/BSPointerHandleManager.h" #include "RE/B/BSPointerHandleSmartPointer.h" +#include "RE/B/BSPortal.h" #include "RE/B/BSPortalGraph.h" +#include "RE/B/BSPortalGraphEntry.h" +#include "RE/B/BSPortalSharedNode.h" #include "RE/B/BSPrecomputedNavmeshInfoPathMap.h" #include "RE/B/BSReloadShaderI.h" #include "RE/B/BSRenderPass.h" From cd9ee485408d87f05f2c8374ffeaa113e64c3b62 Mon Sep 17 00:00:00 2001 From: Jonahex Date: Mon, 21 Oct 2024 14:02:51 +0000 Subject: [PATCH 2/2] maintenance --- cmake/sourcelist.cmake | 8 ++++++++ include/RE/B/BSParabolicCullingProcess.h | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/cmake/sourcelist.cmake b/cmake/sourcelist.cmake index 77176eb8f..9b758a083 100644 --- a/cmake/sourcelist.cmake +++ b/cmake/sourcelist.cmake @@ -215,6 +215,7 @@ set(SOURCES include/RE/B/BSBitField.h include/RE/B/BSBloodSplatterShaderProperty.h include/RE/B/BSBound.h + include/RE/B/BSCompoundFrustum.h include/RE/B/BSComputeShader.h include/RE/B/BSContainer.h include/RE/B/BSCoreTypes.h @@ -294,10 +295,14 @@ set(SOURCES include/RE/B/BSNavmeshInfoMap.h include/RE/B/BSNiAllocator.h include/RE/B/BSNiNode.h + include/RE/B/BSOcclusionBox.h + include/RE/B/BSOcclusionPlane.h + include/RE/B/BSOcclusionShape.h include/RE/B/BSOrderedNode.h include/RE/B/BSPCGamepadDeviceDelegate.h include/RE/B/BSPCGamepadDeviceHandler.h include/RE/B/BSPCOrbisGamepadDevice.h + include/RE/B/BSParabolicCullingProcess.h include/RE/B/BSParticleShaderCubeEmitter.h include/RE/B/BSParticleShaderEmitter.h include/RE/B/BSParticleShaderObjectEmitter.h @@ -308,7 +313,10 @@ set(SOURCES include/RE/B/BSPointerHandle.h include/RE/B/BSPointerHandleManager.h include/RE/B/BSPointerHandleSmartPointer.h + include/RE/B/BSPortal.h include/RE/B/BSPortalGraph.h + include/RE/B/BSPortalGraphEntry.h + include/RE/B/BSPortalSharedNode.h include/RE/B/BSPrecomputedNavmeshInfoPathMap.h include/RE/B/BSReloadShaderI.h include/RE/B/BSRenderPass.h diff --git a/include/RE/B/BSParabolicCullingProcess.h b/include/RE/B/BSParabolicCullingProcess.h index ffdedc474..e01d73838 100644 --- a/include/RE/B/BSParabolicCullingProcess.h +++ b/include/RE/B/BSParabolicCullingProcess.h @@ -13,7 +13,7 @@ namespace RE inline static constexpr auto VTABLE = VTABLE_BSParabolicCullingProcess; // override (BSCullingProcess) - const NiRTTI* GetRTTI() const override; // 00 + const NiRTTI* GetRTTI() const override; // 00 ~BSParabolicCullingProcess() override; // 15