Ignore:
Timestamp:
07/07/06 08:53:01 (18 years ago)
Author:
szirmay
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/programs/GameTools_Cau.hlsl

    r916 r1094  
    1010        float2 center           : TEXCOORD2; 
    1111        float4 position         : TEXCOORD3; 
     12        float pSize                     : PSIZE; 
     13        float dist                      : TEXCOORD4; 
    1214}; 
    1315 
     
    2426      
    2527   float radius = CauSpriteSize; 
    26    float2 offset = 2.0 * texCoord.zw * radius; 
    27     
     28   OUT.pSize = radius; 
    2829   float4 cPosition;   
    2930 
    30    float4 pos = tex2Dlod(PhotonHitMap, float4(position.x, 1.0 - position.y,0,0)).rgba; 
     31  float4 pos = tex2Dlod(PhotonHitMap, float4(position.x, 1.0 - position.y,0,0)).rgba; 
     32//      float4 pos = float4(0,0,-0.5,1); 
    3133   if(pos.a == 0)//no photon hit 
    3234   { 
     
    4042                cPosition = mul(worldView, wPosition); 
    4143                OUT.center = cPosition.xy; 
    42                 cPosition.xy += offset;                          
    4344                OUT.position = cPosition;        
    44                 OUT.hPosition = mul(Proj, cPosition); 
    45                  
    46                 /*  
    47                 //rotate to camera 
    48                 cPosition = mul(worldView, wPosition); 
    49                                  
    50                 float3 C = cPosition.xyz; 
    51                 float3 right = cross(C, float3(0,1,0)); 
    52                 float3 up = cross(right, C); 
    53                  
    54                 float3 cOffset = offset.x * right + offset.y * up; 
    55                 cPosition.xy += float2(-0.5/resolution, -0.5/resolution); 
    56                 OUT.center = cPosition.xy; 
    57                 cPosition.xyz += cOffset;                                
    58                 OUT.position = cPosition;        
    59                 OUT.hPosition = mul(Proj, cPosition); 
    60                 */ 
     45                OUT.hPosition = mul(Proj, cPosition);            
    6146         }       
    6247   
    63    OUT.r.x = abs(offset.x); 
     48   OUT.r.x = radius; 
    6449   OUT.r.y = radius; 
    6550   OUT.texCoord = texCoord; 
    66    OUT.color = 1;        
     51   OUT.color = 1;  
     52   OUT.color = float4(pos); 
     53   OUT.dist = length(pos.xyz); 
    6754    
    6855   return OUT; 
     
    7158 
    7259float4 CauPS(VS_OUT IN, 
     60                uniform float3 color, 
    7361                uniform sampler2D intensityTex : register(s1) 
    7462                 ):COLOR 
    7563{ 
    7664 
    77   float2 texcoord = (IN.center - IN.position.xy) / IN.r.x; 
    78   texcoord = (texcoord + 1.0) * 0.5; 
    79   float intens = tex2D(intensityTex, texcoord).r; 
    80   IN.color = intens * CauSpriteIntens; 
    81   
    82   return IN.color; 
    83    
     65 // float2 texcoord = (IN.center - IN.position.xy) / IN.r.x; 
     66 // texcoord = (texcoord + 1.0) * 0.5; 
     67  IN.color.rgb = color; 
     68  float intens = tex2D(intensityTex, IN.texCoord).r; 
     69  IN.color.a = intens * CauSpriteIntens; 
     70  return IN.color;   
    8471} 
    8572 
Note: See TracChangeset for help on using the changeset viewer.