OROCHI
 
Loading...
Searching...
No Matches
GxResPathSet.h
Go to the documentation of this file.
1//===========================================================================
9//===========================================================================
10#pragma once
11
12GX_CHARACTER_NAMESPACE_BEGIN()
13
14//===========================================================================
16//===========================================================================
17class GxResPathSet : public GxResBase
18{
19 //-------------------------------------------------------------
21 //-------------------------------------------------------------
23public:
24 // RTTI定義
25 GX_RTTI_RESOURCE_NAME(GxResPathSet, GxResBase, "経路セットリソース")
26 // GxClassBaseReference継承クラス用禁止宣言
28
29
30 static constexpr s32 INVALID_INDEX = -1;
32 static constexpr u32 ROUTE_NODE_DATA_MAX = GxMath::VALUE_32;
33
35 enum class SHAPE_TYPE
36 {
37 ERROR_ = -1,
38 SPHERE = 0,
39 BOX,
40 CYLINDER,
41 };
42#if GX_DEVELOP
44 GX_ENUM_TABLE(SHAPE_TYPE)
45#endif //GX_DEVELOP
46
57
60 {
62 s32 _nodeIndex[ROUTE_NODE_DATA_MAX];
63 };
64
73
81
83 //-----------------------------------------------------------
85 //-----------------------------------------------------------
87
89 GxResPathSet(void);
91 void cleanup(void) override;
92
94 //-----------------------------------------------------------
96 //-----------------------------------------------------------
98protected:
100 b32 load(GxStream& in, u32 dataSize);
101#if GX_DEVELOP
103 b32 save(GxStream& out);
104#endif //GX_DEVELOP
105
107 //-----------------------------------------------------------
109 //-----------------------------------------------------------
111
112#if GX_EDITOR
114 void getToolRtti(GxArray& arrayTool) const override;
115#endif //GX_EDITOR
116
117public:
119 GX_FORCE_INLINE u32 getAreaNum(void) const { return *reinterpret_cast<u32*>(_pBuffer); }
121 GX_FORCE_INLINE GxAreaParam* getArea(u32 area) const { return reinterpret_cast<GxAreaParam*>(_pBuffer + getAreaOffset(area)); }
123 GX_FORCE_INLINE GxRouteParam* getRoute(u32 area, u32 route) const { return reinterpret_cast<GxRouteParam*>(reinterpret_cast<GX_CHAR*>(getArea(area)) + getRouteOffset(area, route)); }
125 GX_FORCE_INLINE GxNodeParam* getNode(u32 area, u32 node) const { return reinterpret_cast<GxNodeParam*>(reinterpret_cast<GX_CHAR*>(getArea(area)) + getNodeOffset(area, node)); }
127 GX_FORCE_INLINE GxConnectParam* getConnect(u32 area, u32 node, u32 connect) const { return (reinterpret_cast<GxConnectParam*>(getNode(area, node) + 1) + connect); }
128private:
130 GX_FORCE_INLINE u32 getAreaOffset(u32 area) const { return *(reinterpret_cast<u32*>(_pBuffer) + 1 + area); }
132 GX_FORCE_INLINE u32 getRouteOffset(u32 area, u32 route) const { return *(reinterpret_cast<u32*>(getArea(area) + 1) + route); }
134 GX_FORCE_INLINE u32 getNodeOffset(u32 area, u32 node) const { return *(reinterpret_cast<u32*>(getArea(area) + 1) + getArea(area)->_numRoute + node); }
135
137 //-----------------------------------------------------------
139 //-----------------------------------------------------------
141protected:
142 GX_CHAR* _pBuffer;
144
146};
147
148#if GX_DEVELOP
149//===========================================================================
151//===========================================================================
152class GxResPathSetXml : public GxResPathSet
153{
154 //-------------------------------------------------------------
156 //-------------------------------------------------------------
158public:
159 // RTTI定義
160 GX_RTTI_RESOURCE(GxResPathSetXml, GxResPathSet)
161 // GxClassBaseReference継承クラス用禁止宣言
162 GX_PROHIBIT_CLASS_BASE_REFERENCE(GxResPathSetXml)
163
164
165 class GxEditArea : public GxClassBase
166 {
167 //-------------------------------------------------------------
169 //-------------------------------------------------------------
171 public:
172 // RTTI定義
173 GX_RTTI_CLASS(GxResPathSetXml::GxEditArea, GxClassBase)
174
175
176 class GxEditRoute : public GxClassBase
177 {
178 //-----------------------------------------------------------
180 //-----------------------------------------------------------
182 public:
183 // RTTI定義
184 GX_RTTI_CLASS(GxResPathSetXml::GxEditArea::GxEditRoute, GxClassBase)
185
186
187 //-----------------------------------------------------------
189 //-----------------------------------------------------------
191
193 GxEditRoute(void);
194
196 //-----------------------------------------------------------
198 //-----------------------------------------------------------
200
202 void getData(GxRouteParam* pData) const;
204 void setData(GxRouteParam* pData);
205
207 //-----------------------------------------------------------
209 //-----------------------------------------------------------
211
212 b32 _loopFlag;
213 s32 _nodeIndex[ROUTE_NODE_DATA_MAX];
214
216 };
217
219 class GxEditNode : public GxClassBase
220 {
221 //-----------------------------------------------------------
223 //-----------------------------------------------------------
225 public:
226 // RTTI定義
227 GX_RTTI_CLASS(GxResPathSetXml::GxEditArea::GxEditNode, GxClassBase)
228
229
230 class GxEditConnect : public GxClassBase
231 {
232 //-----------------------------------------------------------
234 //-----------------------------------------------------------
236 public:
237 // RTTI定義
238 GX_RTTI_CLASS(GxResPathSetXml::GxEditArea::GxEditNode::GxEditConnect, GxClassBase)
239
240
241 //-----------------------------------------------------------
243 //-----------------------------------------------------------
245
247 GxEditConnect(void);
248
250 //-----------------------------------------------------------
252 //-----------------------------------------------------------
254
256 void getData(GxConnectParam* pData) const;
258 void setData(GxConnectParam* pData);
259
261 //-----------------------------------------------------------
263 //-----------------------------------------------------------
265
266 u32 _nodeIndex;
267 f32 _staticWeight;
269
271 };
272
274 //-----------------------------------------------------------
276 //-----------------------------------------------------------
278
280 GxEditNode(void);
282 ~GxEditNode(void);
283
285 //-----------------------------------------------------------
287 //-----------------------------------------------------------
289
291 void getData(GxNodeParam* pData) const;
293 void setData(GxNodeParam* pData);
295 GX_FORCE_INLINE GxEditConnect* getConnect(u32 connect) const { return static_cast<GxEditConnect*>(_connectList.getNode(connect)->getObject()); }
297 GX_FORCE_INLINE GxListClassBase* getConnectList(void){ return &_connectList; }
299 static GxGuiBase* createGui(GxProperty& property, GxTypedObject* pOwner, const GxRtti& rtti, u32 index = 0);
301 void developRender(u32 index, GxColor color, b32 isSelected, f32 radius = 0.1f);
302
304 constexpr GxGuiButtonHandle* getGuiButtonHandle(void){ return _guiButtonHandle; }
306 constexpr void setGuiButtonHandle( GxGuiButtonHandle* pButton ){ _guiButtonHandle = pButton; }
307
309 //-----------------------------------------------------------
311 //-----------------------------------------------------------
313
314 GxVector3 _position;
315 s32 _data[GxPathNode::NUM_DATA];
316 b32 _flag[GxMath::VALUE_32];
317 private:
318 GxListClassBase _connectList;
319
320 GxGuiButtonHandle* _guiButtonHandle;
321
323 };
324
326 //-----------------------------------------------------------
328 //-----------------------------------------------------------
330
332 GxEditArea(void);
334 ~GxEditArea(void) override;
335
337 //-----------------------------------------------------------
339 //-----------------------------------------------------------
341
343 void getData(GxAreaParam* pData) const;
345 void setData(GxAreaParam* pData);
347 GX_FORCE_INLINE GxEditRoute* getRoute(u32 route) const { return static_cast<GxEditRoute*>(_routeList.getNode(route)->getObject()); }
349 GX_FORCE_INLINE GxListClassBase* getRouteList(void){ return &_routeList; }
351 GX_FORCE_INLINE GxEditNode* getNode(u32 node) const { return static_cast<GxEditNode*>(_nodeList.getNode(node)->getObject()); }
353 GX_FORCE_INLINE GxListClassBase* getNodeList(void){ return &_nodeList; }
355 void developRender( const GxEditNode* pSelectedNode, GxColor color = GxColor(0, 255, 0, 50), b32 isAreaDraw = true, b32 isNodeDraw = true, b32 isNodeWeightDraw = true);
357 static GxGuiBase* createGui(GxProperty& property, GxTypedObject* pOwner, const GxRtti& rtti, u32 index = 0);
359 GX_FORCE_INLINE GxVector3 getCenterPosition(void) const { return _shapeType == SHAPE_TYPE::BOX ? _position + _scale : _position; }
360
362 //-----------------------------------------------------------
364 //-----------------------------------------------------------
366 public:
367 GxVector3 _position;
368 GxVector3 _scale;
369 f32 _radius;
370 SHAPE_TYPE _shapeType;
371 private:
372 GxListClassBase _routeList;
373 GxListClassBase _nodeList;
374
376 };
377
379 //-----------------------------------------------------------
381 //-----------------------------------------------------------
383
385 GxResPathSetXml(void) : _areaList(GxAllocatorList::ALLOCATOR_TYPE::RESOURCE){}
387 void cleanup(void) override;
388
390 //-----------------------------------------------------------
392 //-----------------------------------------------------------
394protected:
396 GX_FORCE_INLINE b32 load(GxStream& in, u32 /*dataSize*/) { return GxResBase::loadXml(in); }
398 GX_FORCE_INLINE b32 save(GxStream& out){ return GxResBase::saveXml(out, GxResPathSetXml::GX_RTTI); }
400 b32 finalize(void);
401
403 //-----------------------------------------------------------
405 //-----------------------------------------------------------
407public:
409 GX_FORCE_INLINE GxEditArea* getArea(u32 area) const { return static_cast<GxEditArea*>(_areaList.getNode(area)->getObject()); }
411 GX_FORCE_INLINE GxListClassBase* getAreaList(void){ return &_areaList; }
412private:
414 b32 isNodeExist(GxEditArea* pArea, s32 node) const;
415
417 //-----------------------------------------------------------
419 //-----------------------------------------------------------
421private:
422 GxListClassBase _areaList;
423
425};
426#endif //GX_DEVELOP
427
428GX_CHARACTER_NAMESPACE_END()
#define GX_PROHIBIT_CLASS_BASE_REFERENCE(__CLASS__)
GxClassBaseReference継承の禁止宣言(new以外の生成禁止 + コピー禁止)
Definition GxBase.h:244
void GxTypedObject
その他
Definition GxDefine.h:213
#define GX_RTTI_RESOURCE(__THIS__, __BASE__)
リソースクラス型情報宣言
Definition GxRttiResource.h:102
メモリアロケータリスト
Definition GxAllocator.h:347
配列クラス
Definition GxArray.h:18
オブジェクト基底クラス
Definition GxBase.h:88
GxClassBase用連結リストクラス
Definition GxListClassBase.h:18
算術演算クラス
Definition GxMath.h:84
static constexpr u32 VALUE_32
32
Definition GxMath.h:124
static constexpr u32 NUM_ADD_WEIGHT
追加の重みの数
Definition GxPathSet.h:132
static constexpr u32 NUM_DATA
付加データの数
Definition GxPathSet.h:32
プロパティクラス
Definition GxProperty.h:48
リソース基底クラス
Definition GxResBase.h:23
経路セットリソースクラス
Definition GxResPathSet.h:18
GX_FORCE_INLINE GxRouteParam * getRoute(u32 area, u32 route) const
固定ルートデータを取得する
Definition GxResPathSet.h:123
GX_FORCE_INLINE GxNodeParam * getNode(u32 area, u32 node) const
ノードデータを取得する
Definition GxResPathSet.h:125
GX_CHAR * _pBuffer
finalizeデータ
Definition GxResPathSet.h:142
GX_FORCE_INLINE u32 getAreaNum(void) const
エリアデータの個数を取得
Definition GxResPathSet.h:119
SHAPE_TYPE
形状定義
Definition GxResPathSet.h:36
void cleanup(void) override
解放処理
Definition GxResPathSet.cpp:41
GX_FORCE_INLINE GxAreaParam * getArea(u32 area) const
エリアデータを取得する
Definition GxResPathSet.h:121
GX_FORCE_INLINE GxConnectParam * getConnect(u32 area, u32 node, u32 connect) const
接続データを取得する
Definition GxResPathSet.h:127
u32 _bufferSize
finalizeデータサイズ
Definition GxResPathSet.h:143
b32 load(GxStream &in, u32 dataSize)
リソースのロード
Definition GxResPathSet.cpp:53
実行時型情報クラス
Definition GxRtti.h:154
ストリーム基礎クラス
Definition GxStream.h:20
Definition GxColor.h:21
エリアパラメータ
Definition GxResPathSet.h:49
GxVector3 _position
座標
Definition GxResPathSet.h:52
f32 _radius
半径
Definition GxResPathSet.h:54
u32 _numNode
ノードの数
Definition GxResPathSet.h:50
GxVector3 _scale
拡大率
Definition GxResPathSet.h:53
u32 _numRoute
固定ルートの数
Definition GxResPathSet.h:51
SHAPE_TYPE _shapeType
コリジョンの形状
Definition GxResPathSet.h:55
接続パラメータ
Definition GxResPathSet.h:76
u32 _nodeIndex
接続するノードのインデックス
Definition GxResPathSet.h:77
f32 _staticWeight
固定の重み
Definition GxResPathSet.h:78
ノードパラメータ
Definition GxResPathSet.h:67
s32 _flag
付加フラグ
Definition GxResPathSet.h:71
u32 _numConnect
ノード接続の数
Definition GxResPathSet.h:68
GxVector3 _position
座標
Definition GxResPathSet.h:69
固定ルートパラメータ
Definition GxResPathSet.h:60
b32 _loopFlag
ループさせるかどうか
Definition GxResPathSet.h:61
3次元ベクトル
Definition GxVector.h:245
32bitブーリアン
Definition GxDefine.h:173