Ignore:
Timestamp:
10/19/08 00:29:45 (16 years ago)
Author:
mattausch
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.