1// ---------------------------------------------------------------------------
2//  Project:  NintendoWare
3//  File:     CalcColor.vsh
4//
5//  Copyright (C)2009-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//  $Revision:$
14// ---------------------------------------------------------------------------
15
16#include "ShaderConfig.h"
17#include "VertexShader.h"
18
19    //------------------------------------------
20    // �J���[
21    //------------------------------------------
22
23l_calc_color:
24    // ���_�J���[�E�������C�g�E���_���C�g���g�p�����ꍇ��1�������邱�ƂŁA�}�e���A���f�B�t���[�Y������B
25    mov     TEMP_STUS.xy,       CONST_0
26
27    // ���_�J���[�̓X�P�[���l���O�ȊO�Ȃ瑶�݂��܂��B
28    mov     TEMP0.y,    nw_attribute_scale0._W
29    cmp     NEQ, NEQ,   TEMP0.xy,       CONST_0
30
31    // ���C�e���V�΍�
32    mov     TEMP_COLO.xyz,      CONST_0
33    mov     TEMP_COLO.w,        nw_material_diffuse._W
34
35    ifc 0, 1, COND_MODE_STA1 // ���_�J���[���L���ȏꍇ
36        // ifb�̃W�����v�ɂ��X�g�[���΍�̂��߂ɐ�ɒl������Ă����B
37        mul     TEMP0.xyzw,  nw_color.xyzw,       nw_attribute_scale0._W
38        ifb nw_is_vertex_alpha_enable
39            mul     TEMP_COLO.w,      TEMP_COLO.w,           TEMP0.w
40        endif
41        mul     TEMP_COLO.xyz,      TEMP0.xyz,      nw_vertex_color_scale
42        mov     TEMP_STUS.x,        CONST_1
43    endif
44
45    callb nw_is_vertex_lighting, l_calc_vertex_lighting // ���_���C�e�B���O�L���ȏꍇ
46
47    callb nw_is_hemi_sphere_lighting, l_calc_hemisphere_lighting // �������C�g���L���ȏꍇ
48
49    // ���_�J���[�E���_���C�g�E�������C�g�������̏ꍇ�̓}�e���A���̃f�B�t���[�Y�J���[���o�͂���B
50    cmp     EQ, EQ,   TEMP_STUS.xy,       CONST_0
51    ifc 1, 1, COND_MODE_AND
52        mov TEMP_COLO, nw_material_diffuse._XYZW
53    endif
54    ///////////////////////////////////////////////
55    // �ŏI�I�ȃJ���[�� ExColor �̒l�������܂��B //
56    ///////////////////////////////////////////////
57    add     TEMP_COLO,  TEMP_COLO,      extension_color
58    max     o_Color,    TEMP_COLO,      CONST_0
59
60    ret
61