CommonLibSSE NG
Loading...
Searching...
No Matches
GTexture.h
Go to the documentation of this file.
1#pragma once
2
3#include "RE/G/GAtomic.h"
4#include "RE/G/GImage.h"
6#include "RE/G/GPoint.h"
7#include "RE/G/GRect.h"
8
9namespace RE
10{
11 class GImageBase;
12 class GRenderer;
13
14 class GTexture : public GNewOverrideBase<GStatRenderer::kMem>
15 {
16 public:
17 using Handle = void*;
18
19 enum class MapFlags
20 {
21 kNone = 0,
22 kKeepOld = 1
23 };
24
25 enum class ImageTexUsage
26 {
27 kWrap = 1 << 0,
28 kUpdate = 1 << 4,
29 kMap = 1 << 5,
30 kRenderTarget = 1 << 6
31 };
32
34 {
35 public:
36 // members
39 };
40 static_assert(sizeof(UpdateRect) == 0x18);
41
42 struct MapRect
43 {
44 public:
45 // members
46 std::uint32_t width; // 00
47 std::uint32_t height; // 04
48 std::uint8_t* data; // 08
49 std::uint32_t pitch; // 10
50 std::uint32_t pad14; // 14
51 };
52 static_assert(sizeof(MapRect) == 0x18);
53
55 {
56 public:
57 enum class EventType
58 {
62 };
63
64 virtual ~ChangeHandler() = default; // 00
65
66 // add
67 virtual void OnChange(GRenderer* a_renderer, EventType a_changeType); // 01
68 virtual bool Recreate(GRenderer* a_renderer); // 02
69 };
70 static_assert(sizeof(ChangeHandler) == 0x8);
71
72 virtual ~GTexture() = default; // 00
73
74 // add
75 virtual bool InitTexture(GImageBase* a_im, ImageTexUsage a_usage = ImageTexUsage::kWrap) = 0; // 01
76 virtual bool InitDynamicTexture(std::int32_t a_width, std::int32_t a_height, GImage::ImageFormat a_format, std::int32_t a_mipmaps, ImageTexUsage a_usage) = 0; // 02
77 virtual void Update(std::int32_t a_level, std::int32_t a_num, const UpdateRect* a_rects, const GImageBase* a_im) = 0; // 03
78 virtual std::int32_t Map(std::int32_t a_level, std::int32_t a_num, MapRect* a_maps, MapFlags a_flags = MapFlags::kNone) = 0; // 04
79 virtual bool Unmap(std::int32_t a_level, std::int32_t a_num, MapRect* a_maps, MapFlags a_flags = MapFlags::kNone) = 0; // 05
80 [[nodiscard]] virtual GRenderer* GetRenderer() const = 0; // 06
81 [[nodiscard]] virtual bool IsDataValid() const = 0; // 07
82 [[nodiscard]] virtual Handle GetUserData() const = 0; // 08
83 virtual void SetUserData(Handle a_data) = 0; // 09
84 virtual void AddChangeHandler(ChangeHandler* a_handler) = 0; // 0A
85 virtual void RemoveChangeHandler(ChangeHandler* a_handler) = 0; // 0B
86
87 // members
89 };
90}
Definition GAtomic.h:43
Definition GImageBase.h:9
ImageFormat
Definition GImageBase.h:12
Definition GNewOverrideBase.h:9
Definition GPoint.h:7
Definition GRect.h:7
Definition GRenderer.h:19
Definition GTexture.h:55
EventType
Definition GTexture.h:58
virtual ~ChangeHandler()=default
virtual bool Recreate(GRenderer *a_renderer)
virtual void OnChange(GRenderer *a_renderer, EventType a_changeType)
Definition GTexture.h:15
MapFlags
Definition GTexture.h:20
virtual bool Unmap(std::int32_t a_level, std::int32_t a_num, MapRect *a_maps, MapFlags a_flags=MapFlags::kNone)=0
virtual bool InitTexture(GImageBase *a_im, ImageTexUsage a_usage=ImageTexUsage::kWrap)=0
virtual std::int32_t Map(std::int32_t a_level, std::int32_t a_num, MapRect *a_maps, MapFlags a_flags=MapFlags::kNone)=0
virtual bool IsDataValid() const =0
virtual Handle GetUserData() const =0
virtual ~GTexture()=default
virtual void SetUserData(Handle a_data)=0
virtual bool InitDynamicTexture(std::int32_t a_width, std::int32_t a_height, GImage::ImageFormat a_format, std::int32_t a_mipmaps, ImageTexUsage a_usage)=0
virtual void RemoveChangeHandler(ChangeHandler *a_handler)=0
void * Handle
Definition GTexture.h:17
virtual void Update(std::int32_t a_level, std::int32_t a_num, const UpdateRect *a_rects, const GImageBase *a_im)=0
virtual void AddChangeHandler(ChangeHandler *a_handler)=0
virtual GRenderer * GetRenderer() const =0
ImageTexUsage
Definition GTexture.h:26
GAtomicInt< std::int32_t > refCount
Definition GTexture.h:88
Definition AbsorbEffect.h:6
Definition GTexture.h:43
std::uint32_t height
Definition GTexture.h:47
std::uint32_t pad14
Definition GTexture.h:50
std::uint32_t pitch
Definition GTexture.h:49
std::uint8_t * data
Definition GTexture.h:48
std::uint32_t width
Definition GTexture.h:46
Definition GTexture.h:34
GPoint< std::int32_t > dest
Definition GTexture.h:37
GRect< std::int32_t > src
Definition GTexture.h:38