1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     gr_LookUpTable.h
4 
5   Copyright (C)2009-2012 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: 47511 $
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_GR_LOOK_UP_TABLE_H_
17 #define NN_GR_LOOK_UP_TABLE_H_
18 
19 #include <nn/gr/CTR/gr_Utility.h>
20 
21 namespace nn
22 {
23     namespace gr
24     {
25         namespace CTR
26         {
27 
28             /* Please see man pages for details
29 
30              */
31             class LookUpTable
32             {
33             public :
34                 //
35                 static const u32 LOOKUP_TABLE_ELEMENT_NUM = 256;
36 
37                 //
38                 static const u32 LOOKUP_TABLE_CMD_NUM     = LOOKUP_TABLE_ELEMENT_NUM + 2;
39 
40                 /* Please see man pages for details
41 
42                 */
LookUpTable()43                 LookUpTable()
44                 {
45                 }
46 
47             public :
48                 /* Please see man pages for details
49 
50 
51 
52 
53 
54                  */
55                 void SetTable( const f32 table[ LOOKUP_TABLE_ELEMENT_NUM ],
56                                const f32 lastDiffValue = 0.0f,
57                                const bool isInputAbs   = true );
58 
59                 /* Please see man pages for details
60 
61 
62 
63 
64                  */
65                 void SetAbsTable( const f32 table[ LOOKUP_TABLE_ELEMENT_NUM ],
66                                   const f32 lastDiffValue = 0.0f );
67 
68                 /* Please see man pages for details
69 
70 
71 
72 
73                  */
74                 void SetNotAbsTable( const f32 table[ LOOKUP_TABLE_ELEMENT_NUM ],
75                                      const f32 lastDiffValue = 0.0f );
76 
77 
78                 /* Please see man pages for details
79 
80 
81 
82 
83 
84 
85                 */
86 
MakeCommand(bit32 * command,const PicaDataFragLightSampler type)87                 bit32* MakeCommand( bit32* command, const PicaDataFragLightSampler type ) const
88                 {
89                     // 0x1c5
90                     *command++ = PICA_CMD_DATA_FRAG_LIGHT_LUT( 0, type );
91                     *command++ = PICA_CMD_HEADER_SINGLE( PICA_REG_FRAG_LIGHT_LUT );
92 
93                     std::memcpy( command, m_TableCommand, sizeof( m_TableCommand ) );
94 
95                     return command + LOOKUP_TABLE_CMD_NUM;
96                 };
97 
98                 /* Please see man pages for details
99 
100 
101 
102 
103 
104 
105                  */
MakeSpotTableCommand(bit32 * command,u8 light_id)106                 bit32* MakeSpotTableCommand( bit32* command, u8 light_id ) const
107                 {
108                     return MakeCommand( command, static_cast< PicaDataFragLightSampler >( PICA_DATA_SAMPLER_SP + light_id  ) );
109                 }
110 
111                 /* Please see man pages for details
112 
113 
114 
115 
116 
117 
118                  */
MakeDistAttnTableCommand(bit32 * command,u8 light_id)119                 bit32* MakeDistAttnTableCommand( bit32* command, u8 light_id ) const
120                 {
121                     return MakeCommand( command, static_cast< PicaDataFragLightSampler >( PICA_DATA_SAMPLER_DA + light_id  ) );
122                 }
123 
124             protected :
125                 /* Please see man pages for details
126 
127 
128 
129                 */
130                 bit32 m_TableCommand[ LOOKUP_TABLE_CMD_NUM ];
131             };
132 
133         } // namespace CTR
134     } // namespace gr
135 } // namespace nn
136 
137 #endif // NN_GR_LOOK_UP_TABLE_H_
138