CommonLibVR
PlayerCamera.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "RE/B/BSAtomic.h"
4 #include "RE/B/BSPointerHandle.h"
5 #include "RE/B/BSTArray.h"
6 #include "RE/B/BSTSingleton.h"
7 #include "RE/B/BSTSmartPointer.h"
8 #include "RE/N/NiPoint3.h"
9 #include "RE/T/TESCamera.h"
10 
11 namespace RE
12 {
13  class bhkRigidBody;
14  class bhkSimpleShapePhantom;
15  class NiRefObject;
16  class TESCameraState;
17 
18  struct CameraStates
19  {
20  enum CameraState : std::uint32_t
21  {
35 #ifdef SKYRIMVR
36  kVR, // ".?AVVrCameraState@@"? by memory address it's after bleedout and before tween
37 #endif
38  kTotal
39  };
40  };
42 
43  class PlayerCamera :
44  public TESCamera, // 000
45  public BSTSingletonSDM<PlayerCamera> // 038
46  {
47  public:
48  inline static constexpr auto RTTI = RTTI_PlayerCamera;
49  inline static constexpr auto VTABLE = VTABLE_PlayerCamera;
50 
51  struct Unk120
52  {
55  };
56  static_assert(sizeof(Unk120) == 0x10);
57 
58  ~PlayerCamera() override; // 00
59 
60  // override (TESCamera)
61  void SetCameraRoot(NiPointer<NiNode> a_root) override; // 01
62 
64 
67  bool IsInBleedoutMode() const;
68  bool IsInFirstPerson() const;
69  bool IsInFreeCameraMode() const;
70  bool IsInThirdPerson() const;
72  void ToggleFreeCameraMode(bool a_freezeTime);
73  void UpdateThirdPerson(bool a_weaponDrawn);
74 
75  // members
76  std::uint8_t pad039; // 039
77  std::uint16_t pad03A; // 03A
81 #ifndef SKYRIMVR
82  Unk120* unk120; // 120 - ?
83 #endif
84  NiPointer<bhkRigidBody> rigidBody; // 128, VR 130 - ?
85  RefHandle objectFadeHandle; // 130, VR 138 - ?
86  mutable BSSpinLock lock; // 134, VR 13C
87 #ifdef SKYRIMVR
88  char VRpad140[20]; // VR 140
89 #endif
90  float worldFOV; // 13C, VR 158
91  float firstPersonFOV; // 140, VR 15C
92  NiPoint3 pos; // 144, VR 160 - ?
93  float idleTimer; // 150, VR 16C - ?
94  float yaw; // 154, VR 170 - ? - in radians
95  std::uint32_t unk158; // 158, VR 174 - ?
96  std::uint32_t unk15C; // 15C, VR 178 - ?
97  bool allowAutoVanityMode; // 160, VR 17C
98  bool bowZoomedIn; // 161, VR 17D
99  bool isWeapSheathed; // 162, VR 17E - ?
100  bool isProcessed; // 163, VR 17F - ?
101  std::uint8_t unk164; // 164, VR 180
102  std::uint8_t unk165; // 165, VR 181
103  std::uint16_t pad166; // 166, VR 182
104 
105  private:
106  bool QCameraEquals(CameraState a_cameraState) const;
107  KEEP_FOR_RE()
108  };
109 #ifndef SKYRIMVR
110  static_assert(sizeof(PlayerCamera) == 0x168);
111 #else
112  static_assert(offsetof(PlayerCamera, cameraStates) == 0xc0);
113  static_assert(offsetof(PlayerCamera, rigidBody) == 0x130);
114  static_assert(offsetof(PlayerCamera, lock) == 0x13c);
115  static_assert(offsetof(PlayerCamera, pos) == 0x160);
116  static_assert(offsetof(PlayerCamera, yaw) == 0x170);
117  static_assert(offsetof(PlayerCamera, allowAutoVanityMode) == 0x17c);
118  static_assert(sizeof(PlayerCamera) == 0x188);
119 #endif
120 }
#define KEEP_FOR_RE()
Definition: PCH.h:713
Definition: BSAtomic.h:92
Definition: BSTArray.h:378
Definition: BSTSmartPointer.h:37
Definition: NiPoint3.h:6
Definition: PlayerCamera.h:46
void ToggleFreeCameraMode(bool a_freezeTime)
bool IsInFreeCameraMode() const
void ForceThirdPerson()
static constexpr auto VTABLE
Definition: PlayerCamera.h:49
BSTSmartPointer< TESCameraState > cameraStates[CameraStates::kTotal]
Definition: PlayerCamera.h:80
RefHandle objectFadeHandle
Definition: PlayerCamera.h:85
float idleTimer
Definition: PlayerCamera.h:93
bool isWeapSheathed
Definition: PlayerCamera.h:99
BSSpinLock lock
Definition: PlayerCamera.h:86
~PlayerCamera() override
bool allowAutoVanityMode
Definition: PlayerCamera.h:97
float firstPersonFOV
Definition: PlayerCamera.h:91
bool IsInThirdPerson() const
NiPoint3 pos
Definition: PlayerCamera.h:92
void UpdateThirdPerson(bool a_weaponDrawn)
ActorHandle cameraTarget
Definition: PlayerCamera.h:78
BSTSmallArray< TESCameraState *, CameraStates::kTotal > tempReturnStates
Definition: PlayerCamera.h:79
std::uint8_t unk164
Definition: PlayerCamera.h:101
bool IsInFirstPerson() const
bool bowZoomedIn
Definition: PlayerCamera.h:98
std::uint32_t unk15C
Definition: PlayerCamera.h:96
void PushCameraState(CameraState a_state)
float worldFOV
Definition: PlayerCamera.h:90
std::uint16_t pad166
Definition: PlayerCamera.h:103
std::uint16_t pad03A
Definition: PlayerCamera.h:77
NiPointer< bhkRigidBody > rigidBody
Definition: PlayerCamera.h:84
bool isProcessed
Definition: PlayerCamera.h:100
float yaw
Definition: PlayerCamera.h:94
std::uint32_t unk158
Definition: PlayerCamera.h:95
static PlayerCamera * GetSingleton()
void SetCameraRoot(NiPointer< NiNode > a_root) override
bool IsInBleedoutMode() const
std::uint8_t pad039
Definition: PlayerCamera.h:76
static constexpr auto RTTI
Definition: PlayerCamera.h:48
Unk120 * unk120
Definition: PlayerCamera.h:82
void ForceFirstPerson()
std::uint8_t unk165
Definition: PlayerCamera.h:102
Definition: TESCamera.h:13
Definition: AbsorbEffect.h:6
constexpr REL::ID RTTI_PlayerCamera(static_cast< std::uint64_t >(688779))
constexpr std::array< REL::ID, 1 > VTABLE_PlayerCamera
Definition: Offsets_VTABLE.h:12549
std::uint32_t RefHandle
Definition: BSCoreTypes.h:6
Definition: BSTSingleton.h:50
Definition: PlayerCamera.h:19
CameraState
Definition: PlayerCamera.h:21
@ kBleedout
Definition: PlayerCamera.h:33
@ kFurniture
Definition: PlayerCamera.h:27
@ kTween
Definition: PlayerCamera.h:29
@ kTotal
Definition: PlayerCamera.h:38
@ kFirstPerson
Definition: PlayerCamera.h:22
@ kVATS
Definition: PlayerCamera.h:24
@ kDragon
Definition: PlayerCamera.h:34
@ kAutoVanity
Definition: PlayerCamera.h:23
@ kThirdPerson
Definition: PlayerCamera.h:31
@ kIronSights
Definition: PlayerCamera.h:26
@ kPCTransition
Definition: PlayerCamera.h:28
@ kFree
Definition: PlayerCamera.h:25
@ kMount
Definition: PlayerCamera.h:32
@ kAnimated
Definition: PlayerCamera.h:30
Definition: PlayerCamera.h:52
NiPointer< bhkSimpleShapePhantom * > unk00
Definition: PlayerCamera.h:53
NiPointer< bhkSimpleShapePhantom * > unk08
Definition: PlayerCamera.h:54