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