1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     gfx_SceneTraverser.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_SCENETRAVERSER_H_
19 #define NW_GFX_SCENETRAVERSER_H_
20 
21 #include <nw/gfx/gfx_ISceneVisitor.h>
22 
23 namespace nw
24 {
25 namespace gfx
26 {
27 
28 class SceneContext;
29 
30 //---------------------------------------------------------------------------
31 //! @brief        シーン内を探索して更新と描画に必要な情報を収集します。
32 //---------------------------------------------------------------------------
33 class SceneTraverser  : public ISceneVisitor
34 {
35 private:
36     NW_DISALLOW_COPY_AND_ASSIGN(SceneTraverser);
37 
38 public:
39     NW_UT_RUNTIME_TYPEINFO;
40 
41     //! シーントラバーサを構築するためのクラスです。
42     class Builder
43     {
44     public:
45         //! @brief        シーントラバーサを生成します。
46         //!
47         //! @param[in]    allocator
48         //!
49         //! @return       生成したトラバーサを返します。
50         //!
51         SceneTraverser* Create(os::IAllocator* allocator);
52     };
53 
54     //! @brief        トラバース前処理を行います。
55     //!
56     //! 解析内容を管理するシーンコンテキストを設定します。
57     //!
58     //! @param[in] sceneContext   シーンコンテキストです。
59     //!
60     void Begin(SceneContext* sceneContext);
61 
62     //!  トラバース後処理を行います。
63     void End();
64 
65     //----------------------------------------
66     //! @name ビジターの実装
67     //@{
68 
69     virtual void VisitSceneNode(SceneNode* node);
70     virtual void VisitTransformNode(TransformNode* node);
71     virtual void VisitUserRenderNode(UserRenderNode* node);
72     virtual void VisitModel(Model* model);
73     virtual void VisitSkeletalModel(SkeletalModel* model);
74     virtual void VisitCamera(Camera* camera);
75     virtual void VisitFog(Fog* fog);
76     virtual void VisitLight(Light* light);
77     virtual void VisitFragmentLight(FragmentLight* light);
78 #if defined(NW_GFX_VERTEX_LIGHT_ENABLED)
79     virtual void VisitVertexLight(VertexLight* light);
80 #endif
81     virtual void VisitAmbientLight(AmbientLight* light);
82     virtual void VisitHemiSphereLight(HemiSphereLight* light);
83     virtual void VisitParticleSet(ParticleSet* particleSet);
84     virtual void VisitParticleEmitter(ParticleEmitter* particleEmitter);
85     virtual void VisitParticleModel(ParticleModel* particleModel);
86 
87     //@}
88 
89 private:
SceneTraverser(os::IAllocator * allocator)90     SceneTraverser(os::IAllocator* allocator)
91     : ISceneVisitor(allocator), m_SceneContext(NULL) {}
~SceneTraverser()92     virtual ~SceneTraverser() {}
93 
94     SceneContext* m_SceneContext;
95 };
96 
97 } // namespace gfx
98 } // namespace nw
99 
100 #endif // NW_GFX_SCENETRAVERSER_H_
101