1// ---------------------------------------------------------------------------
2//  Project:  NintendoWare
3//  File:     GenTexcoordSphereReflection.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// @brief        ���˃x�N�g���� xy ���p���ăe�N�X�`�����W�� TEMP_TEX �Ɋi�[���܂��B
21//-----------------------------------------------------------------------------
22l_gen_texcoord_sphere_reflection:
23#ifdef NW_NORMAL_ENV_MAP
24    mov     TEMP1.xy,           CONST_HALF
25    mov     TEMP1.zw,           CONST_0
26    mad     TEMP_TEX,           TEMP_NORM,      TEMP1, TEMP1
27    mov     TEMP_TEX.zw,        CONST_0_0_1_1
28#else
29    call    l_gen_texcoord_reflection
30    mov     TEMP1,              TEMP_TEX
31    add     TEMP1.z,            TEMP1.z,        CONST_1
32    dp3     TEMP1,              TEMP1,          TEMP1
33    rsq     TEMP2,              TEMP1.x
34    mul     TEMP2,              TEMP2,          CONST_HALF
35    mul     TEMP_TEX.xy,        TEMP_TEX.xy,    TEMP2
36    add     TEMP_TEX.xy,        TEMP_TEX.xy,    CONST_HALF
37#endif
38    ret
39