CommonLibSSE NG
NiAVObject.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSFixedString.h"
5 #include "RE/C/CollisionLayers.h"
6 #include "RE/N/NiBound.h"
7 #include "RE/N/NiObjectNET.h"
8 #include "RE/N/NiSmartPointer.h"
9 #include "RE/N/NiTransform.h"
10 
11 namespace RE
12 {
13  class bhkCollisionObject;
14  class NiAlphaProperty;
15  class NiAVObject;
16  class NiCollisionObject;
17  class NiColor;
18  class NiColorA;
19  class NiCullingProcess;
20  class NiNode;
21  class NiPoint3;
22  class TESObjectREFR;
23 
25  {
26  public:
27  enum class Flag
28  {
29  kNone = 0,
30  kDirty = 1 << 0,
31  kDisableCollision = 1 << 13
32  };
33 
34  float time; // 0
36  };
37  static_assert(sizeof(NiUpdateData) == 0x8);
38 
40  {
41  public:
42  virtual ~PerformOpFunc(); // 00
43 
44  // add
45  virtual bool operator()(NiAVObject* a_object); // 01
46  };
47  static_assert(sizeof(PerformOpFunc) == 0x8);
48 
49  class NiAVObject : public NiObjectNET
50  {
51  public:
52  inline static constexpr auto RTTI = RTTI_NiAVObject;
53  inline static auto Ni_RTTI = NiRTTI_NiAVObject;
54 
55  enum class Flag
56  {
57  kNone = 0,
58  kHidden = 1 << 0,
59  kSelectiveUpdate = 1 << 1,
62  kSelectiveUpdateRigid = 1 << 4,
63  kDisplayObject = 1 << 5,
64  kDisableSorting = 1 << 6,
67  kNoDecals = 1 << 10,
68  kAlwaysDraw = 1 << 11,
69  kMeshLOD = 1 << 12,
70  kFixedBound = 1 << 13,
71  kTopFadeNode = 1 << 14,
72  kIgnoreFade = 1 << 15,
73  kNoAnimSyncX = 1 << 16,
74  kNoAnimSyncY = 1 << 17,
75  kNoAnimSyncZ = 1 << 18,
76  kNoAnimSyncS = 1 << 19,
77  kNoDismember = 1 << 20,
78  kNoDismemberValidity = 1 << 21,
79  kRenderUse = 1 << 22,
80  kMaterialsApplied = 1 << 23,
81  kHighDetail = 1 << 24,
82  kForceUpdate = 1 << 25,
83  kPreProcessedNode = 1 << 26
84  };
85 
86  ~NiAVObject() override; // 00
87 
88  // override (NiObjectNET)
89  const NiRTTI* GetRTTI() const override; // 02
90  void LoadBinary(NiStream& a_stream) override; // 18
91  void LinkObject(NiStream& a_stream) override; // 19
92  bool RegisterStreamables(NiStream& a_stream) override; // 1A
93  void SaveBinary(NiStream& a_stream) override; // 1B
94  bool IsEqual(NiObject* a_object) override; // 1C
95  void ProcessClone(NiCloningProcess& a_cloning) override; // 1D
96 
97  // add
98  virtual void UpdateControllers(NiUpdateData& a_data); // 25
99 #if !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
100  virtual void Unk_VRFunc(void);
101 #endif
103  SKYRIM_REL_VR_VIRTUAL void AttachProperty(NiAlphaProperty* a_property); // 27 - { return; }
104  SKYRIM_REL_VR_VIRTUAL void SetMaterialNeedsUpdate(bool a_needsUpdate); // 28 - { return; }
105  SKYRIM_REL_VR_VIRTUAL void SetDefaultMaterialNeedsUpdateFlag(bool a_flag); // 29 - { return; }
107  SKYRIM_REL_VR_VIRTUAL void SetSelectiveUpdateFlags(bool& a_selectiveUpdate, bool a_selectiveUpdateTransforms, bool& a_rigid); // 2B
108  SKYRIM_REL_VR_VIRTUAL void UpdateDownwardPass(NiUpdateData& a_data, std::uint32_t a_arg2); // 2C
109  SKYRIM_REL_VR_VIRTUAL void UpdateSelectedDownwardPass(NiUpdateData& a_data, std::uint32_t a_arg2); // 2D
110  SKYRIM_REL_VR_VIRTUAL void UpdateRigidDownwardPass(NiUpdateData& a_data, std::uint32_t a_arg2); // 2E
111  SKYRIM_REL_VR_VIRTUAL void UpdateWorldBound(); // 2F - { return; }
116  SKYRIM_REL_VR_VIRTUAL void OnVisible(NiCullingProcess& a_process); // 34 - { return; }
117 
118  [[nodiscard]] NiAVObject* Clone();
119  void CullGeometry(bool a_cull);
120  void CullNode(bool a_cull);
121  [[nodiscard]] bool GetAppCulled() const;
122  [[nodiscard]] bhkCollisionObject* GetCollisionObject() const;
123  [[nodiscard]] COL_LAYER GetCollisionLayer() const;
125  [[nodiscard]] TESObjectREFR* GetUserData() const;
126  void SetUserData(TESObjectREFR* a_ref) noexcept;
127  [[nodiscard]] bool HasAnimation() const;
128  [[nodiscard]] bool HasShaderType(BSShaderMaterial::Feature a_type);
129  void RemoveDecals();
130  void SetAppCulled(bool a_cull);
131  void SetCollisionLayer(COL_LAYER a_collisionLayer);
132  void SetCollisionLayerAndGroup(COL_LAYER a_collisionLayer, std::uint32_t a_group);
133  bool SetMotionType(std::uint32_t a_motionType, bool a_arg2 = true, bool a_arg3 = false, bool a_allowActivate = true);
134  bool SetProjectedUVData(const NiColorA& a_projectedUVParams, const NiColor& a_projectedUVColor, bool a_isSnow);
135  void TintScenegraph(const NiColorA& a_color);
136  void Update(NiUpdateData& a_data);
137  void UpdateBodyTint(const NiColor& a_color);
138  void UpdateHairColor(const NiColor& a_color);
139  void UpdateMaterialAlpha(float a_alpha, bool a_doOnlySkin);
140  void UpdateRigidConstraints(bool a_enable, std::uint8_t a_arg2 = 1, std::uint32_t a_arg3 = 1);
141 
142  [[nodiscard]] inline stl::enumeration<Flag, std::uint32_t>& GetFlags() noexcept
143  {
144  return REL::RelocateMember<stl::enumeration<Flag, std::uint32_t>>(this, 0x0F4, 0x10C);
145  }
146 
147  [[nodiscard]] inline const stl::enumeration<Flag, std::uint32_t>& GetFlags() const noexcept
148  {
149  return REL::RelocateMember<stl::enumeration<Flag, std::uint32_t>>(this, 0x0F4, 0x10C);
150  }
151 
152  // members
153  NiNode* parent; // 030
154  std::uint32_t parentIndex; // 038
155  std::uint32_t unk03C; // 03C
161 #ifndef ENABLE_SKYRIM_VR
164  float fadeAmount; // 100
165  std::uint32_t lastUpdatedFrameCounter; // 104
166  std::uint8_t unk108; // 108
167  std::uint8_t flags02; // 109
168  std::uint16_t unk10A; // 10A
169  std::uint32_t pad10C; // 10C
170  };
171  static_assert(sizeof(NiAVObject) == 0x110);
172 #elif !defined(ENABLE_SKYRIM_AE) && !defined(ENABLE_SKYRIM_SE)
173  float unkF4; // 0F4
174  float unkF8; // 0F8
175  float unkFC; // 0FC
176  float fadeAmount; // 100
177  std::uint32_t lastUpdatedFrameCounter; // 104
178  float unk108; // 108
180  TESObjectREFR* userData; // 110
181  std::uint32_t unk11C; // 11C
182  std::uint8_t unk120[8]; // 120 - bitfield
183  std::uint64_t unk128; // 128
184  std::uint32_t unk130; // 130
185  std::uint32_t unk134; // 134
186  };
187  static_assert(sizeof(NiAVObject) == 0x138);
188 #else
189  uint32_t unkF4; // 0F4
190  uint64_t* unkF8; // 0F8
191  float fadeAmount; // 100
192  std::uint32_t lastUpdatedFrameCounter; // 104
193  uint64_t unk104; // 108
194  };
195 #endif
196 }
#define SKYRIM_REL_VR_VIRTUAL
Definition: Common.h:94
Definition: BSGeometry.h:15
Feature
Definition: BSShaderMaterial.h:14
Definition: NiAVObject.h:50
std::uint8_t unk108
Definition: NiAVObject.h:166
SKYRIM_REL_VR_VIRTUAL void OnVisible(NiCullingProcess &a_process)
void UpdateRigidConstraints(bool a_enable, std::uint8_t a_arg2=1, std::uint32_t a_arg3=1)
void UpdateHairColor(const NiColor &a_color)
static constexpr auto RTTI
Definition: NiAVObject.h:52
static auto Ni_RTTI
Definition: NiAVObject.h:53
NiNode * parent
Definition: NiAVObject.h:153
SKYRIM_REL_VR_VIRTUAL void PerformOp(PerformOpFunc &a_func)
COL_LAYER GetCollisionLayer() const
const NiRTTI * GetRTTI() const override
void SetCollisionLayer(COL_LAYER a_collisionLayer)
NiTransform previousWorld
Definition: NiAVObject.h:159
void Update(NiUpdateData &a_data)
SKYRIM_REL_VR_VIRTUAL void UpdateWorldData(NiUpdateData *a_data)
SKYRIM_REL_VR_VIRTUAL void AttachProperty(NiAlphaProperty *a_property)
SKYRIM_REL_VR_VIRTUAL void SetMaterialNeedsUpdate(bool a_needsUpdate)
void UpdateBodyTint(const NiColor &a_color)
const stl::enumeration< Flag, std::uint32_t > & GetFlags() const noexcept
Definition: NiAVObject.h:147
std::uint32_t parentIndex
Definition: NiAVObject.h:154
bool SetProjectedUVData(const NiColorA &a_projectedUVParams, const NiColor &a_projectedUVColor, bool a_isSnow)
NiAVObject * Clone()
NiTransform world
Definition: NiAVObject.h:158
void LoadBinary(NiStream &a_stream) override
virtual void Unk_VRFunc(void)
std::uint16_t unk10A
Definition: NiAVObject.h:168
void LinkObject(NiStream &a_stream) override
~NiAVObject() override
stl::enumeration< Flag, std::uint32_t > flags
Definition: NiAVObject.h:162
bool HasAnimation() const
bool SetMotionType(std::uint32_t a_motionType, bool a_arg2=true, bool a_arg3=false, bool a_allowActivate=true)
void ProcessClone(NiCloningProcess &a_cloning) override
bool HasShaderType(BSShaderMaterial::Feature a_type)
SKYRIM_REL_VR_VIRTUAL void UpdateWorldBound()
NiPointer< NiCollisionObject > collisionObject
Definition: NiAVObject.h:156
SKYRIM_REL_VR_VIRTUAL void UpdateDownwardPass(NiUpdateData &a_data, std::uint32_t a_arg2)
bhkCollisionObject * GetCollisionObject() const
void SaveBinary(NiStream &a_stream) override
void CullNode(bool a_cull)
void SetUserData(TESObjectREFR *a_ref) noexcept
void SetCollisionLayerAndGroup(COL_LAYER a_collisionLayer, std::uint32_t a_group)
NiBound worldBound
Definition: NiAVObject.h:160
virtual void UpdateControllers(NiUpdateData &a_data)
SKYRIM_REL_VR_VIRTUAL void PreAttachUpdate(NiNode *a_parent, NiUpdateData &a_data)
stl::enumeration< Flag, std::uint32_t > & GetFlags() noexcept
Definition: NiAVObject.h:142
SKYRIM_REL_VR_VIRTUAL NiAVObject * GetObjectByName(const BSFixedString &a_name)
TESObjectREFR * GetUserData() const
BSGeometry * GetFirstGeometryOfShaderType(BSShaderMaterial::Feature a_type)
TESObjectREFR * userData
Definition: NiAVObject.h:163
SKYRIM_REL_VR_VIRTUAL void SetDefaultMaterialNeedsUpdateFlag(bool a_flag)
SKYRIM_REL_VR_VIRTUAL void UpdateSelectedDownwardPass(NiUpdateData &a_data, std::uint32_t a_arg2)
void SetAppCulled(bool a_cull)
SKYRIM_REL_VR_VIRTUAL void SetSelectiveUpdateFlags(bool &a_selectiveUpdate, bool a_selectiveUpdateTransforms, bool &a_rigid)
float fadeAmount
Definition: NiAVObject.h:164
SKYRIM_REL_VR_VIRTUAL void UpdateRigidDownwardPass(NiUpdateData &a_data, std::uint32_t a_arg2)
std::uint32_t unk03C
Definition: NiAVObject.h:155
bool IsEqual(NiObject *a_object) override
void RemoveDecals()
std::uint8_t flags02
Definition: NiAVObject.h:167
NiTransform local
Definition: NiAVObject.h:157
void TintScenegraph(const NiColorA &a_color)
Flag
Definition: NiAVObject.h:56
bool RegisterStreamables(NiStream &a_stream) override
std::uint32_t lastUpdatedFrameCounter
Definition: NiAVObject.h:165
bool GetAppCulled() const
void CullGeometry(bool a_cull)
std::uint32_t pad10C
Definition: NiAVObject.h:169
void UpdateMaterialAlpha(float a_alpha, bool a_doOnlySkin)
SKYRIM_REL_VR_VIRTUAL void PostAttachUpdate()
SKYRIM_REL_VR_VIRTUAL void UpdateTransformAndBounds(NiUpdateData &a_data)
Definition: NiAlphaProperty.h:8
Definition: NiBound.h:8
Definition: NiCloningProcess.h:10
Definition: NiColor.h:276
Definition: NiColor.h:11
Definition: NiCullingProcess.h:34
Definition: NiNode.h:12
Definition: NiObjectNET.h:13
Definition: NiObject.h:37
Definition: NiSmartPointer.h:9
Definition: NiRTTI.h:6
Definition: NiStream.h:29
Definition: NiTransform.h:9
Definition: NiAVObject.h:25
float time
Definition: NiAVObject.h:34
stl::enumeration< Flag, std::uint32_t > flags
Definition: NiAVObject.h:35
Flag
Definition: NiAVObject.h:28
Definition: NiAVObject.h:40
virtual ~PerformOpFunc()
virtual bool operator()(NiAVObject *a_object)
Definition: TESObjectREFR.h:113
Definition: bhkCollisionObject.h:8
Definition: AbsorbEffect.h:6
constexpr REL::VariantID RTTI_NiAVObject(684827, 392520, 0x1eda610)
constexpr REL::VariantID NiRTTI_NiAVObject(523895, 410476, 0x316ab40)
COL_LAYER
Definition: CollisionLayers.h:6