- Timestamp:
- 10/20/08 01:26:12 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3045 r3046 42 42 static CGprofile sCgFragmentProfile; 43 43 static CGprofile sCgVertexProfile; 44 static ShaderProgram *sTreeAnimation; 44 45 static ShaderProgram *sTreeAnimationProgramMrt; 46 static ShaderProgram *sTreeAnimationProgram; 47 45 48 46 49 // only instance of the resource manager … … 153 156 154 157 /////////// 155 //-- hack: tree animation158 //-- hack: add tree animation 156 159 157 160 if (numLODs > 1) 158 161 { 159 for (int i = 0; i < min(numLODs, 2); ++ i) 162 //for (int i = 0; i < min(numLODs, 2); ++ i) 163 for (int i = 0; i < numLODs; ++ i) 160 164 { 161 165 ShapeContainer::iterator sstart, send; … … 172 176 { 173 177 Technique *tech = mat->GetTechnique(i); 174 tech->SetVertexProgram(sTreeAnimation);175 178 176 179 GPUProgramParameters *vtxParams = tech->GetVertexProgramParameters(); 177 180 181 if (i == 0) 182 { 183 tech->SetVertexProgram(sTreeAnimationProgram); 184 vtxParams->SetLightDirParam(5); 185 } 186 else 187 { 188 tech->SetVertexProgram(sTreeAnimationProgramMrt); 189 } 190 191 /// use a timer to simulate the moving of the tree in the wind 178 192 vtxParams->SetTimerParam(0); 179 193 // wind direction … … 352 366 353 367 354 void ResourceManager::LoadSceneEntities(igzstream &str, SceneEntityContainer &entities) 368 void ResourceManager::LoadSceneEntities(igzstream &str, 369 SceneEntityContainer &entities) 355 370 { 356 371 int entityCount; … … 373 388 374 389 375 bool ResourceManager::Load(const std::string &filename, SceneEntityContainer &entities) 390 bool ResourceManager::Load(const std::string &filename, 391 SceneEntityContainer &entities) 376 392 { 377 393 igzstream istr(filename.c_str()); … … 468 484 mMrtDefaultFragmentProgram->AddParameter("viewMatrix", 0); 469 485 mMrtDefaultFragmentTexProgram->AddParameter("viewMatrix", 0); 470 471 486 // add a texture parameter 472 487 mMrtDefaultFragmentTexProgram->AddParameter("tex", 1); 473 488 474 sTreeAnimation = CreateVertexProgram("treeanimation", "animateVtxMrt"); 475 476 sTreeAnimation->AddParameter("timer", 0); 477 sTreeAnimation->AddParameter("windDir", 1); 478 sTreeAnimation->AddParameter("windStrength", 2); 479 sTreeAnimation->AddParameter("minMaxPos", 3); 480 sTreeAnimation->AddParameter("frequency", 4); 489 490 //////////// 491 //-- hack: apply hardcoded tree animation (should be provided with a material script!) 492 493 sTreeAnimationProgram = CreateVertexProgram("treeanimation", "animateVtx"); 494 sTreeAnimationProgramMrt = CreateVertexProgram("treeanimation", "animateVtxMrt"); 495 496 sTreeAnimationProgram->AddParameter("timer", 0); 497 sTreeAnimationProgram->AddParameter("windDir", 1); 498 sTreeAnimationProgram->AddParameter("windStrength", 2); 499 sTreeAnimationProgram->AddParameter("minMaxPos", 3); 500 sTreeAnimationProgram->AddParameter("frequency", 4); 501 sTreeAnimationProgram->AddParameter("lightDir", 5); 502 503 sTreeAnimationProgramMrt->AddParameter("timer", 0); 504 sTreeAnimationProgramMrt->AddParameter("windDir", 1); 505 sTreeAnimationProgramMrt->AddParameter("windStrength", 2); 506 sTreeAnimationProgramMrt->AddParameter("minMaxPos", 3); 507 sTreeAnimationProgramMrt->AddParameter("frequency", 4); 481 508 482 509 cout << "cg initialization successful" << endl;
Note: See TracChangeset
for help on using the changeset viewer.