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