Changeset 3056


Ignore:
Timestamp:
10/21/08 17:41:14 (16 years ago)
Author:
mattausch
Message:
 
Location:
GTP/trunk/App/Demos/Vis/FriendlyCulling/src
Files:
2 edited

Legend:

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

    r3055 r3056  
    2626 
    2727 
     28// only instance of the shader manager 
     29ShaderManager *ShaderManager::sShaderManager = NULL; 
     30 
    2831///////// 
    2932//-- cg stuff 
     
    3437static CGprofile sCgVertexProfile;  
    3538 
    36 static ShaderProgram *sTreeAnimationProgramMrt; 
    37 static ShaderProgram *sTreeAnimationProgram; 
    38 static ShaderProgram *sTreeAnimation; 
    39  
    40 // only instance of the shader manager 
    41 ShaderManager *ShaderManager::sShaderManager = NULL; 
    4239 
    4340 
     
    7370        // set textures to auto load 
    7471        cgGLSetManageTextureParameters(sCgContext, false); 
    75  
    76         mMrtDefaultVertexProgram = CreateVertexProgram("mrt", "vtx", "defaultMrtVertex"); 
    77         mMrtDefaultFragmentProgram = CreateFragmentProgram("mrt", "frag", "defaultMrtFragment"); 
    78         mMrtDefaultFragmentTexProgram = CreateFragmentProgram("mrt", "fragtex", "defaultMrtFragmentTex"); 
     72         
     73        /////////////// 
     74        //-- load the defaul programs for mrt (used if not defined by the user) 
     75 
     76        ShaderProgram *vertexProgMrt, *fragmentProgMrt, *fragmentProgMrtTex; 
     77 
     78        vertexProgMrt = CreateVertexProgram("mrt", "vtx", "defaultVertexMrt"); 
     79        fragmentProgMrt = CreateFragmentProgram("mrt", "frag", "defaultFragmentMrt"); 
     80        fragmentProgMrtTex = CreateFragmentProgram("mrt", "fragtex", "defaultFragmentTexMrt"); 
    7981 
    8082        // provide the current view matrix 
    81         mMrtDefaultFragmentProgram->AddParameter("viewMatrix", 0); 
    82         mMrtDefaultFragmentTexProgram->AddParameter("viewMatrix", 0); 
     83        fragmentProgMrt->AddParameter("viewMatrix", 0); 
     84        fragmentProgMrtTex->AddParameter("viewMatrix", 0); 
     85 
    8386        // add a texture parameter 
    84         mMrtDefaultFragmentTexProgram->AddParameter("tex", 1); 
     87        fragmentProgMrtTex->AddParameter("tex", 1); 
    8588 
    8689 
    8790        ////////////////////////// 
    88         //-- hack: apply hardcoded tree animation (should be provided with a material script!) 
    89  
    90         sTreeAnimationProgram = CreateVertexProgram("treeanimation", "animateVtx", "treeAnimation"); 
    91         sTreeAnimationProgramMrt = CreateVertexProgram("treeanimation", "animateVtxMrt", "treeAnimationMrt"); 
    92  
    93         sTreeAnimationProgram->AddParameter("timer", 0); 
    94         sTreeAnimationProgram->AddParameter("windDir", 1); 
    95         sTreeAnimationProgram->AddParameter("windStrength", 2); 
    96         sTreeAnimationProgram->AddParameter("minMaxPos", 3); 
    97         sTreeAnimationProgram->AddParameter("frequency", 4); 
    98         sTreeAnimationProgram->AddParameter("lightDir", 5); 
    99  
    100         sTreeAnimationProgramMrt->AddParameter("timer", 0); 
    101         sTreeAnimationProgramMrt->AddParameter("windDir", 1); 
    102         sTreeAnimationProgramMrt->AddParameter("windStrength", 2); 
    103         sTreeAnimationProgramMrt->AddParameter("minMaxPos", 3); 
    104         sTreeAnimationProgramMrt->AddParameter("frequency", 4); 
     91        //-- hack: use hardcoded tree animation (should be provided with a material script!) 
     92 
     93        ShaderProgram *treeAnimProg, *treeAnimProgMrt; 
     94 
     95        treeAnimProg = CreateVertexProgram("treeanimation", "animateVtx", "treeAnimation"); 
     96        treeAnimProgMrt = CreateVertexProgram("treeanimation", "animateVtxMrt", "treeAnimationMrt"); 
     97 
     98        treeAnimProg->AddParameter("timer", 0); 
     99        treeAnimProg->AddParameter("windDir", 1); 
     100        treeAnimProg->AddParameter("windStrength", 2); 
     101        treeAnimProg->AddParameter("minMaxPos", 3); 
     102        treeAnimProg->AddParameter("frequency", 4); 
     103        treeAnimProg->AddParameter("lightDir", 5); 
     104 
     105        treeAnimProgMrt->AddParameter("timer", 0); 
     106        treeAnimProgMrt->AddParameter("windDir", 1); 
     107        treeAnimProgMrt->AddParameter("windStrength", 2); 
     108        treeAnimProgMrt->AddParameter("minMaxPos", 3); 
     109        treeAnimProgMrt->AddParameter("frequency", 4); 
    105110 
    106111        cout << "cg initialization successful" << endl; 
  • GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ShaderManager.h

    r3055 r3056  
    7070        ShaderMap mShaderMap; 
    7171 
    72         //////////// 
    73         //-- default shader programs 
    74  
    75         ShaderProgram *mMrtDefaultVertexProgram; 
    76         ShaderProgram *mMrtDefaultFragmentProgram; 
    77         ShaderProgram *mMrtDefaultFragmentTexProgram; 
    78  
    79  
    8072private: 
    8173 
Note: See TracChangeset for help on using the changeset viewer.