1 /*---------------------------------------------------------------------------* 2 Project: NintendoWare 3 File: gfx_ISceneUpdater.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: 23256 $ 14 *---------------------------------------------------------------------------*/ 15 16 #ifndef NW_GFX_ISCENEUPDATER_H_ 17 #define NW_GFX_ISCENEUPDATER_H_ 18 19 #include <nw/ut/ut_MoveArray.h> 20 #include <nw/gfx/gfx_RenderQueue.h> 21 22 namespace nw 23 { 24 namespace gfx 25 { 26 27 class SceneContext; 28 class SceneNode; 29 class Camera; 30 31 //--------------------------------------------------------------------------- 32 //! @brief シーンの更新を行うためのインターフェースです。 33 //--------------------------------------------------------------------------- 34 class ISceneUpdater : public GfxObject 35 { 36 private: 37 NW_DISALLOW_COPY_AND_ASSIGN(ISceneUpdater); 38 39 public: 40 NW_UT_RUNTIME_TYPEINFO; 41 42 //! @brief 描画ソートモードです。 43 enum RenderSortMode 44 { 45 ALL_MESH_BASE_SORT, //!< 全てメッシュベースで深度計算するモードです。 46 OPAQUE_MESH_BASE_AND_TRANSLUCENT_MODEL_BASE_SORT //!< 不透明はメッシュベース、半透明はモデルベースで深度計算するモードです。 47 }; 48 49 //! @brief 深度ソートモードです。 50 enum DepthSortMode 51 { 52 SORT_DEPTH_OF_ALL_MESH, //!< すべてのメッシュの深度ソートを行います。 53 SORT_DEPTH_OF_TRANSLUCENT_MESH //!< 半透明メッシュのみ深度ソートを行います。 54 }; 55 56 //! @brief 表示するモデルを識別するための関数オブジェクトの基底クラスです。 57 //! 58 //! @sa SubmitView 59 //! 60 class IsVisibleModelFunctor 61 { 62 public: IsVisible(const nw::gfx::Model * model)63 virtual bool IsVisible(const nw::gfx::Model* model) 64 { 65 NW_UNUSED_VARIABLE(model); 66 return true; 67 } 68 }; 69 70 //---------------------------------------- 71 //! @name 取得/設定 72 //@{ 73 74 //! @brief 深度ソートモードを取得します。 75 virtual DepthSortMode GetDepthSortMode() const = 0; 76 77 //! @brief 深度ソートモードを設定します。 78 virtual void SetDepthSortMode(DepthSortMode depthSortMode) = 0; 79 80 //@} 81 82 //---------------------------------------- 83 //! @name 更新 84 //@{ 85 86 //! @brief シーンを更新します。アニメーションの更新も同時に行います。 87 //! 88 //! @param[in] sceneContext シーンコンテキストです。 89 //! 90 virtual void UpdateAll(SceneContext* sceneContext) = 0; 91 92 //! @brief カメラの視界に基づいてシーンを更新し、描画キューを構築します。 93 //! 94 //! layerId は下の例のような用途で用いることを想定しています。 95 //! 96 //! ・フルスクリーンエフェクトやHUD、シーンの描画順を制御@n 97 //! ・複数ビューポートの描画を分割@n 98 //! ・ビューポート内の描画順を制御@n 99 //! 100 //! 上記の各優先順位をビット幅ごとに区切って、8 ビット内に収まるようにして 101 //! layerId を生成してください。 102 //! 103 //! @param[in] renderQueue 描画対象となる要素を集めたキューです。 104 //! @param[in] sceneContext シーンコンテキストです。 105 //! @param[in] camera カメラです。 106 //! @param[in] layerId 描画要素のソート時に最優先に区分される ID です。レイヤーやビューポートの描画を制御するのに用います。 107 //! @param[in] renderSortMode 描画ソートモードです。 108 //! 109 virtual void SubmitView( 110 RenderQueue* renderQueue, 111 SceneContext* sceneContext, 112 const Camera& camera, 113 u8 layerId, 114 RenderSortMode renderSortMode = ALL_MESH_BASE_SORT) = 0; 115 116 //! @brief カメラの視界に基づいてシーンを更新し、描画キューを構築します。 117 //! 118 //! パーティクルを別レイヤーで描画するための SubmitView です。 119 //! 120 //! @param[in] renderQueue 描画対象となる要素を集めたキューです。 121 //! @param[in] sceneContext シーンコンテキストです。 122 //! @param[in] camera カメラです。 123 //! @param[in] layerId 描画要素のソート時に最優先に区分される ID です。レイヤーやビューポートの描画を制御するのに用います。 124 //! @param[in] particleLayerId パーティクル描画用の layerId です。 125 //! @param[in] renderSortMode 描画ソートモードです。 126 //! 127 virtual void SubmitView( 128 RenderQueue* renderQueue, 129 SceneContext* sceneContext, 130 const Camera& camera, 131 u8 layerId, 132 u8 particleLayerId, 133 RenderSortMode renderSortMode = ALL_MESH_BASE_SORT) = 0; 134 135 //! @brief カメラの視界に基づいてシーンを更新し、描画キューを構築します。 136 //! 137 //! 表示するモデルを関数オブジェクトで指定できる SubmitView です。 138 //! 139 //! @param[in] renderQueue 描画対象となる要素を集めたキューです。 140 //! @param[in] sceneContext シーンコンテキストです。 141 //! @param[in] camera カメラです。 142 //! @param[in] layerId 描画要素のソート時に最優先に区分される ID です。レイヤーやビューポートの描画を制御するのに用います。 143 //! @param[in] particleLayerId パーティクル描画用の layerId です。 144 //! @param[in] isVisibleModel 表示するモデルを識別するための関数オブジェクトです。 145 //! @param[in] renderSortMode 描画ソートモードです。 146 //! 147 virtual void SubmitView( 148 RenderQueue* renderQueue, 149 SceneContext* sceneContext, 150 const Camera& camera, 151 u8 layerId, 152 u8 particleLayerId, 153 IsVisibleModelFunctor* isVisibleModel, 154 RenderSortMode renderSortMode = ALL_MESH_BASE_SORT) = 0; 155 156 //@} 157 158 protected: 159 //---------------------------------------- 160 //! @name コンストラクタ/デストラクタ 161 //@{ 162 163 //! コンストラクタです。 ISceneUpdater(os::IAllocator * allocator)164 ISceneUpdater(os::IAllocator* allocator) : GfxObject(allocator) {} 165 166 //@} 167 }; 168 169 } // namespace gfx 170 } // namespace nw 171 172 #endif // NW_GFX_ISCENEUPDATER_H_ 173