CommonLibSSE NG
BSGeometry.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/N/NiAVObject.h"
4 #include "RE/N/NiSkinPartition.h"
5 #include "RE/N/NiSmartPointer.h"
6 
7 namespace RE
8 {
9  class BSMultiIndexTriShape;
10  class BSSkinnedDecalTriShape;
11  class NiProperty;
12  class NiSkinInstance;
13 
14  class BSGeometry : public NiAVObject
15  {
16  public:
17  inline static constexpr auto RTTI = RTTI_BSGeometry;
18  inline static auto Ni_RTTI = NiRTTI_BSGeometry;
19 
20  enum class Type
21  {
22  kGeometry = 0,
23  kParticles = 1,
24  kStripParticles = 2,
25  kTriShape = 3,
26  kDynamicTriShape = 4,
27  kMeshLODTriShape = 5,
34  kLines = 12,
35  kDynamicLines = 13,
36  kInstanceGroup = 14
37  };
38 
39  struct States
40  {
41  enum State
42  {
45  kTotal
46  };
47  };
48 
49  struct MODEL_DATA
50  {
51 #if !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
52 # define MODEL_DATA_CONTENT \
53  NiBound modelBound; /* 0 */ \
54  NiPoint3 unk148; /* 10 */ \
55  NiPoint3 unk154; /* 2C */
56 #else
57 # define MODEL_DATA_CONTENT NiBound modelBound; /* 0 */
58 #endif
60  };
61 #ifndef ENABLE_SKYRIM_VR
62  static_assert(sizeof(MODEL_DATA) == 0x10);
63 #elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
64  static_assert(sizeof(MODEL_DATA) == 0x28);
65 #endif
66 
68  {
69 #define RUNTIME_DATA_CONTENT \
70  NiPointer<NiProperty> properties[States::kTotal]; /* 00 */ \
71  NiPointer<NiSkinInstance> skinInstance; /* 10 */ \
72  BSGraphics::TriShape* rendererData; /* 18 */ \
73  void* unk20; /* 20 - smart ptr */ \
74  BSGraphics::VertexDesc vertexDesc; /* 28 */
75 
77  };
78  static_assert(sizeof(GEOMETRY_RUNTIME_DATA) == 0x30);
79 
80  ~BSGeometry() override; // 00
81 
82  // override (NiAVObject)
83  const NiRTTI* GetRTTI() const override; // 02
84  BSGeometry* AsGeometry() override; // 07 - { return this; }
85  void LoadBinary(NiStream& a_stream) override; // 18
86  void LinkObject(NiStream& a_stream) override; // 19
87  bool RegisterStreamables(NiStream& a_stream) override; // 1A
88  void SaveBinary(NiStream& a_stream) override; // 1B
89  bool IsEqual(NiObject* a_object) override; // 1C - { return false; }
90  void ProcessClone(NiCloningProcess& a_cloning) override; // 1D
91  void PostLinkObject(NiStream& a_stream) override; // 1E
92 #ifndef SKYRIM_CROSS_VR
93  // The following are virtual functions past the point where VR compatibility breaks.
94  void AttachProperty(NiAlphaProperty* a_property) override; // 27
95  void SetSelectiveUpdateFlags(bool& a_selectiveUpdate, bool a_selectiveUpdateTransforms, bool& a_rigid) override; // 2B
96  void UpdateDownwardPass(NiUpdateData& a_data, std::uint32_t a_arg2) override; // 2C
97  void UpdateSelectedDownwardPass(NiUpdateData& a_data, std::uint32_t a_arg2) override; // 2D
98  void UpdateRigidDownwardPass(NiUpdateData& a_data, std::uint32_t a_arg2) override; // 2E
99  void UpdateWorldBound() override; // 2F
100  void OnVisible(NiCullingProcess& a_process) override; // 34
101 #endif
102 
103  // add
105  SKYRIM_REL_VR_VIRTUAL BSSkinnedDecalTriShape* AsSkinnedDecalTriShape(); // 36 - { return 0; }
106  SKYRIM_REL_VR_VIRTUAL void Unk_37(void); // 37 - { return 0; }
107 
108  [[nodiscard]] inline MODEL_DATA& GetModelData() noexcept
109  {
110  return REL::RelocateMember<MODEL_DATA>(this, 0x110, 0x138);
111  }
112 
113  [[nodiscard]] inline const MODEL_DATA& GetModelData() const noexcept
114  {
115  return REL::RelocateMember<MODEL_DATA>(this, 0x110, 0x138);
116  }
117 
118  [[nodiscard]] inline GEOMETRY_RUNTIME_DATA& GetGeometryRuntimeData() noexcept
119  {
120  return REL::RelocateMember<GEOMETRY_RUNTIME_DATA>(this, 0x120, 0x160);
121  }
122 
123  [[nodiscard]] inline const GEOMETRY_RUNTIME_DATA& GetGeometryRuntimeData() const noexcept
124  {
125  return REL::RelocateMember<GEOMETRY_RUNTIME_DATA>(this, 0x120, 0x160);
126  }
127 
128  [[nodiscard]] inline stl::enumeration<Type, std::uint8_t>& GetType() noexcept
129  {
130  return REL::RelocateMember<stl::enumeration<Type, std::uint8_t>>(this, 0x150, 0x190);
131  }
132 
133  [[nodiscard]] inline const stl::enumeration<Type, std::uint8_t>& GetType() const noexcept
134  {
135  return REL::RelocateMember<stl::enumeration<Type, std::uint8_t>>(this, 0x150, 0x190);
136  }
137 
138  // members
139 #ifndef SKYRIM_CROSS_VR
140  MODEL_DATA_CONTENT; // 110, 138
141  RUNTIME_DATA_CONTENT; // 120, 160
142 # ifndef ENABLE_SKYRIM_VR
144  std::uint8_t pad31; // 151
145  std::uint16_t pad32; // 152
146  std::uint32_t pad34; // 154
147 # elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
149  std::uint8_t pad31; // 194
150  std::uint16_t pad32; // 195
151  std::uint32_t pad34; // 197
152 # endif
153 #endif
154  };
155 #ifndef ENABLE_SKYRIM_VR
156  static_assert(sizeof(BSGeometry) == 0x158);
157 #elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
158  static_assert(sizeof(BSGeometry) == 0x1A0);
159 #endif
160 }
161 #undef MODEL_DATA_CONTENT
162 #undef RUNTIME_DATA_CONTENT
#define SKYRIM_REL_VR_VIRTUAL
Definition: Common.h:94
Definition: BSGeometry.h:15
Type
Definition: BSGeometry.h:21
void SetSelectiveUpdateFlags(bool &a_selectiveUpdate, bool a_selectiveUpdateTransforms, bool &a_rigid) override
void UpdateRigidDownwardPass(NiUpdateData &a_data, std::uint32_t a_arg2) override
const stl::enumeration< Type, std::uint8_t > & GetType() const noexcept
Definition: BSGeometry.h:133
std::uint32_t pad34
Definition: BSGeometry.h:146
void SaveBinary(NiStream &a_stream) override
RUNTIME_DATA_CONTENT
Definition: BSGeometry.h:141
std::uint16_t pad32
Definition: BSGeometry.h:145
static auto Ni_RTTI
Definition: BSGeometry.h:18
stl::enumeration< Type, std::uint8_t > & GetType() noexcept
Definition: BSGeometry.h:128
void OnVisible(NiCullingProcess &a_process) override
bool IsEqual(NiObject *a_object) override
static constexpr auto RTTI
Definition: BSGeometry.h:17
const MODEL_DATA & GetModelData() const noexcept
Definition: BSGeometry.h:113
void ProcessClone(NiCloningProcess &a_cloning) override
SKYRIM_REL_VR_VIRTUAL void Unk_37(void)
const NiRTTI * GetRTTI() const override
const GEOMETRY_RUNTIME_DATA & GetGeometryRuntimeData() const noexcept
Definition: BSGeometry.h:123
SKYRIM_REL_VR_VIRTUAL BSSkinnedDecalTriShape * AsSkinnedDecalTriShape()
bool RegisterStreamables(NiStream &a_stream) override
~BSGeometry() override
void LinkObject(NiStream &a_stream) override
void UpdateWorldBound() override
void UpdateSelectedDownwardPass(NiUpdateData &a_data, std::uint32_t a_arg2) override
void PostLinkObject(NiStream &a_stream) override
stl::enumeration< Type, std::uint8_t > type
Definition: BSGeometry.h:143
void UpdateDownwardPass(NiUpdateData &a_data, std::uint32_t a_arg2) override
BSGeometry * AsGeometry() override
void LoadBinary(NiStream &a_stream) override
std::uint8_t pad31
Definition: BSGeometry.h:144
SKYRIM_REL_VR_VIRTUAL BSMultiIndexTriShape * AsMultiIndexTriShape()
void AttachProperty(NiAlphaProperty *a_property) override
MODEL_DATA_CONTENT
Definition: BSGeometry.h:140
MODEL_DATA & GetModelData() noexcept
Definition: BSGeometry.h:108
GEOMETRY_RUNTIME_DATA & GetGeometryRuntimeData() noexcept
Definition: BSGeometry.h:118
Definition: BSMultiIndexTriShape.h:19
Definition: NiAVObject.h:50
Definition: NiAlphaProperty.h:8
Definition: NiCloningProcess.h:10
Definition: NiCullingProcess.h:34
Definition: NiObject.h:37
Definition: NiRTTI.h:6
Definition: NiStream.h:29
Definition: NiAVObject.h:25
Definition: AbsorbEffect.h:6
constexpr REL::VariantID NiRTTI_BSGeometry(523951, 410531, 0x316bec8)
constexpr REL::VariantID RTTI_BSGeometry(685043, 392797, 0x1ede7b0)
Definition: BSGeometry.h:68
Definition: BSGeometry.h:50
Definition: BSGeometry.h:40
State
Definition: BSGeometry.h:42
@ kProperty
Definition: BSGeometry.h:43
@ kEffect
Definition: BSGeometry.h:44
@ kTotal
Definition: BSGeometry.h:45