CommonLibSSE NG
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:
229
230 enum
231 {
236 kRGBA
237 };
238
239 enum
240 {
244 };
245
247
249
250 bool IsIdentity() const;
251
252 bool operator==(const Cxform& a_rhs) const;
253
254 // members
255 float matrix[kRGBA][kMultAdd]; // 00
256 };
257 static_assert(sizeof(Cxform) == 0x20);
258
260 {
261 public:
263
264 // members
265 float displayWidthCm; // 00
266 float distortion; // 04
267 float displayDiagInches; // 08
269 float eyeSeparationCm; // 10
270 };
271 static_assert(sizeof(StereoParams) == 0x14);
272
274 {
275 public:
276 // members
278 std::uint32_t vertexFormats; // 04
279 std::uint32_t blendModes; // 08
280 std::uint32_t maxTextureSize; // 0C
281 };
282 static_assert(sizeof(RenderCaps) == 0x10);
283
284 struct UserData
285 {
286 public:
288
289 // members
290 const char* string; // 00
291 float* flt; // 08
292 float* matrix; // 10
293 std::uint32_t matrixSize; // 18
295 std::uint8_t pad1D; // 1D
296 std::uint16_t pad1E; // 1E
297 };
298 static_assert(sizeof(UserData) == 0x20);
299
301 {
302 public:
303 // members
308 };
309 static_assert(sizeof(FillTexture) == 0x28);
310
312 {
313 public:
314 // members
315 std::int16_t x; // 0
316 std::int16_t y; // 2
317 };
318 static_assert(sizeof(VertexXY16i) == 0x4);
319
321 {
322 public:
323 enum
324 {
325 kVFormat = static_cast<std::underlying_type_t<VertexFormat>>(VertexFormat::kXY16iC32)
326 };
327
328 // members
329 std::int16_t x; // 0
330 std::int16_t y; // 2
331 std::uint32_t color; // 4
332 };
333 static_assert(sizeof(VertexXY16iC32) == 0x8);
334
336 {
337 public:
338 enum
339 {
340 kVFormat = static_cast<std::underlying_type_t<VertexFormat>>(VertexFormat::kXY16iCF32)
341 };
342
343 // members
344 std::int16_t x; // 0
345 std::int16_t y; // 2
346 std::uint32_t color; // 4
347 std::uint32_t factors; // 8
348 };
349 static_assert(sizeof(VertexXY16iCF32) == 0xC);
350
352 {
353 public:
354 // members
358 };
359 static_assert(sizeof(BitmapDesc) == 0x24);
360
362 {
363 public:
364 // members
365 float width; // 00
366 float shadowWidth; // 04
370 float glowSize[2]; // 18
371 };
372 static_assert(sizeof(DistanceFieldParams) == 0x20);
373
375 {
376 public:
377 // members
378 std::uint32_t mode; // 00
379 float blurX; // 04
380 float blurY; // 08
381 std::uint32_t passes; // 0C
385 float strength; // 20
387 };
388 static_assert(sizeof(BlurFilterParams) == 0x44);
389
390 ~GRenderer() override; // 00
391
392 // add
393 virtual bool GetRenderCaps(RenderCaps* a_caps) = 0; // 01
394 virtual GTexture* CreateTexture() = 0; // 02
395 virtual GTexture* CreateTextureYUV() = 0; // 03
396 virtual void BeginFrame(); // 04
397 virtual void EndFrame(); // 05
398 virtual GRenderTarget* CreateRenderTarget() = 0; // 06
399 virtual void SetDisplayRenderTarget(GRenderTarget* a_renderTarget, bool a_setstate = true) = 0; // 07
400 virtual void PushRenderTarget(const GRectF& a_frameRect, GRenderTarget* a_renderTarget) = 0; // 08
401 virtual void PopRenderTarget() = 0; // 09
402 virtual GTexture* PushTempRenderTarget(const GRectF& a_frameRect, std::uint32_t a_targetW, std::uint32_t a_targetH) = 0; // 0A
403 virtual void ReleaseTempRenderTargets(std::uint32_t a_keepArea); // 0B
404 virtual void BeginDisplay(GColor a_backgroundColor, const GViewport& a_viewport, float a_x0, float a_x1, float a_y0, float a_y1) = 0; // 0C
405 virtual void EndDisplay() = 0; // 0D
406 virtual void SetMatrix(const Matrix& a_matrix) = 0; // 0E
407 virtual void SetUserMatrix(const Matrix& a_matrix) = 0; // 0F
408 virtual void SetCxform(const Cxform& a_cxForm) = 0; // 10
409 virtual void PushBlendMode(BlendType a_mode) = 0; // 11
410 virtual void PopBlendMode() = 0; // 12
411 virtual bool PushUserData(UserData* a_data); // 13
412 virtual void PopUserData(); // 14
413 virtual void SetPerspective3D(const GMatrix3D& a_projMatIn) = 0; // 15
414 virtual void SetView3D(const GMatrix3D& a_viewMatIn) = 0; // 16
415 virtual void SetWorld3D(const GMatrix3D* a_worldMatIn) = 0; // 17
416 virtual void MakeViewAndPersp3D(const GRectF& a_visFrameRectInTwips, GMatrix3D& a_matView, GMatrix3D& a_matPersp, float a_perspFOV, bool a_InvertY = false); // 18
417 virtual void SetStereoParams(StereoParams a_params); // 19
418 virtual void SetStereoDisplay(StereoDisplay a_display, bool a_setstate = false); // 1A
419 virtual void SetVertexData(const void* a_vertices, std::int32_t a_numVertices, VertexFormat a_vtxFmt, CacheProvider* a_cache = 0) = 0; // 1B
420 virtual void SetIndexData(const void* a_indices, std::int32_t a_numIndices, IndexFormat a_idxFmt, CacheProvider* a_cache = 0) = 0; // 1C
421 virtual void ReleaseCachedData(CachedData* a_data, CachedDataType a_type) = 0; // 1D
422 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
423 virtual void DrawLineStrip(std::int32_t a_baseVertexIndex, std::int32_t a_lineCount) = 0; // 1F
424 virtual void LineStyleDisable() = 0; // 20
425 virtual void LineStyleColor(GColor a_color) = 0; // 21
426 virtual void FillStyleDisable() = 0; // 22
427 virtual void FillStyleColor(GColor a_color) = 0; // 23
428 virtual void FillStyleBitmap(const FillTexture* a_fill) = 0; // 24
429 virtual void FillStyleGouraud(GouraudFillType a_fillType, const FillTexture* a_texture0 = 0, const FillTexture* a_texture1 = 0, const FillTexture* a_texture2 = 0) = 0; // 25
430 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
431 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
432 virtual void BeginSubmitMask(SubmitMaskMode a_maskMode = SubmitMaskMode::kClear) = 0; // 28
433 virtual void EndSubmitMask() = 0; // 29
434 virtual void DisableMask() = 0; // 2A
435 virtual std::uint32_t CheckFilterSupport(const BlurFilterParams& a_params) = 0; // 2B
436 virtual void DrawBlurRect(GTexture* a_srcIn, const GRectF& a_inSrcRect, const GRectF& a_inDstRect, const BlurFilterParams& a_params) = 0; // 2C
437 virtual void DrawColorMatrixRect(GTexture* a_srcIn, const GRectF& a_inSrcRect, const GRectF& a_dstRect, const float* a_matrix) = 0; // 2D
438 virtual void GetRenderStats(Stats* a_stats, bool a_resetStats = 0) = 0; // 2E
439 virtual void GetStats(GStatBag* a_bag, bool a_reset = true) = 0; // 2F
440 virtual void ReleaseResources() = 0; // 30
441 virtual bool AddEventHandler(GRendererEventHandler* a_handler); // 31
442 virtual void RemoveEventHandler(GRendererEventHandler* a_handler); // 32
443
444 void FillStyleBitmap(GTexture* a_texture, const Matrix& a_matrix, BitmapWrapMode a_wrapMode, BitmapSampleMode a_sampleMode);
445
446 // members
450 };
451 static_assert(sizeof(GRenderer) == 0x38);
452}
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
static Cxform Identity
Definition GRenderer.h:228
float matrix[kRGBA][kMultAdd]
Definition GRenderer.h:255
@ kMult
Definition GRenderer.h:241
@ kAdd
Definition GRenderer.h:242
@ kMultAdd
Definition GRenderer.h:243
bool IsIdentity() const
@ kA
Definition GRenderer.h:235
@ kRGBA
Definition GRenderer.h:236
@ kG
Definition GRenderer.h:233
@ kB
Definition GRenderer.h:234
@ kR
Definition GRenderer.h:232
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:449
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:448
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:447
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:223
Definition AbsorbEffect.h:6
GPoint< float > GPointF
Definition GPoint.h:20
GRect< float > GRectF
Definition GRect.h:16
Definition GRenderer.h:352
GColor Color
Definition GRenderer.h:357
Rect Coords
Definition GRenderer.h:355
Rect TextureCoords
Definition GRenderer.h:356
Definition GRenderer.h:375
std::uint32_t passes
Definition GRenderer.h:381
float blurX
Definition GRenderer.h:379
GColor color2
Definition GRenderer.h:384
float blurY
Definition GRenderer.h:380
GColor color
Definition GRenderer.h:383
std::uint32_t mode
Definition GRenderer.h:378
float strength
Definition GRenderer.h:385
Cxform cxform
Definition GRenderer.h:386
GPointF offset
Definition GRenderer.h:382
Definition GRenderer.h:362
GColor shadowColor
Definition GRenderer.h:367
float glowSize[2]
Definition GRenderer.h:370
GColor glowColor
Definition GRenderer.h:369
GPointF shadowOffset
Definition GRenderer.h:368
float width
Definition GRenderer.h:365
float shadowWidth
Definition GRenderer.h:366
Definition GRenderer.h:301
Matrix textureMatrix
Definition GRenderer.h:305
GTexture * texture
Definition GRenderer.h:304
stl::enumeration< BitmapSampleMode, std::uint32_t > sampleMode
Definition GRenderer.h:307
stl::enumeration< BitmapWrapMode, std::uint32_t > wrapMode
Definition GRenderer.h:306
Definition GRenderer.h:274
std::uint32_t maxTextureSize
Definition GRenderer.h:280
stl::enumeration< RenderCapBits, std::uint32_t > capBits
Definition GRenderer.h:277
std::uint32_t blendModes
Definition GRenderer.h:279
std::uint32_t vertexFormats
Definition GRenderer.h:278
Definition GRenderer.h:260
float eyeSeparationCm
Definition GRenderer.h:269
float displayDiagInches
Definition GRenderer.h:267
float distortion
Definition GRenderer.h:266
float displayAspectRatio
Definition GRenderer.h:268
float displayWidthCm
Definition GRenderer.h:265
Definition GRenderer.h:285
std::uint16_t pad1E
Definition GRenderer.h:296
const char * string
Definition GRenderer.h:290
float * matrix
Definition GRenderer.h:292
std::uint32_t matrixSize
Definition GRenderer.h:293
stl::enumeration< UserDataPropertyFlag, std::uint8_t > propFlags
Definition GRenderer.h:294
std::uint8_t pad1D
Definition GRenderer.h:295
float * flt
Definition GRenderer.h:291
Definition GRenderer.h:321
std::int16_t x
Definition GRenderer.h:329
std::int16_t y
Definition GRenderer.h:330
std::uint32_t color
Definition GRenderer.h:331
Definition GRenderer.h:336
std::uint32_t color
Definition GRenderer.h:346
std::uint32_t factors
Definition GRenderer.h:347
std::int16_t y
Definition GRenderer.h:345
std::int16_t x
Definition GRenderer.h:344
Definition GRenderer.h:312
std::int16_t y
Definition GRenderer.h:316
std::int16_t x
Definition GRenderer.h:315