1 /*---------------------------------------------------------------------------* 2 Project: Horizon 3 File: gr_Fog.cpp 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: 46347 $ 14 *---------------------------------------------------------------------------*/ 15 16 #include <nn/gr/CTR/gr_Fog.h> 17 18 namespace nn 19 { 20 namespace gr 21 { 22 namespace CTR 23 { 24 SetTable(const f32 table[FOG_LOOKUP_TABLE_ELEMENT_NUM],const f32 lastDiffValue)25 void Fog::SetTable( const f32 table[ FOG_LOOKUP_TABLE_ELEMENT_NUM ], 26 const f32 lastDiffValue ) 27 { 28 bit32* command = m_TableCommand; 29 30 // 0x0e6 31 *command++ = PICA_CMD_DATA_FOG_LUT_INDEX( 0 ); 32 *command++ = PICA_CMD_HEADER_SINGLE( PICA_REG_FOG_LUT_INDEX ); 33 34 // 0x0e8 35 int i = 0; 36 *command++ = ( Float32ToUnsignedFix11( table[ i ] ) << 13 ) | 37 Float32ToFix13Fraction11( table[ i + 1 ] - table[ i ] ); 38 *command++ = PICA_CMD_HEADER_BURST( PICA_REG_FOG_LUT_DATA0, 128 ); 39 40 for ( ++i; i < 0x7F; ++i ) 41 { 42 *command++ = ( Float32ToUnsignedFix11( table[ i ] ) << 13 ) | 43 Float32ToFix13Fraction11( table[ i + 1 ] - table[ i ] ); 44 } 45 46 *command++ = ( Float32ToUnsignedFix11( table[ i ] ) << 13 ) | 47 Float32ToFix13Fraction11( lastDiffValue ); 48 *command++ = 0; 49 } 50 51 } // namespace CTR 52 } // namespace gr 53 } // namespace nn 54