1 /*---------------------------------------------------------------------------*
2   Project:  NintendoWare
3   File:     Graphics.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 
16 #ifndef GRAPHICS_H_
17 #define GRAPHICS_H_
18 
19 
20 #include <nn/gx.h>
21 #include <nw/ut.h>
22 #include <nw/gfx/gfx_IRenderTarget.h>
23 
24 #include <nw/demo/demo_DisplayBufferSwapper.h>
25 #include <nw/demo/demo_GraphicsSystem.h>
26 
27 
28 //---------------------------------------------------------------------------
29 //! @brief        クラスです。
30 //---------------------------------------------------------------------------
31 class Graphics
32 {
33 public:
34     //! @brief コンストラクタです。
35     Graphics( nw::os::IAllocator* allocator, const nw::demo::RenderSystem::Description& description );
36 
37     //! @brief コンストラクタです。
38     ~Graphics();
39 
40     //! @brief 描画を行うターゲットを設定します。
41     //!
42     //! @param[in]    renderTarget    描画を行うターゲットです。
43     //!
44     void SetRenderTarget( nw::gfx::IRenderTarget* renderTarget );
45 
46 
47     //! @brief レンダーコンテキストを取得します。
48     //!
49     //! @return レンダーコンテキストです。
50     //!
GetRenderContext()51     nw::gfx::RenderContext*  GetRenderContext() { return this->m_RenderContext; }
52 
53 
54     //!  @brief バッファを消去します。
55     //!
56     //!  @param[in]    clearColor      設定するクリアカラーです。
57     //!
58     void ClearBuffer( nw::ut::FloatColor clearColor );
59 
60 
61     //! @brief バッファを転送します。
62     //!
63     //! @param[in]    screenKind      転送するスクリーンの種類です。
64     //!
65     void TransferBuffer(s32 screenKind);
66 
67 
68     //! @brief コマンドリスト処理の終了待ちを行います。
69     void WaitCommandList();
70 
71 
72     //! @brief VSync 待ちを行います。
73     //!
74     //! @param[in]    screenKind     VSync待ちを行うスクリーンの種類です。
75     //!
76     void WaitVSync(s32 screenKind);
77 
78 
79     //! @brief バッファのスワップを予約します。
80     //!
81     //! @param[in]    screenKind     スワップを行うスクリーンの種類です。
82     //!
83     void SwapBuffer(s32 screenKind);
84 
85 private:
86     //! @brief DestroyRenderSystemの内部メソッドです。
87     static void DestroyInternal_();
88 
89     //! @brief CreateRenderSystemの内部メソッドです。
90     NW_INLINE void CreateInternal_(const nw::demo::RenderSystem::Description& description);
91 
92     nw::os::IAllocator*                 m_Allocator;
93     nw::gfx::RenderContext*             m_RenderContext;
94 
95     nw::demo::DisplayBufferSwapper*     m_UpperSwapper;
96     nw::demo::DisplayBufferSwapper*     m_LowerSwapper;
97     nw::demo::DisplayBufferSwapper*     m_ExtensionSwapper;
98 
99     GLuint                              m_CommandList;
100     GLuint                              m_CachingCommandList;
101 };
102 
103 
104 #endif // GRAPHICS_H_
105