1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     gr_Scissor.h
4 
5   Copyright (C)2010 Nintendo Co., Ltd.  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   $Rev: 26151 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_GR_SCISSOR_H_
17 #define NN_GR_SCISSOR_H_
18 
19 #include <nn/gr/CTR/gr_Prefix.h>
20 
21 namespace nn
22 {
23     namespace gr
24     {
25         namespace CTR
26         {
27 
28             /*!
29                 @brief シザー関連のコマンドを生成するためのクラスです。glScissorと異なり、描画対象のカラーバッファサイズを与える必要があります。
30             */
31             class Scissor
32             {
33             public:
34                 /*!
35                     @brief コンストラクタです。初期値(シザー有効、シザー範囲 (0,0)-(240,320)、 バッファサイズ(256,320))を設定します.
36                  */
Scissor()37                 Scissor() : isEnable( true ), x( 0 ), y( 0 ), width( 240 ), height( 320 ), bufferWidth( 256 ), bufferHeight( 320 ) {}
38 
39                 /*!
40                     @brief コンストラクタです。値を指定して初期化します。
41 
42                     @param[in]  isEnable_     シザーを有効にするか。
43                     @param[in]  x_            シザー範囲の左下の X の値です。
44                     @param[in]  y_            シザー範囲の左下の Y の値です。
45                     @param[in]  width_        シザー範囲の幅です。
46                     @param[in]  height_       シザー範囲の高さです。
47                     @param[in]  bufferWidth_  カラーバッファの幅です。
48                     @param[in]  bufferHeight_ カラーバッファの高さです。
49                 */
Scissor(bool isEnable_,s32 x_,s32 y_,u32 width_,u32 height_,s32 bufferWidth_,s32 bufferHeight_)50                 Scissor( bool isEnable_, s32 x_, s32 y_, u32 width_, u32 height_, s32 bufferWidth_, s32 bufferHeight_ )
51                 : isEnable( isEnable_ ), x( x_ ), y( y_ ), width( width_ ), height( height_ ), bufferWidth( bufferWidth_ ), bufferHeight( bufferHeight_ ) {}
52 
53             public:
54                 /*!
55                     @brief 設定された情報をもとに、描画コマンドを生成します。
56 
57                     @param[in]    command    描画コマンド書き込み先の先頭アドレスです。
58 
59                     @return                書き込まれた描画コマンドの終端の次のアドレスを返します。
60                  */
61                 u32* MakeCommand( u32* command );
62 
63             public:
64                 /*!
65                     @brief シザー範囲を一括で指定する便利関数です。
66 
67                     @param[in]    x_            シザー範囲の左下の X の値です。
68                     @param[in]    y_            シザー範囲の左下の Y の値です。
69                     @param[in]    width_        シザー範囲の幅です。
70                     @param[in]    height_       シザー範囲の高さです。
71                  */
Set(s32 x_,s32 y_,u32 width_,u32 height_)72                 void Set( s32 x_, s32 y_, u32 width_, u32 height_ )
73                 {
74                     x = x_; y = y_; width = width_; height = height_;
75                 }
76 
77                 /*!
78                     @brief バッファサイズを一括で指定する便利関数です。
79 
80                     @param[in]    bufferWidth_  カラーバッファの幅です。
81                     @param[in]    bufferHeight_ カラーバッファの高さです。
82                  */
SetBufferSize(s32 bufferWidth_,s32 bufferHeight_)83                 void SetBufferSize( s32 bufferWidth_, s32 bufferHeight_ )
84                 {
85                     bufferWidth = bufferWidth_; bufferHeight = bufferHeight_;
86                 }
87 
88             public:
89                 /*!
90                     @brief シザーを有効にするか。 型は bool です。
91                 */
92                 bool    isEnable;
93                 NN_PADDING3;
94 
95                 /*!
96                     @brief シザー範囲の左下の X の値です。 型は s32 です。
97                 */
98                 s32        x;
99 
100                 /*!
101                     @brief シザー範囲の左下の Y の値です。型は s32 です。
102                 */
103                 s32        y;
104 
105                 /*!
106                     @brief シザー範囲の幅です。型は u32 です。
107                 */
108                 u32        width;
109 
110                 /*!
111                     @brief シザー範囲の高さです。型は u32 です。
112                 */
113                 u32        height;
114 
115                 /*!
116                     @brief シザー範囲のカラーバッファの幅です。型は s32 です。
117                 */
118                 s32        bufferWidth;
119 
120                 /*!
121                     @brief シザー範囲のカラーバッファの幅です。型は s32 です。
122                 */
123                 s32        bufferHeight;
124             };
125 
126         } // namespace CTR
127     } // namespace gr
128 } // namespace nn
129 
130 #endif // NN_GR_SCISSOR_H_
131