Skip to content

Commit

Permalink
feat: add RE for some shader properties, utility shader and shader em…
Browse files Browse the repository at this point in the history
…itters
  • Loading branch information
FlayaN authored and powerof3 committed Jul 30, 2024
1 parent 89d2b45 commit dbe6e15
Show file tree
Hide file tree
Showing 22 changed files with 388 additions and 19 deletions.
6 changes: 6 additions & 0 deletions cmake/sourcelist.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ set(SOURCES
include/RE/B/BSCullingProcess.h
include/RE/B/BSDirectInputManager.h
include/RE/B/BSDismemberSkinInstance.h
include/RE/B/BSDistantTreeShaderProperty.h
include/RE/B/BSDynamicTriShape.h
include/RE/B/BSEffectShaderData.h
include/RE/B/BSEffectShaderMaterial.h
Expand All @@ -237,6 +238,7 @@ set(SOURCES
include/RE/B/BSGameSound.h
include/RE/B/BSGamepadDevice.h
include/RE/B/BSGeometry.h
include/RE/B/BSGrassShaderProperty.h
include/RE/B/BSHandleRefObject.h
include/RE/B/BSIInputDevice.h
include/RE/B/BSIMusicTrack.h
Expand Down Expand Up @@ -298,6 +300,8 @@ set(SOURCES
include/RE/B/BSParticleShaderEmitter.h
include/RE/B/BSParticleShaderObjectEmitter.h
include/RE/B/BSParticleShaderProperty.h
include/RE/B/BSParticleShaderRainEmitter.h
include/RE/B/BSParticleShaderSnowEmitter.h
include/RE/B/BSPathingCell.h
include/RE/B/BSPointerHandle.h
include/RE/B/BSPointerHandleManager.h
Expand Down Expand Up @@ -325,6 +329,7 @@ set(SOURCES
include/RE/B/BSShaderTextureSet.h
include/RE/B/BSShadowLight.h
include/RE/B/BSSimpleScaleController.h
include/RE/B/BSSkyShaderProperty.h
include/RE/B/BSSmallBlockAllocator.h
include/RE/B/BSSoundHandle.h
include/RE/B/BSStorage.h
Expand Down Expand Up @@ -366,6 +371,7 @@ set(SOURCES
include/RE/B/BSTriShape.h
include/RE/B/BSUIMessageData.h
include/RE/B/BSUIScaleformData.h
include/RE/B/BSUtilityShader.h
include/RE/B/BSValueNode.h
include/RE/B/BSVirtualKeyboardDevice.h
include/RE/B/BSVisit.h
Expand Down
48 changes: 38 additions & 10 deletions include/RE/B/BSBatchRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,38 @@

namespace RE
{
class BSRenderPass;

class BSBatchRenderer
{
public:
inline static constexpr auto RTTI = RTTI_BSBatchRenderer;
inline static constexpr auto VTABLE = VTABLE_BSBatchRenderer;

struct PersistentPassList
{
BSRenderPass* head; // 000
BSRenderPass* tail; // 008
};
static_assert(sizeof(PersistentPassList) == 0x10);

struct GeometryGroup
{
BSBatchRenderer* batchRenderer; // 000
PersistentPassList passList; // 008
std::uintptr_t UnkPtr4; // 018
float depth; // 020 Distance from geometry to camera location
std::uint16_t count; // 024
std::uint8_t flags; // 026
};
static_assert(sizeof(GeometryGroup) == 0x28);

struct PassGroup
{
BSRenderPass* passes[5]; // 000
std::uint32_t validPassBits; // 028 OR'd with (1 << PassIndex)
};
static_assert(sizeof(PassGroup) == 0x30);

virtual ~BSBatchRenderer(); // 00

Expand All @@ -18,16 +46,16 @@ namespace RE
virtual void Unk_03(void); // 03

// members
BSTArray<void*> unk008; // 008
BSTHashMap<UnkKey, UnkValue> unk020; // 020
std::uint64_t unk050; // 050
std::uint64_t unk058; // 058
std::uint64_t unk060; // 060
std::uint64_t unk068; // 068
void* unk070[16]; // 070
std::uint64_t unk0F0; // 0F0
std::uint64_t unk0F8; // 0F8
std::uint64_t unk100; // 100
BSTArray<void*> unk008; // 008
BSTHashMap<UnkKey, UnkValue> unk020; // 020
std::uint64_t unk050; // 050
std::uint64_t unk058; // 058
std::uint64_t unk060; // 060
std::uint64_t unk068; // 068
GeometryGroup* geometryGroups[16]; // 070
GeometryGroup* alphaGroup; // 0F0
void* unk0F8; // 0F8
void* unk100; // 100
};
static_assert(sizeof(BSBatchRenderer) == 0x108);
}
1 change: 1 addition & 0 deletions include/RE/B/BSBloodSplatterShaderProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ namespace RE
public:
inline static constexpr auto RTTI = RTTI_BSBloodSplatterShaderProperty;
inline static constexpr auto Ni_RTTI = NiRTTI_BSBloodSplatterShaderProperty;
inline static constexpr auto VTABLE = VTABLE_BSBloodSplatterShaderProperty;

enum : std::uint32_t
{
Expand Down
32 changes: 32 additions & 0 deletions include/RE/B/BSDistantTreeShaderProperty.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#pragma once

#include "RE/B/BSShaderProperty.h"

namespace RE
{
class BSDistantTreeShaderProperty : public BSShaderProperty
{
public:
inline static constexpr auto RTTI = RTTI_BSDistantTreeShaderProperty;
inline static constexpr auto Ni_RTTI = NiRTTI_BSDistantTreeShaderProperty;
inline static constexpr auto VTABLE = VTABLE_BSDistantTreeShaderProperty;

~BSDistantTreeShaderProperty() override; // 00

// override (BSShaderProperty)
const NiRTTI* GetRTTI() const override; // 02
RenderPassArray* GetRenderPasses(BSGeometry* a_geometry, std::uint32_t a_arg2, BSShaderAccumulator* a_accumulator) override; // 2A
void Unk_2B(void) override; // 2B
void Unk_2F(void) override; // 2F
std::int32_t ForEachTexture(ForEachVisitor& a_visitor) override; // 33
[[nodiscard]] NiSourceTexture* GetBaseTexture() override; // 37

// members
std::uint64_t unk88; // 88
std::uint64_t unk90; // 90
std::uint64_t unk98; // 98
std::uint64_t unkA0; // A0
std::uint64_t unkA8; // A8
};
static_assert(sizeof(BSDistantTreeShaderProperty) == 0xB0);
}
1 change: 1 addition & 0 deletions include/RE/B/BSEffectShaderProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace RE
public:
inline static constexpr auto RTTI = RTTI_BSEffectShaderProperty;
inline static constexpr auto Ni_RTTI = NiRTTI_BSEffectShaderProperty;
inline static constexpr auto VTABLE = VTABLE_BSEffectShaderProperty;

~BSEffectShaderProperty() override; // 00

Expand Down
51 changes: 51 additions & 0 deletions include/RE/B/BSGrassShaderProperty.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#pragma once

#include "RE/B/BSLightingShaderProperty.h"

namespace RE
{
class BSGrassShaderProperty : public BSLightingShaderProperty
{
public:
inline static constexpr auto RTTI = RTTI_BSGrassShaderProperty;
inline static constexpr auto Ni_RTTI = NiRTTI_BSGrassShaderProperty;
inline static constexpr auto VTABLE = VTABLE_BSGrassShaderProperty;

virtual ~BSGrassShaderProperty(); // 00

// override (BSLightingShaderProperty)
const NiRTTI* GetRTTI() const override; // 02
NiObject* CreateClone(NiCloningProcess& a_cloning) override; // 17
void LoadBinary(NiStream& a_stream) override; // 18
void LinkObject(NiStream& a_stream) override; // 19
bool RegisterStreamables(NiStream& a_stream) override; // 1A
void SaveBinary(NiStream& a_stream) override; // 1B
bool IsEqual(NiObject* a_object) override; // 1C
bool SetupGeometry(BSGeometry* a_geometry) override; // 27
RenderPassArray* GetRenderPasses(BSGeometry* a_geometry, std::uint32_t a_arg2, BSShaderAccumulator* a_accumulator) override; // 2A
void Unk_2B(void) override; // 2B
void Unk_2F(void) override; // 2F
std::int32_t QShader() override; // 35

// add
void Unk_3F(void); // 3F
void Unk_40(void); // 40

// members
std::uint64_t unk160; // 160
std::uint64_t unk168; // 168
std::uint64_t unk170; // 170
std::uint64_t unk178; // 178
std::uint64_t unk180; // 180
std::uint64_t unk188; // 188
std::uint64_t unk190; // 190
std::uint64_t unk198; // 198
std::uint64_t unk1A0; // 1A0
std::uint64_t unk1A8; // 1A8
std::uint64_t unk1B0; // 1B0
std::uint64_t unk1B8; // 1B8
std::uint64_t unk1C0; // 1C0
std::uint64_t unk1C8; // 1C8
};
static_assert(sizeof(BSGrassShaderProperty) == 0x1D0);
}
1 change: 1 addition & 0 deletions include/RE/B/BSLightingShaderProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace RE
public:
inline static constexpr auto RTTI = RTTI_BSLightingShaderProperty;
inline static constexpr auto Ni_RTTI = NiRTTI_BSLightingShaderProperty;
inline static constexpr auto VTABLE = VTABLE_BSLightingShaderProperty;

struct Data
{
Expand Down
1 change: 1 addition & 0 deletions include/RE/B/BSParticleShaderCubeEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace RE
{
public:
inline static constexpr auto RTTI = RTTI_BSParticleShaderCubeEmitter;
inline static constexpr auto VTABLE = VTABLE_BSParticleShaderCubeEmitter;

~BSParticleShaderCubeEmitter() override; // 00

Expand Down
1 change: 1 addition & 0 deletions include/RE/B/BSParticleShaderEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace RE
{
public:
inline static constexpr auto RTTI = RTTI_BSParticleShaderEmitter;
inline static constexpr auto VTABLE = VTABLE_BSParticleShaderEmitter;

enum class EMITTER_TYPE
{
Expand Down
1 change: 1 addition & 0 deletions include/RE/B/BSParticleShaderObjectEmitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ namespace RE
{
public:
inline static constexpr auto RTTI = RTTI_BSParticleShaderObjectEmitter;
inline static constexpr auto VTABLE = VTABLE_BSParticleShaderObjectEmitter;

~BSParticleShaderObjectEmitter() override; // 00

Expand Down
1 change: 1 addition & 0 deletions include/RE/B/BSParticleShaderProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ namespace RE
public:
inline static constexpr auto RTTI = RTTI_BSParticleShaderProperty;
inline static constexpr auto Ni_RTTI = NiRTTI_BSParticleShaderProperty;
inline static constexpr auto VTABLE = VTABLE_BSParticleShaderProperty;

virtual ~BSParticleShaderProperty(); // 00

Expand Down
16 changes: 16 additions & 0 deletions include/RE/B/BSParticleShaderRainEmitter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include "RE/B/BSParticleShaderCubeEmitter.h"

namespace RE
{
class BSParticleShaderRainEmitter : public BSParticleShaderCubeEmitter
{
public:
inline static constexpr auto RTTI = RTTI_BSParticleShaderRainEmitter;
inline static constexpr auto VTABLE = VTABLE_BSParticleShaderRainEmitter;

~BSParticleShaderRainEmitter() override; // 00
};
static_assert(sizeof(BSParticleShaderRainEmitter) == 0xFE0);
}
16 changes: 16 additions & 0 deletions include/RE/B/BSParticleShaderSnowEmitter.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#pragma once

#include "RE/B/BSParticleShaderCubeEmitter.h"

namespace RE
{
class BSParticleShaderSnowEmitter : public BSParticleShaderCubeEmitter
{
public:
inline static constexpr auto RTTI = RTTI_BSParticleShaderSnowEmitter;
inline static constexpr auto VTABLE = VTABLE_BSParticleShaderSnowEmitter;

~BSParticleShaderSnowEmitter() override; // 00
};
static_assert(sizeof(BSParticleShaderSnowEmitter) == 0xFE0);
}
13 changes: 12 additions & 1 deletion include/RE/B/BSShaderProperty.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ namespace RE
class BSShaderMaterial;
class BSShaderPropertyLightData;
class NiSourceTexture;
class BSShader;
class BSLight;

class BSShaderProperty : public NiShadeProperty
{
Expand All @@ -21,6 +23,7 @@ namespace RE
public:
inline static constexpr auto RTTI = RTTI_BSShaderProperty;
inline static constexpr auto Ni_RTTI = NiRTTI_BSShaderProperty;
inline static constexpr auto VTABLE = VTABLE_BSShaderProperty;

class ForEachVisitor
{
Expand All @@ -35,7 +38,14 @@ namespace RE

struct RenderPassArray
{
BSRenderPass* head; // 0
BSRenderPass* MakeRenderPass(BSShader* a_shader, BSShaderProperty* a_property, BSGeometry* a_geometry, uint32_t a_technique, uint8_t a_numLights, BSLight** a_lights);
void ClearRenderPass(BSRenderPass* a_pass);
void Clear();
BSRenderPass* EmplacePass(BSShader* a_shader, BSShaderProperty* a_property, BSGeometry* a_geometry,
uint32_t a_technique, uint8_t a_numLights = 0, BSLight* a_light0 = nullptr, BSLight* a_light1 = nullptr,
BSLight* a_light2 = nullptr, BSLight* a_light3 = nullptr);

BSRenderPass* head; // 00
};
static_assert(sizeof(RenderPassArray) == 0x8);

Expand Down Expand Up @@ -215,6 +225,7 @@ namespace RE
void SetEffectShaderData(const BSTSmartPointer<BSEffectShaderData>& a_data);
void SetMaterial(BSShaderMaterial* a_material, bool a_unk1);
void SetFlags(EShaderPropertyFlag8 a_flag, bool a_set);
void LinkMaterial(BSShaderMaterial* a_material, bool a_unk1);

// members
float alpha; // 30
Expand Down
53 changes: 53 additions & 0 deletions include/RE/B/BSSkyShaderProperty.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#pragma once

#include "RE/B/BSShaderProperty.h"

namespace RE
{
class BSSkyShaderProperty : public BSShaderProperty
{
public:
inline static constexpr auto RTTI = RTTI_BSSkyShaderProperty;
inline static auto Ni_RTTI = NiRTTI_BSSkyShaderProperty;
inline static auto VTABLE = VTABLE_BSSkyShaderProperty;

~BSSkyShaderProperty() override; // 00

// override (BSShaderProperty)
const NiRTTI* GetRTTI() const override; // 02
NiObject* CreateClone(NiCloningProcess& a_cloning) override; // 17
void LoadBinary(NiStream& a_stream) override; // 18
void LinkObject(NiStream& a_stream) override; // 19
bool RegisterStreamables(NiStream& a_stream) override; // 1A
void SaveBinary(NiStream& a_stream) override; // 1B
bool IsEqual(NiObject* a_object) override; // 1C
void PostLinkObject(NiStream& a_stream) override; // 1E
RenderPassArray* GetRenderPasses(BSGeometry* a_geometry, std::uint32_t a_arg2, BSShaderAccumulator* a_accumulator) override; // 2A
std::int32_t ForEachTexture(ForEachVisitor& a_visitor) override; // 33
virtual std::int32_t QShader() override; // 35
[[nodiscard]] virtual NiSourceTexture* GetBaseTexture() override; // 37

enum SkyObject
{
SO_SUN = 0x0,
SO_SUN_GLARE = 0x1,
SO_ATMOSPHERE = 0x2,
SO_CLOUDS = 0x3,
SO_SKYQUAD = 0x4,
SO_STARS = 0x5,
SO_MOON = 0x6,
SO_MOON_SHADOW = 0x7,
};

// members
RE::NiColorA kBlendColor; // 088
RE::NiSourceTexture* pBaseTexture; // 098
RE::NiSourceTexture* pBlendTexture; // 0A0
std::uint8_t unk0A8[0x10]; // 0A8
float fBlendValue; // 0B8
std::uint16_t usCloudLayer; // 0BC
bool bFadeSecondTexture; // 0BE
stl::enumeration<SkyObject, std::uint32_t> uiSkyObjectType; // 0BF
};
static_assert(sizeof(BSSkyShaderProperty) == 0xC8);
}
Loading

0 comments on commit dbe6e15

Please sign in to comment.