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