Skip to content

Commit

Permalink
RE shadow stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
powerof3 committed Dec 28, 2024
1 parent f1ffe13 commit c6521b0
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 81 deletions.
2 changes: 2 additions & 0 deletions cmake/sourcelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,9 @@ set(SOURCES
include/RE/B/BSShaderPropertyLightData.h
include/RE/B/BSShaderRenderTargets.h
include/RE/B/BSShaderTextureSet.h
include/RE/B/BSShadowFrustumLight.h
include/RE/B/BSShadowLight.h
include/RE/B/BSShadowParabolicLight.h
include/RE/B/BSSimpleScaleController.h
include/RE/B/BSSkyShaderProperty.h
include/RE/B/BSSmallBlockAllocator.h
Expand Down
3 changes: 2 additions & 1 deletion include/RE/B/BSCullingProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ namespace RE
class BSCompoundFrustum;
class BSMultiBound;
class BSOcclusionPlane;
class BSPortalGraphEntry;
class NiAVObject;
class NiBound;

Expand Down Expand Up @@ -60,7 +61,7 @@ namespace RE
std::uint64_t unk30178; // 30178
std::uint64_t unk30180; // 30180
std::uint64_t unk30188; // 30188
void* unk30190; // 30190
BSPortalGraphEntry* portalGraphEntry; // 30190
std::int32_t cullMode; // 30198
BSCompoundFrustum* compoundFrustum; // 301A0
std::uint64_t unk301A8; // 301A8
Expand Down
66 changes: 33 additions & 33 deletions include/RE/B/BSLight.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ namespace RE
inline static constexpr auto VTABLE = VTABLE_BSLight;

template <class T>
class FadeNodeListT : public NiTPointerList<T>
class NodeListT : public NiTPointerList<T>
{
public:
NiTListItem<NiPointer<BSFadeNode>>* fence; // 18
NiTListItem<T>* fence; // 18
};
static_assert(sizeof(FadeNodeListT<void*>) == 0x20);
static_assert(sizeof(NodeListT<void*>) == 0x20);

~BSLight() override; // 00

Expand All @@ -39,36 +39,36 @@ namespace RE
virtual bool IsShadowLight(); // 03

// members
float luminance; // 010
float lodDimmer; // 014
FadeNodeListT<NiPointer<BSTriShape>> geomListFence; // 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
NiTListItem<NiPointer<BSTriShape>>* fenceShape; // 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
float luminance; // 010
float lodDimmer; // 014
NodeListT<NiPointer<BSTriShape>> geomList; // 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
NiTListItem<NiPointer<BSTriShape>>* geomListFence; // 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);
}
30 changes: 30 additions & 0 deletions include/RE/B/BSShadowFrustumLight.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#pragma once

#include "RE/B/BSShadowLight.h"

namespace RE
{
class BSShadowFrustumLight : public BSShadowLight
{
public:
inline static constexpr auto RTTI = RTTI_BSShadowFrustumLight;
inline static constexpr auto VTABLE = VTABLE_BSShadowFrustumLight;

~BSShadowFrustumLight() override; // 00

// override (BSShadowLight)
void Unk_04() override; // 04
bool GetIsFrustumLight() override; // 05
void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, NiPointer<NiAVObject> a_cullingScene) override; // 09
void Render() override; // 0A
bool UpdateCamera(const NiCamera* a_viewCamera) override; // 10

// members
float xFOV; // 560
float yFOV; // 564
float falloff; // 568
float nearDistance; // 56C
float farDistance; // 570
};
static_assert(sizeof(BSShadowFrustumLight) == 0x578);
}
89 changes: 42 additions & 47 deletions include/RE/B/BSShadowLight.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#pragma once

#include "RE/B/BSLight.h"
#include "RE/N/NiPlane.h"
#include "RE/N/NiFrustumPlanes.h"
#include "RE/N/NiRect.h"

