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