// --------------------------------------------------------------------------- // Project: NintendoWare // File: CalcColor.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" //------------------------------------------ // カラー //------------------------------------------ l_calc_color: // 頂点カラー・半球ライト・頂点ライトを使用した場合は1を代入することで、マテリアルディフューズを入れる。 mov TEMP_STUS.xy, CONST_0 // 頂点カラーはスケール値が0以外なら存在します。 mov TEMP0.y, nw_attribute_scale0._W cmp NEQ, NEQ, TEMP0.xy, CONST_0 // レイテンシ対策 mov TEMP_COLO.xyz, CONST_0 mov TEMP_COLO.w, nw_material_diffuse._W ifc 0, 1, COND_MODE_STA1 // 頂点カラーが有効な場合 // ifbのジャンプによるストール対策のために先に値をいれておく。 mul TEMP0.xyzw, nw_color.xyzw, nw_attribute_scale0._W ifb nw_is_vertex_alpha_enable mul TEMP_COLO.w, TEMP_COLO.w, TEMP0.w endif mul TEMP_COLO.xyz, TEMP0.xyz, nw_vertex_color_scale mov TEMP_STUS.x, CONST_1 endif callb nw_is_vertex_lighting, l_calc_vertex_lighting // 頂点ライティング有効な場合 callb nw_is_hemi_sphere_lighting, l_calc_hemisphere_lighting // 半球ライトが有効な場合 // 頂点カラー・頂点ライト・半球ライトが無効の場合はマテリアルのディフューズカラーを出力する。 cmp EQ, EQ, TEMP_STUS.xy, CONST_0 ifc 1, 1, COND_MODE_AND mov TEMP_COLO, nw_material_diffuse._XYZW endif /////////////////////////////////////////////// // 最終的なカラーに ExColor の値を加えます。 // /////////////////////////////////////////////// add TEMP_COLO, TEMP_COLO, extension_color max o_Color, TEMP_COLO, CONST_0 ret