// --------------------------------------------------------------------------- // Project: NintendoWare // File: CalcTexCoord0.vsh // // Copyright (C)2009-2010 Nintendo Co., Ltd. All rights reserved. // // These coded instructions, statements, and computer programs contain // proprietary information of Nintendo of America Inc. and/or Nintendo // Company Ltd., and are protected by Federal copyright law. They may // not be disclosed to third parties or copied or duplicated in any form, // in whole or in part, without the prior written consent of Nintendo. // // $Revision:$ // --------------------------------------------------------------------------- #include "ShaderConfig.h" #include "VertexShader.h" //------------------------------------------ // テクスチャ座標計算 //------------------------------------------ // テクスチャ座標0 l_calc_texcoord0: mov TEMP0.xy, nw_texture_coordinate._X ifb nw_uv_mapping_position0 // UVマッピング #ifdef NW_FIXED_TEX_SORUCE // テクスチャソースを固定で取得します。 mul TEMP_TEX.xy, nw_texcoord0.xy, nw_attribute_scale1._X mov TEMP_TEX.zw, CONST_0_0_1_1 #else call l_get_texcoord_source #endif dp4 TRAN_TEX0.x, TEMP_TEX, nw_texture_matrix0[0]._XYWZ dp4 TRAN_TEX0.y, TEMP_TEX, nw_texture_matrix0[1]._XYWZ mov TRAN_TEX0.zw, CONST_0 mov o_TexCoord0, TRAN_TEX0 else cmp EQ, EQ, TEMP0.xy, CONST_3_4_4_4 mov TEMP_TEX.zw, CONST_0_0_1_1 ifc 0, 0, COND_MODE_AND // 投影マッピング, シャドウマッピング mov TEMP_TEX, WRLD_POSI dp4 TRAN_TEX0.x, TEMP_TEX, nw_texture_matrix0[0]._XYZW dp4 TRAN_TEX0.y, TEMP_TEX, nw_texture_matrix0[1]._XYZW dp4 TRAN_TEX0.z, TEMP_TEX, nw_texture_matrix0[2]._XYZW mul TEMP0.xy , nw_texture_translate.xy, TRAN_TEX0.z add TRAN_TEX0.xy, TRAN_TEX0.xy, TEMP0.xy else ifc 1, 0, COND_MODE_AND // キューブマッピング call l_gen_texcoord_reflection dp3 TRAN_TEX0.x, TEMP_TEX, nw_inverse_view_matrix[0]._XYZW dp3 TRAN_TEX0.y, TEMP_TEX, nw_inverse_view_matrix[1]._XYZW dp3 TRAN_TEX0.z, TEMP_TEX, nw_inverse_view_matrix[2]._XYZW else // スフィアマッピング call l_gen_texcoord_sphere_reflection dp4 TRAN_TEX0.x, TEMP_TEX, nw_texture_matrix0[0]._XYZW dp4 TRAN_TEX0.y, TEMP_TEX, nw_texture_matrix0[1]._XYZW //mov TRAN_TEX0.zw, TEMP_TEX.zw endif nop endif // 出力レジスタには全てのコンポーネントに書き込みを行う必要があります。 mov o_TexCoord0, TRAN_TEX0 endif nop ret