Photon Editor Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
Texture2D.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <Common/utility.h>
7#include <Math/TVector2.h>
8
9#include <memory>
10
11namespace ph { class PictureData; }
12
13namespace ph::editor::render
14{
15
17{
18public:
20 const ghi::TextureFormatInfo& format,
21 std::unique_ptr<PictureData> textureData);
22
23 ~Texture2D() override;
24
25 std::size_t getWidthPx() const override;
26 std::size_t getHeightPx() const override;
28 const ghi::TextureFormatInfo& getFormat() const;
29
30 void setupGHI(GHIThreadCaller& caller) override;
31 void cleanupGHI(GHIThreadCaller& caller) override;
32
33private:
34 math::Vector2UI m_sizePx;
36
37 ghi::TextureHandle m_textureHandle;
38 std::unique_ptr<PictureData> m_textureData;
39};
40
41inline std::size_t Texture2D::getWidthPx() const
42{
43 return lossless_integer_cast<std::size_t>(m_sizePx.x());
44}
45
46inline std::size_t Texture2D::getHeightPx() const
47{
48 return lossless_integer_cast<std::size_t>(m_sizePx.y());
49}
50
52{
53 return m_textureHandle;
54}
55
57{
58 return m_format;
59}
60
61}// end namespace ph::editor::render
Thin wrapper for GHI thread interactions from another thread. Mainly to hide unrelated GHI interface ...
Definition GHIThreadCaller.h:16
Definition ghi_infos.h:24
Definition Texture2D.h:17
std::size_t getHeightPx() const override
Definition Texture2D.h:46
void setupGHI(GHIThreadCaller &caller) override
Definition Texture2D.cpp:34
std::size_t getWidthPx() const override
Definition Texture2D.h:41
const ghi::TextureFormatInfo & getFormat() const
Definition Texture2D.h:56
Texture2D(const ghi::TextureFormatInfo &format, std::unique_ptr< PictureData > textureData)
Definition Texture2D.cpp:14
ghi::TextureHandle getGHITextureHandle() const override
Definition Texture2D.h:51
void cleanupGHI(GHIThreadCaller &caller) override
Definition Texture2D.cpp:59
~Texture2D() override
Definition Texture2D.cpp:31
Definition TextureResource.h:13
Definition DesignerObject.h:19
Definition ph_editor.h:5