1// ---------------------------------------------------------------------------
2//  Project:  NintendoWare
3//  File:     CalcColor.vsh
4//
5//  Copyright (C)2009-2011 Nintendo/HAL Laboratory, Inc.  All rights reserved.
6//
7//  These coded instructions, statements, and computer programs contain proprietary
8//  information of Nintendo and/or its licensed developers and are protected by
9//  national and international copyright laws. They may not be disclosed to third
10//  parties or copied or duplicated in any form, in whole or in part, without the
11//  prior written consent of Nintendo.
12//
13//  The content herein is highly confidential and should be handled accordingly.
14//
15//  $Revision: $
16// ---------------------------------------------------------------------------
17
18#include "ShaderConfig.h"
19#include "VertexShader.h"
20
21    //------------------------------------------
22    // �J���[
23    //------------------------------------------
24
25l_calc_color:
26    // ���_�J���[�E�������C�g�E���_���C�g���g�p�����ꍇ��1�������邱�ƂŁA�}�e���A���f�B�t���[�Y������B
27    mov     TEMP_STUS.xy,       CONST_0
28
29    // ���_�J���[�̓X�P�[���l���O�ȊO�Ȃ瑶�݂��܂��B
30    mov     TEMP0.y,    nw_attribute_scale0._W
31    cmp     NEQ, NEQ,   TEMP0.xy,       CONST_0
32
33    // ���C�e���V�΍�
34    mov     TEMP_COLO.xyz,      CONST_0
35    mov     TEMP_COLO.w,        nw_material_diffuse._W
36
37    ifc 0, 1, COND_MODE_STA1 // ���_�J���[���L���ȏꍇ
38        // ifb�̃W�����v�ɂ��X�g�[���΍�̂��߂ɐ�ɒl������Ă����B
39        mul     TEMP0.xyzw,  nw_color.xyzw,       nw_attribute_scale0._W
40        ifb nw_is_vertex_alpha_enable
41            mul     TEMP_COLO.w,      TEMP_COLO.w,           TEMP0.w
42        endif
43        mul     TEMP_COLO.xyz,      TEMP0.xyz,      nw_vertex_color_scale
44        mov     TEMP_STUS.x,        CONST_1
45    endif
46
47    callb nw_is_vertex_lighting, l_calc_vertex_lighting // ���_���C�e�B���O�L���ȏꍇ
48
49    callb nw_is_hemi_sphere_lighting, l_calc_hemisphere_lighting // �������C�g���L���ȏꍇ
50
51    // ���_�J���[�E���_���C�g�E�������C�g�������̏ꍇ�̓}�e���A���̃f�B�t���[�Y�J���[���o�͂���B
52    cmp     EQ, EQ,   TEMP_STUS.xy,       CONST_0
53    ifc 1, 1, COND_MODE_AND
54        mov TEMP_COLO, nw_material_diffuse._XYZW
55    endif
56    max     o_Color,    TEMP_COLO,          CONST_0
57    ret
58