OROCHI
 
Loading...
Searching...
No Matches
GxToolTextureManager.h
Go to the documentation of this file.
1//===========================================================================
10//===========================================================================
11#pragma once
12
13#if GX_DEVELOP
14
15GX_CORE_NAMESPACE_BEGIN()
16
17// 前方宣言
18class GxGuiForm;
19class GxGuiSplitterCross;
20
21//===========================================================================
23//===========================================================================
24/* GUI内訳
25 ┏━GxToolTextureManager━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
26 ┃ ┃
27 ┃┌GxGuiSplitter ───────────────────────────────┐┃
28 ┃│┏GxGuiSplitter ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓│┃
29 ┃│┃┌GxGuiFormProperty ─────────────────────────┐┃│┃
30 ┃│┃│ │┃│┃
31 ┃│┃└──────────────────────────────────┘┃│┃
32 ┃│┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫│┃
33 ┃│┃┌GxGuiTab─────────────┬────────────────┐┃│┃
34 ┃│┃│┏GxGuiPropertyFlag ━━━━━━┓・┏GxGuiFormProperty ━━━━━┓│┃│┃
35 ┃│┃│┃ ┃・┃ ┃│┃│┃
36 ┃│┃│┗━━━━━━━━━━━━━━━┛・┗━━━━━━━━━━━━━━┛│┃│┃
37 ┃│┃└─────────────────┴────────────────┘┃│┃
38 ┃│┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛│┃
39 ┃├──────────────────────────────────────┤┃
40 ┃│┏GxGuiForm _pTextureForm ━━━━━━━━━━━━━━━━━━━━━━━━┓│┃
41 ┃│┃┌GuiCrossSplitter ─────┬──────────────┬────┐┃│┃
42 ┃│┃│┏GxGuiFormBody _pBody[0] ┓│┏GxGuiFormBody _pBody[1] ┓│・・・ │┃│┃
43 ┃│┃│┃ ┃│┃ ┃│ │┃│┃
44 ┃│┃│┗━━━━━━━━━━━━┛│┗━━━━━━━━━━━━┛│ │┃│┃
45 ┃│┃├──────────────┼──────────────┼────┤┃│┃
46 ┃│┃│┏GxGuiName _pName[0] ━━┓│┏GxGuiName _pName[1] ━━┓│・・・ │┃│┃
47 ┃│┃│┃ ┃│┃ ┃│ │┃│┃
48 ┃│┃│┗━━━━━━━━━━━━┛│┗━━━━━━━━━━━━┛│ │┃│┃
49 ┃│┃└──────────────┴──────────────┴────┘┃│┃
50 ┃│┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛│┃
51 ┃└──────────────────────────────────────┘┃
52 ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
53*/
54class GxToolTextureManager : public GxToolBase
55{
56 //-------------------------------------------------------------
58 //-------------------------------------------------------------
60public:
61 // RTTI定義
62 GX_RTTI_CLASS_NAME_ICON( GxToolTextureManager, GxToolBase, "テクスチャ管理", GxRtti::ICON_TYPE::CORE )
63 // ClassBaseReference継承クラス用禁止宣言
64 GX_PROHIBIT_CLASS_BASE_REFERENCE( GxToolTextureManager )
65
66 class GxGuiFormTexturePanel;
67 class GxGuiFormTextureList;
68 class GxGuiFormUnitList;
69 class GxGuiUnitBoard;
70
72 static const GxRect TEXTURE_RECT;
74 static const u32 TEXTURE_NAME_HEIGHT;
76 static constexpr u32 BAR_WIDTH = 1;
77
79 static constexpr u32 FORM_WIDTH = 900;
81 static constexpr u32 FORM_HEIGHT = 500;
83 static constexpr u32 FORM_TEXTURE_LIST_MASK_HEIGHT = 84;
85 static constexpr u32 FORM_TEXTURE_LIST_WIDTH = 300;
87 static constexpr u32 FORM_TEXTURE_VIEW_WIDTH = 380;
89 static constexpr u32 FORM_TEXTURE_PARAM1_HEIGHT = 244;
91 static constexpr u32 FORM_TEXTURE_PARAM2_HEIGHT = 374;
92
94 //-------------------------------------------------------------
96 //-------------------------------------------------------------
98
100 GxToolTextureManager( void );
101
103 b32 initialize( void ) override;
104
106 void cleanup(void) override;
107
109 //-------------------------------------------------------------
111 //-------------------------------------------------------------
113
115 void update( void ) override;
116
118 b32 selectUnitTexture( GxRenderTexture* pTexture );
119
120protected:
122 void arrangeTexturePanel(void);
123
125 void updateTextureFormSize(void);
126
128 void onViewMaxExpand(void) override;
129
131 virtual void onViewMiddleExpand(void);
132
134 void onViewMinExpand(void) override;
135
137 //-------------------------------------------------------------
139 //-------------------------------------------------------------
141
143 constexpr GxToolTextureProperty::GxGuiFormTextureParam* getFormTexture(void) const { return _pFormTexture; }
145 constexpr GxToolTextureManager::GxGuiFormUnitList* getUnitListForm(void) const { return _pUnitListForm; }
146
148 //-------------------------------------------------------------
150 //-------------------------------------------------------------
152private:
153 u32 _textureCount;
154 u32 _textureSize;
155 u32 _textureNonMipSize;
156 u32 _columnBlank;
157
158 GxArrayClassBase* _pTextureList;
159 GxArrayClassBase* _pGuiList;
160 GxGuiForm* _pTextureForm;
161 GxGuiFormTextureList* _pCross;
162
163 b32 _renderGrepAttributeFlag;
164 b32 _renderGrepFormatFlag;
165
166 u32 _renderAttributeFlag;
167
168 b32 _renderFormatUNKNOWNFlag;
169 b32 _renderFormatR8G8B8A8Flag;
170 b32 _renderFormatR8G8B8X8Flag;
171 b32 _renderFormatR8Flag;
172 b32 _renderFormatA8Flag;
173#if defined(_PS4) || defined(_PS5)
174 b32 _renderFormatR32_UINTFlag;
175#endif // _PS4 || _PS5
176 b32 _renderFormatR32FFlag;
177 b32 _renderFormatR32G32B32A32FFlag;
178 b32 _renderFormatR16G16FFlag;
179 b32 _renderFormatR16G16B16A16FFlag;
180 b32 _renderFormatR11G11B10FFlag;
181 b32 _renderFormatDXT1Flag;
182 b32 _renderFormatDXT3Flag;
183 b32 _renderFormatDXT5Flag;
184 b32 _renderFormatBC6HFlag;
185 b32 _renderFormatBC7Flag;
186 b32 _renderFormatD16Flag;
187 b32 _renderFormatD24S8Flag;
188 b32 _renderFormatR8G8B8A8_SRGBFlag;
189 b32 _renderFormatDXT1_SRGBFlag;
190 b32 _renderFormatDXT3_SRGBFlag;
191 b32 _renderFormatDXT5_SRGBFlag;
192 b32 _renderFormatBC7_SRGBFlag;
193
194 GxGuiSplitter* _pSplitterMain;
195 GxGuiSplitter* _pSplitterRight;
196 GxToolTextureProperty::GxGuiFormTextureParam* _pFormTexture;
197 GxGuiFormUnitList* _pUnitListForm;
198 b32 _unitGrepFlag;
199 b32 _toggleViewMiddleExpand;
200
202};
203
204//===========================================================================
206//===========================================================================
207class GxToolTextureManager::GxGuiFormTexturePanel : public GxGuiForm
208{
209 //-------------------------------------------------------------
211 //-------------------------------------------------------------
213public:
214 // RTTI定義
215 GX_RTTI_CLASS( GxToolTextureManager::GxGuiFormTexturePanel, GxGuiForm )
216 // ClassBaseReference継承クラス用禁止宣言
217 GX_PROHIBIT_CLASS_BASE_REFERENCE( GxGuiFormTexturePanel )
218
219
220 //-------------------------------------------------------------
222 //-------------------------------------------------------------
224
226 GxGuiFormTexturePanel( void );
227
229 GxGuiFormTexturePanel( GxToolTextureManager* pTool );
230
232 //-------------------------------------------------------------
234 //-------------------------------------------------------------
236
238 void setTexture( GxRenderTexture* pTexture );
239
241 //-------------------------------------------------------------
243 //-------------------------------------------------------------
245protected:
247 void onDraw( void ) override;
248
250 void onClick( const GxPoint2& position, u32 button ) override;
251
253 //-------------------------------------------------------------
255 //-------------------------------------------------------------
257private:
258 GxRenderTexture* _pTexture;
259 GxString _fileName;
260 GxToolTextureManager* _pTool;
261
263};
264
265//===========================================================================
267//===========================================================================
268class GxToolTextureManager::GxGuiFormTextureList : public GxGuiSplitterCross
269{
270 //-------------------------------------------------------------
272 //-------------------------------------------------------------
274public:
275 // RTTI定義
276 GX_RTTI_CLASS(GxToolTextureManager::GxGuiFormTextureList, GxGuiSplitterCross)
277 // ClassBaseReference継承クラス用禁止宣言
278 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxGuiFormTextureList)
279
280
281 //-------------------------------------------------------------
283 //-------------------------------------------------------------
285
287 GxGuiFormTextureList(void);
288
290 //-----------------------------------------------------------
292 //-----------------------------------------------------------
294public:
296 void clearTextureGuiList(void);
297
299 void setTextureGui(GxGuiBase* pGui, u32 column, u32 row);
300
302};
303
304//===========================================================================
306//===========================================================================
307class GxToolTextureManager::GxGuiFormUnitList : public GxGuiForm
308{
309 //-------------------------------------------------------------
311 //-------------------------------------------------------------
313public:
314 // RTTI定義
315 GX_RTTI_CLASS( GxToolTextureManager::GxGuiFormUnitList, GxGuiForm )
316 // ClassBaseReference継承クラス用禁止宣言
317 GX_PROHIBIT_CLASS_BASE_REFERENCE( GxGuiFormUnitList )
318
319
320 //-------------------------------------------------------------
322 //-------------------------------------------------------------
324
326 GxGuiFormUnitList( GxToolTextureManager* pTool );
327
329 b32 initialize( void ) override;
330
332 void cleanup(void) override;
333
334private:
336 GxGuiFormUnitList( void ) : _pListGuiUnit(nullptr), _ppSelectedUnit(nullptr), _pTool(nullptr){}
337
339 //-------------------------------------------------------------
341 //-------------------------------------------------------------
343public:
345 void update( void ) override;
346
348 void addUnit( GxUnitBase* pUnit );
349
351 void clearUnitList(void);
352
354 void searchUsingUnit( GxRenderTexture* pTexture );
355
356protected:
358 void onDraw(void) override;
359
361 //-------------------------------------------------------------
363 //-------------------------------------------------------------
365public:
367 constexpr u32 getUnitCount(void) const { return _pListGuiUnit->getCount(); }
368
370 constexpr GxToolTextureManager* getTool( void ) const { return _pTool; }
371
373 constexpr void setSelectTexture( GxRenderTexture* texture ) { _pSelectTexture = texture; }
374
376 //-------------------------------------------------------------
378 //-------------------------------------------------------------
380private:
381 GxArrayClassBase* _pListUnit;
382 GxArrayClassBase* _pListGuiUnit;
383 u32 _unitCountMax;
384 GxUnitBase** _ppSelectedUnit;
385
386 GxToolTextureManager* _pTool;
387 GxRenderTexture* _pSelectTexture;
388
390};
391
392//===========================================================================
394//===========================================================================
395class GxToolTextureManager::GxGuiUnitBoard : public GxGuiBase
396{
397 //-------------------------------------------------------------
399 //-------------------------------------------------------------
401public:
402 // RTTI定義
403 GX_RTTI_CLASS( GxToolTextureManager::GxGuiUnitBoard, GxGuiBase )
404 // ClassBaseReference継承クラス用禁止宣言
405 GX_PROHIBIT_CLASS_BASE_REFERENCE( GxGuiUnitBoard )
406
407
408 //-------------------------------------------------------------
410 //-------------------------------------------------------------
412
414 GxGuiUnitBoard( void );
415
417 //-------------------------------------------------------------
419 //-------------------------------------------------------------
421
423 void drawNamePlate( const GxPoint2& position, const GxColor& frameColor, const GxToolColor& plateColor, const GxColor& nameColor );
424
426 GX_FORCE_INLINE void killUnit(void) { if (_pUnit) _pUnit->kill(); _pUnit = nullptr; }
427
429 GX_FORCE_INLINE void setUnitAttribute(const GxUnitBase::ATTRIBUTE attribute, const b32 isOn) { if (_pUnit) _pUnit->setAttribute(attribute, isOn); }
430
432 GX_FORCE_INLINE void toggleUnitAttribute(const GxUnitBase::ATTRIBUTE attribute) { if (_pUnit) _pUnit->setAttribute(attribute, !_pUnit->isAttribute(attribute)); }
433
434protected:
436 GX_FORCE_INLINE void update(void) override
437 {
438 Super::update();
439
440 if (_pUnit && !_pUnit->isEnable())
441 {
442 _pUnit = nullptr;
443 }
444 }
445
447 void onMouseDown(const GxPoint2& position, u32 button) override;
448
450 void onDoubleClick(const GxPoint2& position, u32 button) override;
451
453 void onDraw(void) override;
454
455private:
457 void toggleIsSelected(void);
458
460 void createToolUnitProperty(void);
461
463 //-------------------------------------------------------------
465 //-------------------------------------------------------------
467public:
469 GX_FORCE_INLINE b32 isSelected( void ) { return _pUnit ? (bool)(_pUnit->isAttribute(GxUnitBase::ATTRIBUTE_SELECTED)) : false; }
471 GX_FORCE_INLINE void setIsSelected( const b32 isSelected ) { if( _pUnit ) _pUnit->setAttribute( GxUnitBase::ATTRIBUTE_SELECTED, isSelected ); }
473 constexpr GxUnitBase* getUnit( void ) { return _pUnit; }
475 void setUnit( GxUnitBase* pUnit );
477 constexpr void setUnitName( GX_CSTR unitName ) { _unitName = unitName; }
479 void setFrameColor( GxUnitBase* pUnit );
480
482 //-------------------------------------------------------------
484 //-------------------------------------------------------------
486private:
487 GxUnitBase* _pUnit;
488 GX_CSTR _unitName;
489 GxColor _frameColor;
490
492};
493
494GX_CORE_NAMESPACE_END()
495
496#endif // GX_DEVELOP
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
配列クラス
Definition GxArrayClassBase.h:18
テクスチャクラス
Definition GxRenderTexture.h:19
ユニット基礎クラス
Definition GxUnitBase.h:45
ATTRIBUTE
属性
Definition GxUnitBase.h:71
@ ATTRIBUTE_SELECTED
選択されているか
Definition GxUnitBase.h:73
Definition GxColor.h:21
座標
Definition GxStruct.h:867
矩形
Definition GxStruct.h:951
文字列型クラス
Definition GxString.h:18
32bitブーリアン
Definition GxDefine.h:173