namespace RE
{
Expand All @@ -11,60 +12,54 @@ namespace RE
inline static constexpr auto RTTI = RTTI_BSShadowLight;
inline static constexpr auto VTABLE = VTABLE_BSShadowLight;

struct Data
struct ShadowMapData
{
std::uint8_t unk0[64]; // 00
std::uint64_t unk40; // 40
std::uint64_t unk48; // 48
std::uint64_t unk50; // 50
std::uint32_t unk58; // 58
NiPlane planes[6]; // 5C
std::uint32_t unkBC; // BC
std::uint32_t unkC0; // C0
std::uint32_t unkC4; // C4
std::uint32_t unkCC; // CC
std::uint64_t unkD0; // D4
std::uint32_t unkDC; // DC
std::uint64_t unkE0; // E0
std::uint16_t unkE8; // E8
REX::W32::XMFLOAT4X4 projection; // 00
NiPointer<NiCamera> camera; // 40
NiPointer<BSShaderAccumulator> shaderAccumulator; // 48
std::uint32_t unk50; // 50
RENDER_TARGET_DEPTHSTENCIL renderTarget; // 54
std::uint32_t shadowMapIndex; // 58
NiFrustumPlanes clipPlanes; // 5C
std::uint32_t unitsPerTexel; // CC
NiRect<std::uint32_t> shadowMapRect; // D0
BSCullingProcess* cullingProcess; // E0
bool clearRenderTarget; // E8
};
static_assert(sizeof(Data) == 0xF0);
static_assert(sizeof(ShadowMapData) == 0xF0);

~BSShadowLight() override; // 00

// add
virtual void Unk_04(); // 04
virtual void Unk_05(); // 05
virtual void Unk_06(); // 06
virtual void Unk_07(); // 07
virtual void Unk_08(); // 08
virtual void Unk_09() = 0; // 09
virtual void Unk_0A() = 0; // 0A
virtual void Unk_0B(); // 0B
virtual void Unk_0C(); // 0C
virtual void Unk_0D(); // 0D
virtual void Unk_0E(); // 0E
virtual void Unk_0F(); // 0F
virtual void Unk_10() = 0; // 10
virtual void Unk_04(); // 04
virtual bool GetIsFrustumLight(); // 05
virtual void GetIsDirectionalLight(); // 06
virtual bool GetIsParabolicLight(); // 07
virtual bool GetIsOmniLight(); // 08
virtual void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, NiPointer<NiAVObject> a_cullingScene) = 0; // 09
virtual void Render() = 0; // 0A
virtual void SetShadowMapCount(std::uint32_t a_count); // 0B
virtual void ClearShadowMapData(); // 0C
virtual void Unk_0D(); // 0D
virtual void Unk_0E(); // 0E
virtual void Unk_0F(); // 0F
virtual bool UpdateCamera(const NiCamera* a_viewCamera) = 0; // 10

// members
std::uint32_t unk140; // 140
std::uint32_t unk144; // 144
BSTArray<void*> unk148; // 148
Data unk160[4]; // 161
std::uint32_t maskIndex; // 520
std::uint32_t unk524; // 524
BSTArray<void*> unk528; // 528
float shadowBiasScale; // 540
std::uint32_t sceneGraphIndex; // 544
std::uint32_t unk548; // 548
std::uint32_t unk54C; // 54C
std::uint32_t unk550; // 550
std::uint32_t unk554; // 554
std::uint8_t unk558; // 558
std::uint8_t pad559; // 559
std::uint8_t pad55A; // 55A
std::uint32_t pad55B; // 55B
std::uint32_t shadowMapIndex; // 140
std::uint32_t unk144; // 144
BSTArray<ShadowMapData> shadowMapDataList; // 148
ShadowMapData shadowMapData[4]; // 161
std::uint32_t maskIndex; // 520
std::uint32_t accumulatedIndex; // 524
BSTArray<NiPointer<NiAVObject>> sceneAccumArray; // 528
float shadowBiasScale; // 540
NiRect<std::uint32_t> projectedBoundingBox; // 544
std::uint32_t sceneGraphIndex; // 554
std::uint8_t unk558; // 558
std::uint8_t pad559; // 559
std::uint8_t pad55A; // 55A
std::uint32_t pad55B; // 55B
};
static_assert(sizeof(BSShadowLight) == 0x560);
}
27 changes: 27 additions & 0 deletions include/RE/B/BSShadowParabolicLight.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
#pragma once

#include "RE/B/BSShadowLight.h"

namespace RE
{
class BSShadowParabolicLight : public BSShadowLight
{
public:
inline static constexpr auto RTTI = RTTI_BSShadowParabolicLight;
inline static constexpr auto VTABLE = VTABLE_BSShadowParabolicLight;

~BSShadowParabolicLight() override; // 00

// override (BSShadowLight)
bool GetIsParabolicLight() override; // 07
bool GetIsOmniLight() override; // 08
void Accumulate(std::uint32_t& a_globalShadowLightCount, std::uint32_t& a_shadowMaskChannel, NiPointer<NiAVObject> a_cullingScene) override; // 09
void Render() override; // 0A
void SetShadowMapCount(std::uint32_t a_count) override; // 0B
void ClearShadowMapData() override; // 0C
void Unk_0D() override; // 0D
void Unk_0E() override; // 0E
bool UpdateCamera(const NiCamera* a_viewCamera) override; // 10
};
static_assert(sizeof(BSShadowParabolicLight) == 0x560);
}
2 changes: 2 additions & 0 deletions include/RE/Skyrim.h
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@
#include "RE/B/BSShaderPropertyLightData.h"
#include "RE/B/BSShaderRenderTargets.h"
#include "RE/B/BSShaderTextureSet.h"
#include "RE/B/BSShadowFrustumLight.h"
#include "RE/B/BSShadowLight.h"
#include "RE/B/BSShadowParabolicLight.h"
#include "RE/B/BSSimpleScaleController.h"
#include "RE/B/BSSkyShaderProperty.h"
#include "RE/B/BSSmallBlockAllocator.h"
Expand Down

0 comments on commit c6521b0

Please sign in to comment.