CommonLibSSE (powerof3)
Loading...
Searching...
No Matches
GRenderer.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/G/GColor.h"
4#include "RE/G/GMatrix2D.h"
5#include "RE/G/GPoint.h"
6#include "RE/G/GRect.h"
9#include "RE/G/GTexture.h"
10
11namespace RE
12{
13 class GImageBase;
14 class GMatrix3D;
15 class GRenderTarget;
16 class GViewport;
17
18 class GRenderer : public GRefCountBase<GRenderer, GStatRenderer::kMem>
19 {
20 public:
21 using Handle = void*;
23 using Point = GPointF;
24 using Rect = GRectF;
25
26 enum class BlendType
27 {
28 kNone = 0,
29 kNormal = 1,
30 kLayer = 2,
31 kMultiply = 3,
32 kScreen = 4,
33 kLighten = 5,
34 kDarken = 6,
35 kDifference = 7,
36 kAdd = 8,
37 kSubtract = 9,
38 kInvert = 10,
39 kAlpha = 11,
40 kErase = 12,
41 kOverlay = 13,
42 kHardLight = 14
43 };
44
45 enum class ResizeImageType
46 {
50 kGray
51 };
52
53 enum class VertexFormat
54 {
55 kNone = 0,
56 kXY16i = 1 << 1,
57 kXY32f = 1 << 2,
58 kXY16iC32 = 1 << 3,
59 kXY16iCF32 = 1 << 4
60 };
61
62 enum class IndexFormat
63 {
64 kNone = 0,
65 k16 = 1,
66 k32 = 2
67 };
68
69 enum class RenderCapBits
70 {
71 kNone = 0,
72
73 kCacheDataUse = 1 << 0,
74
75 kIndex16 = 1 << 2,
76 kIndex32 = 1 << 3,
77 kRenderStats = 1 << 4,
78 kRenderTargets = 1 << 5,
79 kRenderTargetPrePass = 1 << 6,
80 kRenderTargetNonPow2 = 1 << 7,
81 kFillGouraud = 1 << 8,
82 kFillGouraudTex = 1 << 9,
83
84 kCxformAdd = 1 << 12,
85 kNestedMasks = 1 << 13,
86 kTexNonPower2 = 1 << 14,
87 kTexNonPower2Wrap = 1 << 15,
88 kCanLoseData = 1 << 16,
89 kKeepVertexData = 1 << 17,
90 kNoTexOverwrite = 1 << 18,
91 kTexNonPower2Mip = 1 << 19,
93 kRenderTargetMip = 1 << 21,
94 kFilter_Blurs = 1 << 22,
95 kFilter_ColorMatrix = 1 << 23,
96 };
97
98 enum class StereoDisplay
99 {
103 };
104
105 enum class CachedDataType
106 {
107 kVertex = 1,
108 kIndex = 2,
109 kBitmapList = 3
110 };
111
113 {
114 kNone,
116 kHasFloat,
118 };
119
120 enum class BitmapWrapMode
121 {
122 kRepeat,
123 kClamp
124 };
125
127 {
128 kPoint,
129 kLinear
130 };
131
133 {
134 kColor,
135 k1Texture,
137 k2Texture,
140 };
141
142 enum class SubmitMaskMode
143 {
144 kClear,
147 };
148
149 enum class FilterModes
150 {
151 kBlur = 1 << 0,
152 kShadow = 1 << 1,
153 kHighlight = 1 << 2,
154
155 Filter_Knockout = 1 << 8,
156 Filter_Inner = 1 << 9,
157 Filter_HideObject = 1 << 10,
158
159 Filter_UserModes = 0xFFFF,
160 Filter_SkipLastPass = 1 << 16,
161 Filter_LastPassOnly = 1 << 17
162 };
163
164 enum class FilterSupport
165 {
166 kNone = 0,
167 kOk = 1 << 0,
168 kMultipass = 1 << 1,
169 kSlow = 1 << 2,
170 };
171
172 class Stats
173 {
174 public:
176
177 void Clear();
178
179 // members
180 std::uint32_t triangles; // 00
181 std::uint32_t lines; // 04
182 std::uint32_t primitives; // 08
183 std::uint32_t masks; // 0C
184 std::uint32_t filters; // 10
185 };
186 static_assert(sizeof(Stats) == 0x14);
187
189 {
190 public:
193
194 [[nodiscard]] GRenderer* GetRenderer() const;
195 [[nodiscard]] Handle GetRendererData() const;
196 void SetRendererData(Handle a_handle);
199
200 // members
203 };
204 static_assert(sizeof(CachedData) == 0x10);
205
207 {
208 public:
210 ~CacheProvider() = default;
211
213 CachedData* CreateCachedData(CachedDataType a_type, GRenderer* a_renderer, bool a_keepSharedData = true);
215
216 // members
219 std::uint8_t pad11; // 11
220 std::uint16_t pad12; // 12
221 std::uint32_t pad14; // 14
222 };
223 static_assert(sizeof(CacheProvider) == 0x10);
224
225 class Cxform
226 {
227 public:
228 enum
229 {
234 kRGBA
235 };
236
237 enum
238 {
242 };
243
245
246 bool operator==(const Cxform& a_rhs) const;
247
248 // members
249 float matrix[kRGBA][kMultAdd]; // 00
250 };
251 static_assert(sizeof(Cxform) == 0x20);
252
254 {
255 public:
257
258 // members
259 float displayWidthCm; // 00
260 float distortion; // 04
261 float displayDiagInches; // 08
263 float eyeSeparationCm; // 10
264 };
265 static_assert(sizeof(StereoParams) == 0x14);
266
268 {
269 public:
270 // members
272 std::uint32_t vertexFormats; // 04
273 std::uint32_t blendModes; // 08
274 std::uint32_t maxTextureSize; // 0C
275 };
276 static_assert(sizeof(RenderCaps) == 0x10);
277
278 struct UserData
279 {
280 public:
282
283 // members
284 const char* string; // 00
285 float* flt; // 08
286 float* matrix; // 10
287 std::uint32_t matrixSize; // 18
289 std::uint8_t pad1D; // 1D
290 std::uint16_t pad1E; // 1E
291 };
292 static_assert(sizeof(UserData) == 0x20);
293
295 {
296 public:
297 // members
302 };
303 static_assert(sizeof(FillTexture) == 0x28);
304
306 {
307 public:
308 // members
309 std::int16_t x; // 0
310 std::int16_t y; // 2
311 };
312 static_assert(sizeof(VertexXY16i) == 0x4);
313
315 {
316 public:
317 enum
318 {
319 kVFormat = static_cast<std::underlying_type_t<VertexFormat>>(VertexFormat::kXY16iC32)
320 };
321
322 // members
323 std::int16_t x; // 0
324 std::int16_t y; // 2
325 std::uint32_t color; // 4
326 };
327 static_assert(sizeof(VertexXY16iC32) == 0x8);
328
330 {
331 public:
332 enum
333 {
334 kVFormat = static_cast<std::underlying_type_t<VertexFormat>>(VertexFormat::kXY16iCF32)
335 };
336
337 // members
338 std::int16_t x; // 0
339 std::int16_t y; // 2
340 std::uint32_t color; // 4
341 std::uint32_t factors; // 8
342 };
343 static_assert(sizeof(VertexXY16iCF32) == 0xC);
344
346 {
347 public:
348 // members
352 };
353 static_assert(sizeof(BitmapDesc) == 0x24);
354
356 {
357 public:
358 // members
359 float width; // 00
360 float shadowWidth; // 04
364 float glowSize[2]; // 18
365 };
366 static_assert(sizeof(DistanceFieldParams) == 0x20);
367
369 {
370 public:
371 // members
372 std::uint32_t mode; // 00
373 float blurX; // 04
374 float blurY; // 08
375 std::uint32_t passes; // 0C
379 float strength; // 20
381 };
382 static_assert(sizeof(BlurFilterParams) == 0x44);
383
384 ~GRenderer() override; // 00
385
386 // add
387 virtual bool GetRenderCaps(RenderCaps* a_caps) = 0; // 01
388 virtual GTexture* CreateTexture() = 0; // 02
389 virtual GTexture* CreateTextureYUV() = 0; // 03
390 virtual void BeginFrame(); // 04
391 virtual void EndFrame(); // 05
392 virtual GRenderTarget* CreateRenderTarget() = 0; // 06
393 virtual void SetDisplayRenderTarget(GRenderTarget* a_renderTarget, bool a_setstate = true) = 0; // 07
394 virtual void PushRenderTarget(const GRectF& a_frameRect, GRenderTarget* a_renderTarget) = 0; // 08
395 virtual void PopRenderTarget() = 0; // 09
396 virtual GTexture* PushTempRenderTarget(const GRectF& a_frameRect, std::uint32_t a_targetW, std::uint32_t a_targetH) = 0; // 0A
397 virtual void ReleaseTempRenderTargets(std::uint32_t a_keepArea); // 0B
398 virtual void BeginDisplay(GColor a_backgroundColor, const GViewport& a_viewport, float a_x0, float a_x1, float a_y0, float a_y1) = 0; // 0C
399 virtual void EndDisplay() = 0; // 0D
400 virtual void SetMatrix(const Matrix& a_matrix) = 0; // 0E
401 virtual void SetUserMatrix(const Matrix& a_matrix) = 0; // 0F
402 virtual void SetCxform(const Cxform& a_cxForm) = 0; // 10
403 virtual void PushBlendMode(BlendType a_mode) = 0; // 11
404 virtual void PopBlendMode() = 0; // 12
405 virtual bool PushUserData(UserData* a_data); // 13
406 virtual void PopUserData(); // 14
407 virtual void SetPerspective3D(const GMatrix3D& a_projMatIn) = 0; // 15
408 virtual void SetView3D(const GMatrix3D& a_viewMatIn) = 0; // 16
409 virtual void SetWorld3D(const GMatrix3D* a_worldMatIn) = 0; // 17
410 virtual void MakeViewAndPersp3D(const GRectF& a_visFrameRectInTwips, GMatrix3D& a_matView, GMatrix3D& a_matPersp, float a_perspFOV, bool a_InvertY = false); // 18
411 virtual void SetStereoParams(StereoParams a_params); // 19
412 virtual void SetStereoDisplay(StereoDisplay a_display, bool a_setstate = false); // 1A
413 virtual void SetVertexData(const void* a_vertices, std::int32_t a_numVertices, VertexFormat a_vtxFmt, CacheProvider* a_cache = 0) = 0; // 1B
414 virtual void SetIndexData(const void* a_indices, std::int32_t a_numIndices, IndexFormat a_idxFmt, CacheProvider* a_cache = 0) = 0; // 1C
415 virtual void ReleaseCachedData(CachedData* a_data, CachedDataType a_type) = 0; // 1D
416 virtual void DrawIndexedTriList(std::int32_t a_baseVertexIndex, std::int32_t a_minVertexIndex, std::int32_t a_numVertices, std::int32_t a_startIndex, std::int32_t a_triangleCount) = 0; // 1E
417 virtual void DrawLineStrip(std::int32_t a_baseVertexIndex, std::int32_t a_lineCount) = 0; // 1F
418 virtual void LineStyleDisable() = 0; // 20
419 virtual void LineStyleColor(GColor a_color) = 0; // 21
420 virtual void FillStyleDisable() = 0; // 22
421 virtual void FillStyleColor(GColor a_color) = 0; // 23
422 virtual void FillStyleBitmap(const FillTexture* a_fill) = 0; // 24
423 virtual void FillStyleGouraud(GouraudFillType a_fillType, const FillTexture* a_texture0 = 0, const FillTexture* a_texture1 = 0, const FillTexture* a_texture2 = 0) = 0; // 25
424 virtual void DrawBitmaps(BitmapDesc* a_bitmapList, std::int32_t a_listSize, std::int32_t a_startIndex, std::int32_t a_count, const GTexture* a_texture, const Matrix& a_matrix, CacheProvider* a_cache = 0) = 0; // 26
425 virtual void DrawDistanceFieldBitmaps(BitmapDesc* a_bitmapList, std::int32_t a_listSize, std::int32_t a_startIndex, std::int32_t a_count, const GTexture* a_texture, const Matrix& a_matrix, const DistanceFieldParams& a_params, CacheProvider* a_cache = 0); // 27
426 virtual void BeginSubmitMask(SubmitMaskMode a_maskMode = SubmitMaskMode::kClear) = 0; // 28
427 virtual void EndSubmitMask() = 0; // 29
428 virtual void DisableMask() = 0; // 2A
429 virtual std::uint32_t CheckFilterSupport(const BlurFilterParams& a_params) = 0; // 2B
430 virtual void DrawBlurRect(GTexture* a_srcIn, const GRectF& a_inSrcRect, const GRectF& a_inDstRect, const BlurFilterParams& a_params) = 0; // 2C
431 virtual void DrawColorMatrixRect(GTexture* a_srcIn, const GRectF& a_inSrcRect, const GRectF& a_dstRect, const float* a_matrix) = 0; // 2D
432 virtual void GetRenderStats(Stats* a_stats, bool a_resetStats = 0) = 0; // 2E
433 virtual void GetStats(GStatBag* a_bag, bool a_reset = true) = 0; // 2F
434 virtual void ReleaseResources() = 0; // 30
435 virtual bool AddEventHandler(GRendererEventHandler* a_handler); // 31
436 virtual void RemoveEventHandler(GRendererEventHandler* a_handler); // 32
437
438 void FillStyleBitmap(GTexture* a_texture, const Matrix& a_matrix, BitmapWrapMode a_wrapMode, BitmapSampleMode a_sampleMode);
439
440 // members
444 };
445 static_assert(sizeof(GRenderer) == 0x38);
446}
Definition: GColor.h:6
Definition: GList.h:29
Definition: GMatrix2D.h:6
Definition: GMatrix3D.h:6
Definition: GRefCountBase.h:12
Definition: GRenderer.h:207
CacheProvider(CachedData *a_cache)
CachedData * data
Definition: GRenderer.h:217
CachedData * CreateCachedData(CachedDataType a_type, GRenderer *a_renderer, bool a_keepSharedData=true)
CachedData * GetCachedData(GRenderer *a_renderer)
bool discardSharedData
Definition: GRenderer.h:218
std::uint8_t pad11
Definition: GRenderer.h:219
std::uint32_t pad14
Definition: GRenderer.h:221
std::uint16_t pad12
Definition: GRenderer.h:220
Definition: GRenderer.h:189
GRenderer * GetRenderer() const
GRenderer * renderer
Definition: GRenderer.h:201
Handle GetRendererData() const
void SetRendererData(Handle a_handle)
Handle data
Definition: GRenderer.h:202
void ReleaseData(CachedDataType a_type)
Definition: GRenderer.h:226
float matrix[kRGBA][kMultAdd]
Definition: GRenderer.h:249
@ kA
Definition: GRenderer.h:233
@ kRGBA
Definition: GRenderer.h:234
@ kG
Definition: GRenderer.h:231
@ kB
Definition: GRenderer.h:232
@ kR
Definition: GRenderer.h:230
@ kMult
Definition: GRenderer.h:239
@ kAdd
Definition: GRenderer.h:240
@ kMultAdd
Definition: GRenderer.h:241
bool operator==(const Cxform &a_rhs) const
Definition: GRenderer.h:173
std::uint32_t primitives
Definition: GRenderer.h:182
std::uint32_t lines
Definition: GRenderer.h:181
std::uint32_t triangles
Definition: GRenderer.h:180
std::uint32_t filters
Definition: GRenderer.h:184
std::uint32_t masks
Definition: GRenderer.h:183
Definition: GRendererEventHandler.h:13
Definition: GRenderer.h:19
BitmapWrapMode
Definition: GRenderer.h:121
virtual void PopUserData()
virtual void PopRenderTarget()=0
virtual bool PushUserData(UserData *a_data)
virtual void GetStats(GStatBag *a_bag, bool a_reset=true)=0
virtual void DrawLineStrip(std::int32_t a_baseVertexIndex, std::int32_t a_lineCount)=0
virtual bool GetRenderCaps(RenderCaps *a_caps)=0
virtual std::uint32_t CheckFilterSupport(const BlurFilterParams &a_params)=0
virtual void SetStereoParams(StereoParams a_params)
virtual void DrawDistanceFieldBitmaps(BitmapDesc *a_bitmapList, std::int32_t a_listSize, std::int32_t a_startIndex, std::int32_t a_count, const GTexture *a_texture, const Matrix &a_matrix, const DistanceFieldParams &a_params, CacheProvider *a_cache=0)
virtual void FillStyleGouraud(GouraudFillType a_fillType, const FillTexture *a_texture0=0, const FillTexture *a_texture1=0, const FillTexture *a_texture2=0)=0
virtual void SetWorld3D(const GMatrix3D *a_worldMatIn)=0
virtual void SetStereoDisplay(StereoDisplay a_display, bool a_setstate=false)
virtual void BeginSubmitMask(SubmitMaskMode a_maskMode=SubmitMaskMode::kClear)=0
virtual void PopBlendMode()=0
CachedDataType
Definition: GRenderer.h:106
virtual void SetDisplayRenderTarget(GRenderTarget *a_renderTarget, bool a_setstate=true)=0
RenderCapBits
Definition: GRenderer.h:70
virtual void DrawIndexedTriList(std::int32_t a_baseVertexIndex, std::int32_t a_minVertexIndex, std::int32_t a_numVertices, std::int32_t a_startIndex, std::int32_t a_triangleCount)=0
virtual void EndDisplay()=0
BitmapSampleMode
Definition: GRenderer.h:127
virtual bool AddEventHandler(GRendererEventHandler *a_handler)
virtual GTexture * CreateTextureYUV()=0
BlendType
Definition: GRenderer.h:27
virtual void RemoveEventHandler(GRendererEventHandler *a_handler)
virtual void SetVertexData(const void *a_vertices, std::int32_t a_numVertices, VertexFormat a_vtxFmt, CacheProvider *a_cache=0)=0
virtual void FillStyleBitmap(const FillTexture *a_fill)=0
virtual GTexture * PushTempRenderTarget(const GRectF &a_frameRect, std::uint32_t a_targetW, std::uint32_t a_targetH)=0
stl::enumeration< StereoDisplay, std::uint32_t > s3DDisplay
Definition: GRenderer.h:443
virtual void SetMatrix(const Matrix &a_matrix)=0
virtual void FillStyleDisable()=0
GouraudFillType
Definition: GRenderer.h:133
SubmitMaskMode
Definition: GRenderer.h:143
void FillStyleBitmap(GTexture *a_texture, const Matrix &a_matrix, BitmapWrapMode a_wrapMode, BitmapSampleMode a_sampleMode)
virtual void EndSubmitMask()=0
FilterSupport
Definition: GRenderer.h:165
virtual GTexture * CreateTexture()=0
StereoParams s3DParams
Definition: GRenderer.h:442
virtual void DrawBitmaps(BitmapDesc *a_bitmapList, std::int32_t a_listSize, std::int32_t a_startIndex, std::int32_t a_count, const GTexture *a_texture, const Matrix &a_matrix, CacheProvider *a_cache=0)=0
FilterModes
Definition: GRenderer.h:150
VertexFormat
Definition: GRenderer.h:54
virtual void FillStyleColor(GColor a_color)=0
virtual void SetPerspective3D(const GMatrix3D &a_projMatIn)=0
virtual void EndFrame()
virtual void ReleaseTempRenderTargets(std::uint32_t a_keepArea)
virtual void ReleaseCachedData(CachedData *a_data, CachedDataType a_type)=0
virtual void PushRenderTarget(const GRectF &a_frameRect, GRenderTarget *a_renderTarget)=0
virtual void BeginDisplay(GColor a_backgroundColor, const GViewport &a_viewport, float a_x0, float a_x1, float a_y0, float a_y1)=0
virtual void ReleaseResources()=0
virtual void GetRenderStats(Stats *a_stats, bool a_resetStats=0)=0
GList< GRendererEventHandler > handlers
Definition: GRenderer.h:441
virtual void SetIndexData(const void *a_indices, std::int32_t a_numIndices, IndexFormat a_idxFmt, CacheProvider *a_cache=0)=0
~GRenderer() override
IndexFormat
Definition: GRenderer.h:63
virtual void BeginFrame()
virtual void DrawBlurRect(GTexture *a_srcIn, const GRectF &a_inSrcRect, const GRectF &a_inDstRect, const BlurFilterParams &a_params)=0
ResizeImageType
Definition: GRenderer.h:46
UserDataPropertyFlag
Definition: GRenderer.h:113
virtual void SetUserMatrix(const Matrix &a_matrix)=0
virtual void MakeViewAndPersp3D(const GRectF &a_visFrameRectInTwips, GMatrix3D &a_matView, GMatrix3D &a_matPersp, float a_perspFOV, bool a_InvertY=false)
virtual void DrawColorMatrixRect(GTexture *a_srcIn, const GRectF &a_inSrcRect, const GRectF &a_dstRect, const float *a_matrix)=0
virtual void SetView3D(const GMatrix3D &a_viewMatIn)=0
void * Handle
Definition: GRenderer.h:21
virtual void LineStyleColor(GColor a_color)=0
StereoDisplay
Definition: GRenderer.h:99
virtual void LineStyleDisable()=0
virtual void DisableMask()=0
virtual void PushBlendMode(BlendType a_mode)=0
virtual GRenderTarget * CreateRenderTarget()=0
virtual void SetCxform(const Cxform &a_cxForm)=0
Definition: GTexture.h:15
Definition: GViewport.h:6
Definition: PCH.h:217
Definition: AbsorbEffect.h:6
GPoint< float > GPointF
Definition: GPoint.h:20
GRect< float > GRectF
Definition: GRect.h:16
Definition: GRenderer.h:346
GColor Color
Definition: GRenderer.h:351
Rect Coords
Definition: GRenderer.h:349
Rect TextureCoords
Definition: GRenderer.h:350
Definition: GRenderer.h:369
std::uint32_t passes
Definition: GRenderer.h:375
float blurX
Definition: GRenderer.h:373
GColor color2
Definition: GRenderer.h:378
float blurY
Definition: GRenderer.h:374
GColor color
Definition: GRenderer.h:377
std::uint32_t mode
Definition: GRenderer.h:372
float strength
Definition: GRenderer.h:379
Cxform cxform
Definition: GRenderer.h:380
GPointF offset
Definition: GRenderer.h:376
Definition: GRenderer.h:356
GColor shadowColor
Definition: GRenderer.h:361
float glowSize[2]
Definition: GRenderer.h:364
GColor glowColor
Definition: GRenderer.h:363
GPointF shadowOffset
Definition: GRenderer.h:362
float width
Definition: GRenderer.h:359
float shadowWidth
Definition: GRenderer.h:360
Definition: GRenderer.h:295
Matrix textureMatrix
Definition: GRenderer.h:299
GTexture * texture
Definition: GRenderer.h:298
stl::enumeration< BitmapSampleMode, std::uint32_t > sampleMode
Definition: GRenderer.h:301
stl::enumeration< BitmapWrapMode, std::uint32_t > wrapMode
Definition: GRenderer.h:300
Definition: GRenderer.h:268
std::uint32_t maxTextureSize
Definition: GRenderer.h:274
stl::enumeration< RenderCapBits, std::uint32_t > capBits
Definition: GRenderer.h:271
std::uint32_t blendModes
Definition: GRenderer.h:273
std::uint32_t vertexFormats
Definition: GRenderer.h:272
Definition: GRenderer.h:254
float eyeSeparationCm
Definition: GRenderer.h:263
float displayDiagInches
Definition: GRenderer.h:261
float distortion
Definition: GRenderer.h:260
float displayAspectRatio
Definition: GRenderer.h:262
float displayWidthCm
Definition: GRenderer.h:259
Definition: GRenderer.h:279
std::uint16_t pad1E
Definition: GRenderer.h:290
const char * string
Definition: GRenderer.h:284
float * matrix
Definition: GRenderer.h:286
std::uint32_t matrixSize
Definition: GRenderer.h:287
stl::enumeration< UserDataPropertyFlag, std::uint8_t > propFlags
Definition: GRenderer.h:288
std::uint8_t pad1D
Definition: GRenderer.h:289
float * flt
Definition: GRenderer.h:285
Definition: GRenderer.h:315
std::int16_t x
Definition: GRenderer.h:323
std::int16_t y
Definition: GRenderer.h:324
std::uint32_t color
Definition: GRenderer.h:325
Definition: GRenderer.h:330
std::uint32_t color
Definition: GRenderer.h:340
std::uint32_t factors
Definition: GRenderer.h:341
std::int16_t y
Definition: GRenderer.h:339
std::int16_t x
Definition: GRenderer.h:338
Definition: GRenderer.h:306
std::int16_t y
Definition: GRenderer.h:310
std::int16_t x
Definition: GRenderer.h:309