1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: GfxCtrl.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: 1 $ 14 *---------------------------------------------------------------------------*/ 15 #ifndef GFX_CTRL_H_ 16 #define GFX_CTRL_H_ 17 18 19 #include <nw/gfx.h> 20 #include "../include/SmBase.h" 21 #include "../include/SmModel.h" 22 #include "../include/SmCamera.h" 23 #include "../include/SmSceneCtrl.h" 24 #include "../include/SmParticle.h" 25 26 27 //------------------------------------------------------------------------------ 28 //! Gfx���\�[�X�Ɋւ���N���X�����E�j������N���X�ł��B 29 class GfxCtrl : public SmBase 30 { 31 public: 32 //! ���\�[�X��z�u����VRAM�^�C�v�ł��B 33 enum 34 { 35 GFX_CTRL_VRAM_A = NN_GX_MEM_VRAMA, 36 GFX_CTRL_VRAM_B = NN_GX_MEM_VRAMB, 37 GFX_CTRL_VRAM_NONE 38 }; 39 typedef u32 GfxVramType; 40 41 //! ���[�h���ꂽ���\�[�X���Ǘ����邽�߂̍\���̂ł��B 42 struct GfxResourceSet 43 { 44 nw::ut::MoveArray<u8> buffer; 45 nw::gfx::ResGraphicsFile resource; 46 }; 47 #define GFX_RES_ARRAY_COUNT (32) 48 49 //! ���[�h���ꂽ���\�[�X��ێ����邽�߂̔z��ł��B 50 typedef nw::ut::FixedSizeArray<GfxResourceSet, GFX_RES_ARRAY_COUNT> GfxResourceArray; 51 52 //! �������ꂽSmModel�C���X�^���X��ێ����邽�߂̔z��ł��B 53 typedef nw::ut::FixedSizeArray<SmModel*, GFX_RES_ARRAY_COUNT> SmModelInstanceArray; 54 55 //! �������ꂽ�A�j���[�V������ێ����邽�߂̔z��ł��B 56 typedef nw::ut::FixedSizeArray<nw::gfx::AnimObject*, GFX_RES_ARRAY_COUNT> GfxAnimObjectArray; 57 58 public: 59 //! �R���X�g���N�^�ł��B 60 GfxCtrl( SmSceneCtrl* sceneCtrl ); 61 62 //! �f�X�g���N�^�ł��B 63 ~GfxCtrl(); 64 65 //! SmModel�N���X�̃C���X�^���X�����܂��B 66 SmModel* CreateModel( SmModel* parentModel, const wchar_t* resourcePath, GfxVramType vramType ); 67 68 //! �p�[�e�B�N�������܂��B 69 SmParticle* CreateParticle( const wchar_t* resourcePath ); 70 71 //! ���C�g/�t�H�O/�V�[������ݒ肵�܂��B 72 void CreateSceneEnvironment( const wchar_t* resourcePath ); 73 74 //! �J���������܂��B 75 void CreateCamera( const wchar_t* resourcePath ); 76 77 //! �V�[���̏��������s���܂��B 78 void InitializeScene(); 79 80 //! �V�[���̃g���o�[�X���s���܂��B 81 void TraverseScene(); 82 83 //! �V�[���̍X�V���s���܂��B 84 void Update(); 85 86 87 //! ���[�g�m�[�h���擾���܂��B GetSceneRoot()88 nw::gfx::SceneNode* GetSceneRoot() { return m_SceneRoot; } 89 90 //! �V�[�����ݒ���擾���܂��B GetSceneEnvSetting()91 nw::gfx::SceneEnvironmentSetting* GetSceneEnvSetting() { return m_SceneEnvSetting; } 92 93 //! nw::gfx::Camera�̃C���X�^���X���擾���܂��B GetCamera()94 nw::gfx::Camera* GetCamera() 95 { 96 return m_SmCamera->GetGxCamera(); 97 } 98 99 //! SmCamera�̃C���X�^���X���擾���܂��B GetSmCamera()100 SmCamera* GetSmCamera() 101 { 102 return m_SmCamera; 103 } 104 105 //! �V�[����SmModel��lj����܂��B 106 bool AddModel( SmModel* model ); 107 108 //! ���C�g�̃A�j���[�V�������擾���܂��B GetLightAnimEvaluator()109 nw::gfx::AnimEvaluator* GetLightAnimEvaluator() 110 { 111 return m_LightAnimation; 112 } 113 114 private: 115 SmSceneCtrl* m_GfxSceneCtrl; 116 117 nw::gfx::SceneNode* m_SceneRoot; 118 nw::gfx::Camera* m_Camera; 119 nw::gfx::Camera* m_ResCamera; 120 SmCamera* m_SmCamera; 121 SmParticle* m_SmParticle; 122 123 nw::gfx::ParticleContext* m_ParticleContext; 124 nw::gfx::ParticleSceneUpdater* m_ParticleSceneUpdater; 125 126 GfxResourceArray m_ResourcesArray; 127 GfxAnimObjectArray m_AnimationArray; 128 SmModelInstanceArray m_SmModelInstArray; 129 130 nw::gfx::SceneEnvironmentSetting* m_SceneEnvSetting; 131 132 nw::gfx::AnimEvaluator* m_LightAnimation; 133 }; 134 135 136 #endif // GFX_CTRL_H_ 137