/*---------------------------------------------------------------------------* Project: NintendoWare File: gfx_Light.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_LIGHT_H_ #define NW_GFX_LIGHT_H_ #include #include namespace nw { namespace gfx { //--------------------------------------------------------------------------- //! @brief ライトを表すクラスです。 //--------------------------------------------------------------------------- class Light : public TransformNode { private: NW_DISALLOW_COPY_AND_ASSIGN(Light); public: NW_UT_RUNTIME_TYPEINFO; //! @brief 設定内容です。 struct Description : public TransformNode::Description { //! @brief コンストラクタです。 Description(){} }; //---------------------------------------- //! @name シーンツリー //@{ //! @brief ビジターを受け付けます。 //! //! @param[in] visitor ビジターです。 //! virtual void Accept(ISceneVisitor* visitor); //@} //---------------------------------------- //! @name アニメーション //@{ //! @brief アニメーショングループを取得します。 //! //! ライトを DynamicBuilder で生成した場合は NULL を返します。 //! その場合、アニメーションは設定できません。 AnimGroup* GetAnimGroup() { return m_AnimGroup; } //! @brief アニメーショングループを取得します。 //! //! ライトを DynamicBuilder で生成した場合は NULL を返します。 //! その場合、アニメーションは設定できません。 const AnimGroup* GetAnimGroup() const { return m_AnimGroup; } //! @brief アニメーションオブジェクトを取得します。 AnimObject* GetAnimObject() { NW_NULL_ASSERT(m_AnimBinding); return m_AnimBinding->GetAnimObject(0); } //! @brief アニメーションオブジェクトを取得します。 const AnimObject* GetAnimObject() const { NW_NULL_ASSERT(m_AnimBinding); return m_AnimBinding->GetAnimObject(0); } //! @brief アニメーションオブジェクトを設定します。 //! //! @param[in] animObject 設定するアニメーションオブジェクトです。NULL を指定するとアニメーションを解除します。 void SetAnimObject(AnimObject* animObject) { NW_NULL_ASSERT(m_AnimBinding); NW_FAILSAFE_IF(!ValidateLightAnimType(animObject)) { NW_LOG("type mismatch between Light and Animation. Animation did not set.\n"); return; } m_AnimBinding->SetAnimObject(0, animObject); } //@} protected: //---------------------------------------- //! @name コンストラクタ/デストラクタ //@{ //! コンストラクタです。 Light( os::IAllocator* allocator, ResTransformNode resObj, const Light::Description& description) : TransformNode( allocator, resObj, description), m_OriginalValue(NULL), m_AnimGroup(NULL) {} //! デストラクタです。 virtual ~Light() { ut::SafeDestroy(m_AnimGroup); } //@} //! @brief アニメーショングループを作成します。 Result CreateAnimGroup(os::IAllocator* allocator); //! @brief アニメーションに登録するモデルデータのポインタを取得します。 void* GetAnimTargetObject(const anim::ResAnimGroupMember& anim); //! @brief OriginalValueを破棄します。 void DestroyOriginalValue(); // ValidateLightAnimTypeで使用します。 virtual u32 GetLightType() const = 0; //!< :private virtual u32 GetLightKind() const = 0; //!< :private ResLight m_OriginalValue; math::Transform3 m_OriginalTransform; private: //! バインドするアニメーションのライト種類と、 //! インスタンスのライト種類が等しいかチェックします。 //! :private bool ValidateLightAnimType(AnimObject* animObject); AnimGroup* m_AnimGroup; }; } // namespace gfx } // namespace nw #endif // NW_GFX_LIGHT_H_