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