Polyphase Game Engine
Loading...
Searching...
No Matches
TextureAtlasViewer.h
Go to the documentation of this file.
1#pragma once
2
3#if EDITOR
4
5#include <cstdint>
6#include <string>
7#include "imgui.h"
8
9class Texture;
10class Image;
11
12class TextureAtlasViewer
13{
14public:
15 ~TextureAtlasViewer();
16
17 void DrawPanel();
18
19private:
20 // Loaded texture asset
21 Texture* mTexture = nullptr;
22 ImTextureID mImGuiTexId = 0;
23 // Resource generation mImGuiTexId was built from. See Texture::GetResourceGeneration().
24 uint32_t mTexGeneration = 0;
25 uint32_t mAtlasWidth = 0;
26 uint32_t mAtlasHeight = 0;
27
28 // Atlas grid configuration
29 int32_t mTileWidth = 8;
30 int32_t mTileHeight = 8;
31
32 // Selection
33 int32_t mSelectedTileIndex = -1;
34 int32_t mHoveredTileIndex = -1;
35
36 // Manual tile index lookup
37 int32_t mLookupTileIndex = 0;
38
39 // Zoom
40 float mZoom = 2.0f;
41
42 void SetTexture(Texture* tex);
43 void ClearTexture();
44 void DrawControls();
45 void DrawAtlasImage();
46 void DrawTilePreview();
47};
48
49TextureAtlasViewer* GetTextureAtlasViewer();
50
51#endif
Definition Texture.h:10