/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_SceneInitializer.h Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo and/or its licensed developers and are protected by national and international copyright laws. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. The content herein is highly confidential and should be handled accordingly. $Revision: 31311 $ *---------------------------------------------------------------------------*/ #ifndef NW_GFX_SCENEINITIALIZER_H_ #define NW_GFX_SCENEINITIALIZER_H_ #include namespace nw { namespace gfx { class IMaterialIdGenerator; //--------------------------------------------------------------------------- //! @brief シーン内を探索して初期化を行います。 //--------------------------------------------------------------------------- class SceneInitializer : public ISceneVisitor { private: NW_DISALLOW_COPY_AND_ASSIGN(SceneInitializer); public: NW_UT_RUNTIME_TYPEINFO; //! @brief 設定内容です。 struct Description { IMaterialIdGenerator* materialIdGenerator; //!< マテリアルIDのジェネレータです。 //! @brief コンストラクタです。 Description() : materialIdGenerator(NULL) {} }; //! シーンイニシャライザーを構築するためのクラスです。 class Builder { public: //! @brief マテリアルIDジェネレーターを設定します。 //! 所有権が移動しますので SceneInitializer を破棄する際に一緒に破棄されます。 Builder& MaterialIdGenerator(IMaterialIdGenerator* materialIdGenerator) { m_Description.materialIdGenerator = materialIdGenerator; return *this; } //! @brief シーンイニシャライザーを生成します。 //! //! @param[in] allocator アロケータです。 //! //! @return 生成したイニシャライザーを返します。 //! SceneInitializer* Create(os::IAllocator* allocator); private: Description m_Description; }; //! @brief シーンイニシャライズの前処理を行います。 //! void Begin(); //! @brief シーンイニシャライズの後処理を行います。 //! //! マテリアルIDの生成などが行われますので、必ず呼び出す必要があります。 //! void End(); //---------------------------------------- //! @name ビジターの実装 //@{ virtual void VisitSceneNode(SceneNode*) {} virtual void VisitTransformNode(TransformNode*) {} virtual void VisitUserRenderNode(UserRenderNode*) {} virtual void VisitModel(Model* model); virtual void VisitSkeletalModel(SkeletalModel* model); virtual void VisitCamera(Camera*) {} virtual void VisitFog(Fog*) {} virtual void VisitLight(Light*) {} virtual void VisitFragmentLight(FragmentLight*) {} #if defined(NW_GFX_VERTEX_LIGHT_ENABLED) virtual void VisitVertexLight(VertexLight*) {} #endif virtual void VisitAmbientLight(AmbientLight*) {} virtual void VisitHemiSphereLight(HemiSphereLight*) {} virtual void VisitParticleSet(ParticleSet*) {} virtual void VisitParticleEmitter(ParticleEmitter*) {} virtual void VisitParticleModel(ParticleModel*); //@} private: SceneInitializer(os::IAllocator* allocator, Description description) : ISceneVisitor(allocator), m_MaterialIdGenerator(description.materialIdGenerator) {} virtual ~SceneInitializer() {} GfxPtr m_MaterialIdGenerator; }; } // namespace gfx } // namespace nw #endif // NW_GFX_SCENEINITIALIZER_H_