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