Changeset 3116


Ignore:
Timestamp:
11/11/08 00:46:01 (16 years ago)
Author:
mattausch
Message:

tree animation works somehow with flow vector

Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderManager.cpp

    r3114 r3116  
    4848                printf("Cg error, exiting...\n"); 
    4949 
    50                 Debug << "\n" << cgGetErrorString(lastError) << endl; 
    51                 Debug << "\n" << cgGetLastListing(sCgContext) << endl; 
     50                //Debug << "\n" << cgGetErrorString(lastError) << endl; 
     51                //Debug << "\n" << cgGetLastListing(sCgContext) << endl; 
    5252 
    5353                printf("%s\n\n", cgGetErrorString(lastError)); 
     
    123123        treeAnimProgMrt->AddParameter("minMaxPos", 3); 
    124124        treeAnimProgMrt->AddParameter("frequency", 4); 
     125        treeAnimProgMrt->AddParameter("oldTimer", 5); 
    125126 
    126127        cout << "cg initialization successful" << endl; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderProgram.cpp

    r3115 r3116  
    3030 
    3131GPUProgramParameters::GPUProgramParameters(ShaderProgram *p):  
    32 mProgram(p),  
    33 mTimerParam(-1), 
    34 mViewDirParam(-1), 
    35 mViewMatrixParam(-1), 
    36 mLightDirParam(-1), 
    37 mModelMatrixParam(-1), 
    38 mOldModelMatrixParam(-1) 
    39 { 
     32mProgram(p) 
     33{ 
     34        Reset(); 
    4035} 
    4136 
    4237 
    4338GPUProgramParameters::GPUProgramParameters():  
    44 mProgram(NULL), 
    45 mTimerParam(-1), 
    46 mViewDirParam(-1), 
    47 mViewMatrixParam(-1), 
    48 mLightDirParam(-1), 
    49 mModelMatrixParam(-1), 
    50 mOldModelMatrixParam(-1) 
    51 { 
     39mProgram(NULL) 
     40{ 
     41        Reset(); 
    5242} 
    5343 
     
    6252 
    6353        mTimerParam = -1; 
     54        mOldTimerParam = -1; 
    6455        mViewDirParam = -1; 
    6556        mLightDirParam = -1; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/shaders/treeanimation.cg

    r3115 r3116  
    8585                 
    8686        const float pos = (minMaxPos.x - IN.position.z) / (minMaxPos.x - minMaxPos.y); 
     87 
    8788        float factor = pos * pos * windStrength * sin(timer * frequency); 
     89        const float4 offs = float4(factor * windDir, 0); 
    8890 
    89         const float4 offs = float4(factor * windDir, 0); 
     91        float oldFactor = pos * pos * windStrength * sin(oldTimer * frequency); 
     92        const float4 oldOffs = float4(oldFactor * windDir, 0); 
    9093 
    9194        // transform the vertex position into post projection space 
     
    101104         
    102105        // hack: no translational component anyway 
    103         OUT.oldWorldPos = float4(.0f); 
     106        OUT.oldWorldPos = oldOffs; 
    104107        OUT.worldPos = offs; 
    105108 
Note: See TracChangeset for help on using the changeset viewer.