1// ---------------------------------------------------------------------------
2//  Project:  NintendoWare
3//  File:     CalcTexCoord0.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// �e�N�X�`�����W�v�Z
21//------------------------------------------
22// �e�N�X�`�����W0
23l_calc_texcoord0:
24    mov     TEMP0.xy,   nw_texture_coordinate._X
25    ifb nw_uv_mapping_position0  // UV�}�b�s���O
26#ifdef NW_FIXED_TEX_SORUCE // �e�N�X�`���\�[�X���Œ�Ŏ擾���܂��B
27        mul     TEMP_TEX.xy,       nw_texcoord0.xy,   nw_attribute_scale1._X
28        mov     TEMP_TEX.zw,        CONST_0_0_1_1
29#else
30        call    l_get_texcoord_source
31#endif
32        dp4     TRAN_TEX0.x,        TEMP_TEX,          nw_texture_matrix0[0]._XYWZ
33        dp4     TRAN_TEX0.y,        TEMP_TEX,          nw_texture_matrix0[1]._XYWZ
34        mov     TRAN_TEX0.zw,       CONST_0
35        mov     o_TexCoord0,        TRAN_TEX0
36    else
37        cmp     EQ, EQ,     TEMP0.xy,       CONST_3_4_4_4
38        mov     TEMP_TEX.zw,        CONST_0_0_1_1
39        ifc 0, 0, COND_MODE_AND // ���e�}�b�s���O, �V���h�E�}�b�s���O
40            mov     TEMP_TEX,           WRLD_POSI
41            dp4     TRAN_TEX0.x,        TEMP_TEX,          nw_texture_matrix0[0]._XYZW
42            dp4     TRAN_TEX0.y,        TEMP_TEX,          nw_texture_matrix0[1]._XYZW
43            dp4     TRAN_TEX0.z,        TEMP_TEX,          nw_texture_matrix0[2]._XYZW
44            mul     TEMP0.xy   ,        nw_texture_translate.xy, TRAN_TEX0.z
45            add     TRAN_TEX0.xy,       TRAN_TEX0.xy,      TEMP0.xy
46        else
47            ifc 1, 0, COND_MODE_AND // �L���[�u�}�b�s���O
48                call    l_gen_texcoord_reflection
49                dp3     TRAN_TEX0.x,        TEMP_TEX,          nw_inverse_view_matrix[0]._XYZW
50                dp3     TRAN_TEX0.y,        TEMP_TEX,          nw_inverse_view_matrix[1]._XYZW
51                dp3     TRAN_TEX0.z,        TEMP_TEX,          nw_inverse_view_matrix[2]._XYZW
52            else // �X�t�B�A�}�b�s���O
53                call    l_gen_texcoord_sphere_reflection
54                dp4     TRAN_TEX0.x,        TEMP_TEX,          nw_texture_matrix0[0]._XYZW
55                dp4     TRAN_TEX0.y,        TEMP_TEX,          nw_texture_matrix0[1]._XYZW
56                //mov     TRAN_TEX0.zw,       TEMP_TEX.zw
57            endif
58            nop
59        endif
60        // �o�̓��W�X�^�ɂ͑S�ẴR���|�[�l���g�ɏ������݂��s���K�v������܂��B
61        mov     o_TexCoord0,        TRAN_TEX0
62    endif
63    nop
64    ret
65