0001: // -------------------------------------------------------------
0002: // paraboloid.fx
0003: // 
0004: // Copyright (c) 2004 IMAGIRE Takashi. All rights reserved.
0005: // -------------------------------------------------------------
0006: 
0007: 
0008: // -------------------------------------------------------------
0009: // 放物マップ頂点シェーダプログラム
0010: // -------------------------------------------------------------
0011: float4 paraboloid( float4 vPosition, float4x4 mWV )
0012: {   
0013:     float4 Out = (float4)0;          // 出力データ
0014:     float3 pos;
0015:     float l;
0016:     
0017:     float z_min = 0.1;
0018:     float z_max = 100.0;
0019:     
0020:     // 位置座標
0021:     pos = mul( vPosition, mWV ).xyz;
0022:     l = length( pos );
0023:     
0024:     Out.xy = pos.xy * l * (l-pos.z) / dot( pos.xy, pos.xy );
0025:     Out.z = (l-z_min)*z_max/(z_max-z_min);
0026:     
0027:     if( 0 <= pos.z )
0028:     {
0029:         Out.z = (l-z_min)*z_max/(z_max-z_min);
0030:         Out.w = l;
0031:     }else{
0032:         Out.z = 0;
0033:         Out.w = -0.00001;
0034:     }
0035:     
0036:     return Out;
0037: }
0038: 
0039: 
0040: