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