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