1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: gfx_MeshRenderer.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: 22271 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NW_GFX_MESHRENDERER_H_ 17 #define NW_GFX_MESHRENDERER_H_ 18 19 #include <nw/ut/ut_ResUtil.h> 20 #include <nw/ut/ut_ResDictionary.h> 21 #include <nw/gfx/res/gfx_ResModel.h> 22 #include <nw/gfx/res/gfx_ResShape.h> 23 #include <nw/gfx/res/gfx_ResParticleShape.h> 24 #include <nw/gfx/res/gfx_ResMaterial.h> 25 #include <nw/gfx/res/gfx_ResMesh.h> 26 27 namespace nw 28 { 29 namespace os 30 { 31 class IAllocator; 32 } // namespace os 33 namespace gfx 34 { 35 36 class Model; 37 class SkeletalModel; 38 class Mesh; 39 class RenderContext; 40 class PrimitiveSet; 41 class Primitive; 42 43 //--------------------------------------------------------------------------- 44 //! @brief メッシュの 描画プロセスを制御するクラスです。 45 //--------------------------------------------------------------------------- 46 class MeshRenderer : public GfxObject 47 { 48 private: 49 NW_DISALLOW_COPY_AND_ASSIGN(MeshRenderer); 50 51 public: 52 //---------------------------------------- 53 //! @name 作成/破棄 54 //@{ 55 56 //! @brief メッシュレンダラ を生成します。 57 //! 58 //! @param[in] pAllocator インスタンス生成用のメモリを取得するアロケータです。 59 //! 60 //! @return 新しい MeshRenderer のインスタンスを返します。 61 //! 62 static MeshRenderer* Create(nw::os::IAllocator* pAllocator); 63 64 //@} 65 66 //---------------------------------------- 67 //! @name 取得/設定 68 //@{ 69 70 //! @brief レンダーコンテキストを設定します。 SetRenderContext(RenderContext * renderContext)71 void SetRenderContext(RenderContext* renderContext) 72 { 73 m_RenderContext = renderContext; 74 } 75 76 //@} 77 78 //---------------------------------------- 79 //! @name 描画 80 //@{ 81 82 //! @brief メッシュを描画します。 83 //! 84 //! @param[in] mesh 描画するメッシュです。 85 //! @param[in] model メッシュの所有者となるモデルです。 86 //! 87 void RenderMesh(ResMesh mesh, Model* model); 88 89 //@} 90 91 private: 92 //! @brief コンストラクタです。 MeshRenderer(nw::os::IAllocator * allocator)93 MeshRenderer(nw::os::IAllocator* allocator) 94 : GfxObject(allocator), 95 m_RenderContext(NULL) {} 96 97 //! @brief デストラクタです。 ~MeshRenderer()98 virtual ~MeshRenderer() {} 99 100 //! @brief 分割データ形式のシェイプを描画します。 101 //! 102 //! @param[in] model 描画するメッシュの親モデルです。 103 //! @param[in] shape 形状クラスです。 104 //! @param[in] currentPrimitiveIndex 描画するプリミティブ番号です。 105 //! 106 void RenderSeparateDataShape( 107 Model* model, 108 ResSeparateDataShape shape, 109 s32 currentPrimitiveIndex); 110 111 //! @brief パーティクルシェイプを描画します。 112 //! 113 //! @param[in] model 描画するメッシュの親モデルです。 114 //! @param[in] shape 形状クラスです。 115 //! @param[in] index モデルでのパーティクルシェイプのインデックスです。 116 //! 117 void RenderParticleShape( 118 Model* model, 119 ResParticleShape shape, 120 int index); 121 122 //! @brief マトリクスパレットを設定します。 123 //! 124 //! @param[in] skeletalModel スケルタルモデルです。 125 //! @param[in] primitiveSet プリミティブセットです。 126 //! @param[in] boneIndexCount ボーンインデックスの数です。 127 //! 128 void SetMatrixPalette( 129 SkeletalModel* skeletalModel, 130 ResPrimitiveSet primitiveSet, 131 s32 boneIndexCount); 132 133 RenderContext* m_RenderContext; 134 }; 135 136 137 } // namespace gfx 138 } // namespace nw 139 140 #endif // NW_GFX_MESH_RENDERER_H_ 141