CommonLibSSE (powerof3)
Loading...
Searching...
No Matches
Renderer.h
Go to the documentation of this file.
1#pragma once
2
4#include "RE/N/NiTexture.h"
7
8#include "REX/W32/D3D11_3.h"
9#include "REX/W32/USER32.h"
10
11namespace RE
12{
13 namespace BSGraphics
14 {
16 {
18 std::int32_t windowX; // 08
19 std::int32_t windowY; // 0C
20 std::int32_t windowWidth; // 10
21 std::int32_t windowHeight; // 14
22 REX::W32::IDXGISwapChain* swapChain; // 18
24 std::uint32_t unk24; // 24
25 std::uint64_t unk28; // 28
26 REX::W32::ID3D11RenderTargetView1* renderView; // 30
27 REX::W32::ID3D11ShaderResourceView1* resourceView; // 38
28 std::uint64_t unk40; // 40
29 std::uint64_t unk48; // 48
30 };
31 static_assert(sizeof(RendererWindow) == 0x50);
32
34 {
35 std::uint32_t adapter; // 0000
40 std::uint32_t isNotWindowed; // 001C
41 bool fullScreen; // 0020
42 bool borderlessDisplay; // 0021
43 bool readOnlyDepth; // 0022
44 bool instantiated; // 0023
46 std::uint32_t newWidth; // 0028
47 std::uint32_t newHeight; // 002C
48 std::uint32_t presentInterval; // 0030
49 REX::W32::ID3D11Device* forwarder; // 0038
50 REX::W32::ID3D11DeviceContext* context; // 0040
52 RenderTargetData renderTargets[RENDER_TARGET::kTOTAL]; // 0A48
53 DepthStencilData depthStencils[RENDER_TARGET_DEPTHSTENCIL::kTOTAL]; // 1FA8
54 CubemapRenderTargetData cubemapRenderTargets[RENDER_TARGET_CUBEMAP::kTOTAL]; // 26C8
55 Texture3DTargetData texture3DRenderTargets[RENDER_TARGET_3D::kTOTAL]; // 2708
56 float clearColor[4]; // 2768
57 std::uint8_t clearStencil; // 2778
59 const char* className; // 27A8
61 };
62 static_assert(offsetof(RendererData, lock) == 0x2780);
63
65 {
70 const char* className; // 20
71 std::uint32_t adapter; // 28
72 std::uint32_t unk2C; // 2C
73 };
74 static_assert(sizeof(RendererInitOSData) == 0x30);
75
77 {
78 std::uint32_t width; // 00
79 std::uint32_t height; // 04
80 };
81 static_assert(sizeof(ScreenSize) == 0x8);
82
84 {
86 int windowX; // 08
87 int windowY; // 0C
88 int refreshRate; // 10
89 int presentInterval; // 14
90 bool appFullScreen; // 18
91 bool borderlessWindow; // 19
92 bool vsync; // 1A
93 };
94 static_assert(sizeof(ApplicationWindowProperties) == 0x1C);
95
97 {
98 public:
99 [[nodiscard]] static Renderer* GetSingleton() noexcept;
100
101 void CreateSwapChain(REX::W32::HWND* a_window, bool a_setCurrent);
102 void KillWindow(std::uint32_t a_windowID);
103 void Lock();
104 void Unlock();
105 void ResizeWindow(std::uint32_t a_windowID, std::uint32_t a_width, std::uint32_t a_height, bool a_fullscreen, bool a_borderless);
106 void RequestWindowResize(std::uint32_t a_width, std::uint32_t a_height);
107 void SetWindowPosition(std::uint32_t a_windowID, std::int32_t a_x, std::int32_t a_y);
108 void SetWindowActiveState(bool a_show);
109 void WindowSizeChanged(std::uint32_t a_windowID);
110 void ResetWindow(std::uint32_t a_windowID);
111 void UpdateViewPort(std::uint32_t a_unk1, std::uint32_t a_unk2, bool a_unk3);
112
113 [[nodiscard]] NiTexture::RendererData* CreateRenderTexture(std::uint32_t a_width, std::uint32_t a_height);
114 void SaveRenderTargetToFile(RENDER_TARGET a_renderTarget, const char* a_filePath, TextureFileFormat a_textureFileFormat);
115
116 [[nodiscard]] static RendererData* GetRendererData();
117 [[nodiscard]] static ScreenSize GetScreenSize();
118 [[nodiscard]] static REX::W32::ID3D11Device* GetDevice();
119 [[nodiscard]] static RendererWindow* GetCurrentRenderWindow();
120
121 // members
122 std::uint64_t unk00; // 00
123 std::uint64_t unk08; // 08
125
126 private:
127 void Begin(std::uint32_t windowID);
128 void Init(RendererInitOSData* a_data, ApplicationWindowProperties* a_windowProps, REX::W32::HWND a_window);
129 void End();
130 void Shutdown();
131 };
132 }
133}
Definition Renderer.h:97
void RequestWindowResize(std::uint32_t a_width, std::uint32_t a_height)
void SetWindowPosition(std::uint32_t a_windowID, std::int32_t a_x, std::int32_t a_y)
std::uint64_t unk08
Definition Renderer.h:123
void UpdateViewPort(std::uint32_t a_unk1, std::uint32_t a_unk2, bool a_unk3)
void SetWindowActiveState(bool a_show)
static REX::W32::ID3D11Device * GetDevice()
static RendererWindow * GetCurrentRenderWindow()
static RendererData * GetRendererData()
std::uint64_t unk00
Definition Renderer.h:122
NiTexture::RendererData * CreateRenderTexture(std::uint32_t a_width, std::uint32_t a_height)
void KillWindow(std::uint32_t a_windowID)
void WindowSizeChanged(std::uint32_t a_windowID)
void CreateSwapChain(REX::W32::HWND *a_window, bool a_setCurrent)
RendererData data
Definition Renderer.h:124
static ScreenSize GetScreenSize()
static Renderer * GetSingleton() noexcept
void SaveRenderTargetToFile(RENDER_TARGET a_renderTarget, const char *a_filePath, TextureFileFormat a_textureFileFormat)
void ResizeWindow(std::uint32_t a_windowID, std::uint32_t a_width, std::uint32_t a_height, bool a_fullscreen, bool a_borderless)
void ResetWindow(std::uint32_t a_windowID)
Definition NiTexture.h:15
DXGI_MODE_SCALING
Definition DXGI.h:201
DXGI_MODE_SCANLINE_ORDER
Definition DXGI.h:208
std::intptr_t(*)(HWND, std::uint32_t, std::uintptr_t, std::intptr_t) WNDPROC
Definition USER32.h:279
HINSTANCE__ * HINSTANCE
Definition BASE.h:21
HICON__ * HICON
Definition BASE.h:20
HWND__ * HWND
Definition BASE.h:30
Definition BSDirectInputManager.h:8
TextureFileFormat
Definition TextureFileFormat.h:8
Definition AbsorbEffect.h:6
Definition EffectArchetypes.h:65
Definition BASE.h:138
Definition DXGI.h:342
int windowY
Definition Renderer.h:87
ScreenSize screenSize
Definition Renderer.h:85
int presentInterval
Definition Renderer.h:89
bool vsync
Definition Renderer.h:92
int windowX
Definition Renderer.h:86
bool borderlessWindow
Definition Renderer.h:91
bool appFullScreen
Definition Renderer.h:90
int refreshRate
Definition Renderer.h:88
Definition RenderTargetData.h:35
Definition RenderTargetData.h:25
Definition RenderTargetData.h:14
Definition Renderer.h:34
bool readOnlyDepth
Definition Renderer.h:43
DepthStencilData depthStencils[RENDER_TARGET_DEPTHSTENCIL::kTOTAL]
Definition Renderer.h:53
REX::W32::DXGI_MODE_SCANLINE_ORDER scanlineOrdering
Definition Renderer.h:39
REX::W32::HINSTANCE hInstance
Definition Renderer.h:60
REX::W32::DXGI_RATIONAL actualRefreshRate
Definition Renderer.h:37
std::uint32_t newWidth
Definition Renderer.h:46
REX::W32::ID3D11DeviceContext * context
Definition Renderer.h:50
std::uint32_t newHeight
Definition Renderer.h:47
std::uint8_t clearStencil
Definition Renderer.h:57
RenderTargetData renderTargets[RENDER_TARGET::kTOTAL]
Definition Renderer.h:52
const char * className
Definition Renderer.h:59
bool borderlessDisplay
Definition Renderer.h:42
bool instantiated
Definition Renderer.h:44
float clearColor[4]
Definition Renderer.h:56
bool fullScreen
Definition Renderer.h:41
REX::W32::ID3D11Device * forwarder
Definition Renderer.h:49
bool requestedWindowSizeChange
Definition Renderer.h:45
Texture3DTargetData texture3DRenderTargets[RENDER_TARGET_3D::kTOTAL]
Definition Renderer.h:55
REX::W32::CRITICAL_SECTION lock
Definition Renderer.h:58
REX::W32::DXGI_RATIONAL desiredRefreshRate
Definition Renderer.h:36
RendererWindow renderWindows[32]
Definition Renderer.h:51
std::uint32_t isNotWindowed
Definition Renderer.h:40
std::uint32_t adapter
Definition Renderer.h:35
REX::W32::DXGI_MODE_SCALING scaleMode
Definition Renderer.h:38
CubemapRenderTargetData cubemapRenderTargets[RENDER_TARGET_CUBEMAP::kTOTAL]
Definition Renderer.h:54
std::uint32_t presentInterval
Definition Renderer.h:48
Definition Renderer.h:65
const char * className
Definition Renderer.h:70
REX::W32::HICON icon
Definition Renderer.h:69
REX::W32::HINSTANCE instance
Definition Renderer.h:67
std::uint32_t unk2C
Definition Renderer.h:72
std::uint32_t adapter
Definition Renderer.h:71
REX::W32::WNDPROC windowProcFunction
Definition Renderer.h:68
REX::W32::HWND hwnd
Definition Renderer.h:66
Definition Renderer.h:16
RENDER_TARGET swapChainRenderTarget
Definition Renderer.h:23
std::int32_t windowY
Definition Renderer.h:19
std::uint64_t unk28
Definition Renderer.h:25
REX::W32::HWND hWnd
Definition Renderer.h:17
REX::W32::IDXGISwapChain * swapChain
Definition Renderer.h:22
std::uint64_t unk40
Definition Renderer.h:28
std::uint64_t unk48
Definition Renderer.h:29
std::int32_t windowX
Definition Renderer.h:18
std::int32_t windowWidth
Definition Renderer.h:20
REX::W32::ID3D11RenderTargetView1 * renderView
Definition Renderer.h:26
std::uint32_t unk24
Definition Renderer.h:24
REX::W32::ID3D11ShaderResourceView1 * resourceView
Definition Renderer.h:27
std::int32_t windowHeight
Definition Renderer.h:21
Definition Renderer.h:77
std::uint32_t width
Definition Renderer.h:78
std::uint32_t height
Definition Renderer.h:79
Definition RenderTargetData.h:43
RENDER_TARGET
Definition BSShaderRenderTargets.h:8