Ignore:
Timestamp:
10/19/08 00:29:45 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/mrt.cg

    r3034 r3041  
    88}; 
    99 
     10 
    1011// vtx output 
    1112struct vtxout 
    1213{ 
    13   float4 position: POSITION; // eye space 
    14   float4 texCoord: TEXCOORD0;     
     14        float4 position: POSITION; 
     15        float4 texCoord: TEXCOORD0;     
    1516 
    16   float4 color: COLOR0;   
    17   float4 eyePos: TEXCOORD1; // eye position 
    18   float3 normal: TEXCOORD2; 
     17        float4 color: COLOR0;   
     18        float4 eyePos: TEXCOORD1; // eye position 
     19        float3 normal: TEXCOORD2; 
    1920}; 
    2021 
     
    6061} 
    6162 
    62 //#pragma position_invariant fragtex 
    6363 
    6464pixel fragtex(fragin IN,  
     
    7878        // save world space normal in rt 
    7979        pix.norm = IN.normal; 
    80  
     80        // compute eye linear depth 
     81        pix.col.w = length(IN.eyePos.xyz); 
    8182        // hack: squeeze some information about ambient into the texture 
    8283        //pix.col.w = glstate.material.emission.x; 
    83  
    84         // compute eye linear depth 
    85         pix.col.w = length(IN.eyePos.xyz); 
    8684 
    8785        return pix; 
     
    9290{ 
    9391        pixel pix; 
    94  
    9592        // hack: use comination of emmisive + diffuse (emmisive used as constant ambient term) 
    9693        pix.col = glstate.material.diffuse + glstate.material.emission; 
    97  
     94        // save world space normal in rt 
    9895        pix.norm = IN.normal; 
    99  
     96        // eye space depth 
    10097        pix.col.w = length(IN.eyePos.xyz); 
    101  
    10298        // hack: squeeze some information about the ambient term into the target 
    10399        //pix.col.w = glstate.material.emission.x; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/sky_preetham.cg

    r3040 r3041  
    1 //-------------------------------------------------------------------------------------- 
    2 // Input and Output structs 
    3 //-------------------------------------------------------------------------------------- 
    4  
    5  
    6  
    71struct vtxin 
    82{ 
     
    1711struct vtxout 
    1812{ 
    19         float4 position: POSITION; // eye space 
     13        float4 color: COLOR0;   
     14        float4 position: POSITION;  
     15 
    2016        float4 texCoord: TEXCOORD0;     
    21  
    22         float4 color: COLOR0;   
    23         float4 worldPos: TEXCOORD1; // world position 
    24         float3 normal: TEXCOORD2; 
    25         float4 mypos: TEXCOORD3; 
    26         float4 hdrColor: TEXCOORD4; 
     17        float3 normal: TEXCOORD1; 
     18        float4 hdrColor: TEXCOORD2; 
    2719}; 
    2820 
     
    3224{ 
    3325        float4 color: COLOR0;   
    34         float4 position: POSITION; // eye space 
     26        //float4 projPos: WPOS; 
     27        //float4 position: POSITION; 
     28 
    3529        float4 texCoord: TEXCOORD0;     
    36  
    37         float4 projPos: WPOS; 
    38         float3 normal: TEXCOORD2; 
    39         float4 hdrColor: TEXCOORD4; 
     30        float3 normal: TEXCOORD1; 
     31        float4 hdrColor: TEXCOORD2; 
    4032}; 
    4133 
    4234 
    43 struct fragout 
     35struct pixel 
    4436{ 
    4537        float4 col: COLOR0; 
    46         float4 norm: COLOR1; 
     38        float3 norm: COLOR1; 
    4739        float3 pos: COLOR2; 
    4840}; 
     
    10496 
    10597 
    106 fragout frag_skydome(fragin IN) 
     98pixel frag_skydome(fragin IN) 
    10799{ 
    108         fragout pix; 
     100        pixel pix; 
    109101 
    110102        pix.col = IN.hdrColor; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/treeanimation.cg

    r3040 r3041  
    88        float4 position: POSITION; 
    99        float3 normal: NORMAL; 
    10         float3 color: COLOR; 
    11         float2 texcoord: TEXCOORD0; 
     10        float4 color: COLOR; 
     11        float4 texCoord: TEXCOORD0; 
    1212}; 
    13  
    1413 
    1514// vtx output 
    1615struct vtxout 
    1716{ 
    18         float4 position: POSITION; // eye space 
     17        float4 position: POSITION; 
    1918        float4 texCoord: TEXCOORD0;     
    2019 
    2120        float4 color: COLOR0;   
     21        float4 eyePos: TEXCOORD1; // eye position 
    2222        float3 normal: TEXCOORD2; 
    23         float4 eyePos: TEXCOORD3; 
    2423}; 
    25  
    2624 
    2725 
     
    3432                                  uniform float3 windDir, 
    3533                                  uniform float windStrength, 
    36                                   uniform float2 minmaxPos, 
     34                                  uniform float frequency, 
     35                                  uniform float2 minMaxPos, 
    3736                                  uniform float timer) 
    3837{ 
    3938        vtxout OUT; 
    4039 
    41         OUT.color = IN.color; 
     40        OUT.color = float4(0);//IN.color; 
    4241        OUT.texCoord = IN.texCoord; 
     42                 
     43        const float pos = (minMaxPos.x - IN.position.z) / (minMaxPos.x - minMaxPos.y); 
     44 
     45        float factor = pos * windStrength * sin(timer * frequency); 
     46 
     47        // transform the vertex position into post projection space 
     48        OUT.position = mul(glstate.matrix.mvp, IN.position); 
     49        // displace the input position 
     50        OUT.position += float4(factor * windDir, 0); 
     51 
    4352        // transform the vertex position into eye space 
    4453        OUT.eyePos = mul(glstate.matrix.modelview[0], IN.position); 
    45          
    46         const float pos = (minmaxPos.x - IN.position.y / (minmaxPos.x - minmaxPos.y); 
    47  
    48         float factor = windStrength * sin(timer); 
    49  
    50         // displace the input position 
    51         float4 newPos = IN.position + float4(factor * windDir, 0.0f); 
    52         // transform the vertex position into post projection space 
    53         OUT.position = mul(glstate.matrix.mvp, IN.position); 
     54        OUT.eyePos += float4(factor * windDir, 0); 
    5455 
    5556        OUT.normal = IN.normal; 
Note: See TracChangeset for help on using the changeset viewer.