1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     gfx_SceneObject.h
4 
5   Copyright (C)2009-2010 Nintendo Co., Ltd./HAL Laboratory, Inc.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Revision: 22719 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NW_GFX_SCENEOBJECT_H_
17 #define NW_GFX_SCENEOBJECT_H_
18 
19 #include <nw/gfx/gfx_Common.h>
20 #include <nw/gfx/gfx_GfxObject.h>
21 #include <nw/gfx/res/gfx_ResSceneObject.h>
22 #include <nw/ut/ut_ResUtil.h>
23 #include <nw/ut/ut_ResDictionary.h>
24 #include <nw/ut/ut_RuntimeTypeInfo.h>
25 #include <nw/ut/ut_MovePtr.h>
26 #include <nw/ut/ut_Children.h>
27 #include <nw/os/os_Memory.h>
28 
29 namespace nw
30 {
31 namespace gfx
32 {
33 
34 class SceneNode;
35 class TransformNode;
36 
37 //! @brief シーンノードの子を管理するためのリストです。
38 typedef ut::Children<SceneNode, SceneNode, ut::ChildDetacher<SceneNode> > SceneNodeChildren;
39 
40 //---------------------------------------------------------------------------
41 //! @brief        シーン上のオブジェクトのベースクラスです。
42 //---------------------------------------------------------------------------
43 class SceneObject : public GfxObject
44 {
45 private:
46     NW_DISALLOW_COPY_AND_ASSIGN(SceneObject);
47 
48 public:
49     NW_UT_RUNTIME_TYPEINFO;
50 
51     static const int DEFAULT_MAX_CHILDREN = 8; //!< 固定サイズメモリ時の子の最大数です。
52     static const int DEFAULT_MAX_CALLBACKS = 4; //!< 固定サイズメモリ時のコールバックの最大数です。
53     static const int MAX_NAME_LENGTH = 256; //!< シーンオブジェクトの名前の制限です。
54 
55     //----------------------------------------
56     //! @name リソース
57     //@{
58 
59     //! @brief シーンオブジェクトのリソースを取得します。
GetResSceneObject()60     ResSceneObject       GetResSceneObject() { return m_ResObject; }
61 
62     //! @brief シーンオブジェクトのリソースを取得します。
GetResSceneObject()63     const ResSceneObject GetResSceneObject() const { return m_ResObject; }
64 
65     //! @brief リソースから名前を取得します。
GetName()66     const char* GetName() const
67     {
68         NW_ASSERT(this->m_ResObject.IsValid());
69 
70         return this->m_ResObject.GetName();
71     }
72 
73     //@}
74 
75 protected:
76     //----------------------------------------
77     //! @name コンストラクタ/デストラクタ
78     //@{
79 
80     //! @brief コンストラクタです。
SceneObject(os::IAllocator * allocator,ResSceneObject resObj)81     SceneObject(os::IAllocator* allocator, ResSceneObject resObj)
82     : GfxObject(allocator),
83       m_ResObject(resObj)
84     {}
85 
86     //! @brief デストラクタです。
~SceneObject()87     virtual ~SceneObject() {}
88 
89     //@}
90 
91 private:
92     ResSceneObject  m_ResObject;
93 };
94 
95 } // namespace gfx
96 } // namespace nw
97 
98 #endif // NW_GFX_SCENEOBJECT_H_
99