Changeset 3271 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
- Timestamp:
- 01/12/09 19:03:24 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3270 r3271 132 132 133 133 string filename("city"); 134 string bvhname(""); 134 135 string visibilitySolution(""); 135 136 … … 303 304 304 305 GLuint sunQuery = 0; 306 307 string walkThroughSuffix("frames"); 305 308 306 309 … … 455 458 456 459 env.GetStringParam(string("recordedFramesSuffix"), recordedFramesSuffix); 460 env.GetStringParam(string("walkThroughSuffix"), walkThroughSuffix); 457 461 env.GetStringParam(string("statsFilename"), statsFilename); 458 462 env.GetStringParam(string("filename"), filename); 463 env.GetStringParam(string("bvhname"), bvhname); 459 464 env.GetStringParam(string("visibilitySolution"), visibilitySolution); 460 465 … … 472 477 cout << "max batch size: " << maxBatchSize << endl; 473 478 cout << "triangles per virtual leaf: " << trianglesPerVirtualLeaf << endl; 479 480 cout << "static scene filename prefix: " << filename << endl; 481 cout << "bvh filename prefix: " << bvhname << endl; 474 482 475 483 cout << "key forward motion: " << keyForwardMotion << endl; … … 491 499 cout << "use ssao full resolution: " << ssaoUseFullResolution << endl; 492 500 cout << "recorded frames suffix: " << recordedFramesSuffix << endl; 501 cout << "walkthrough suffix: " << walkThroughSuffix << endl; 493 502 cout << "stats filename: " << statsFilename << endl; 494 cout << "static scene filename prefix: " << filename << endl;495 503 cout << "use PVSs: " << usePvs << endl; 496 504 cout << "visibility solution: " << visibilitySolution << endl; … … 587 595 //LoadModel("sibenik.dem", dynamicObjects); 588 596 597 #if 1 598 599 AxisAlignedBox3 pompeiiBox = SceneEntity::ComputeBoundingBox(staticObjects); 600 589 601 // todo: dispose texture 590 602 Texture *floorTex = new Texture(model_path + "stairs.c.01.tif"); … … 594 606 595 607 floorTex->Create(); 596 597 598 608 Material *mymat = resourceManager->CreateMaterial(); 599 609 600 mymat->GetTechnique(0)->SetDiffuse(RgbaColor(1, 1, 1, 1)); 601 mymat->GetTechnique(0)->SetTexture(floorTex); 602 603 const Vector3 offs(1300.0f, -2500.0f, .0f); 610 Technique *tech = mymat->GetDefaultTechnique(); 611 tech->SetDiffuse(RgbaColor(1, 1, 1, 1)); 612 tech->SetTexture(floorTex); 613 614 Technique *depthPass = new Technique(*tech); 615 Technique *deferred = new Technique(*tech); 616 617 depthPass->SetColorWriteEnabled(false); 618 depthPass->SetLightingEnabled(false); 619 620 ShaderProgram *defaultFragmentTexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("defaultFragmentTexMrt"); 621 ShaderProgram *defaultVertexProgramMrt = ShaderManager::GetSingleton()->GetShaderProgram("defaultVertexMrt"); 622 623 deferred->SetFragmentProgram(defaultFragmentTexProgramMrt); 624 deferred->SetVertexProgram(defaultVertexProgramMrt); 625 626 deferred->GetFragmentProgramParameters()->SetViewMatrixParam(0); 627 deferred->GetVertexProgramParameters()->SetModelMatrixParam(1); 628 deferred->GetVertexProgramParameters()->SetOldModelMatrixParam(2); 629 630 deferred->SetTexture(floorTex); 631 632 mymat->AddTechnique(deferred); 633 mymat->AddTechnique(depthPass); 634 635 636 //const Vector3 offs(1300.0f, -2500.0f, .0f); 637 const Vector3 offs(pompeiiBox.Center(0), pompeiiBox.Center(1), 0); 604 638 Matrix4x4 moffs = TranslationMatrix(offs); 605 639 … … 609 643 SceneEntity *myplane = 610 644 SceneEntityConverter().ConvertPlane(plane, 611 500,612 500,645 pompeiiBox.Size(0), 646 pompeiiBox.Size(1), 613 647 5, 614 648 5, … … 618 652 resourceManager->AddSceneEntity(myplane); 619 653 staticObjects.push_back(myplane); 620 /*const float side = 400.0f; 621 AxisAlignedBox3 mybox(Vector3(-side, -side, -side), Vector3(side, side, side)); 622 623 Transform3 *mytrafo2 = resourceManager->CreateTransform(moffs); 624 625 SceneEntity *myboxEnt = 626 SceneEntityConverter().ConvertBox(mybox, mymat, mytrafo2); 627 628 staticObjects.push_back(myboxEnt); 629 resourceManager->AddSceneEntity(myboxEnt);*/ 654 655 #endif 630 656 631 657 #if 0 … … 667 693 //-- load the associated static bvh 668 694 669 const string bvh_filename = string(model_path + filename + ".bvh");670 671 695 BvhFactory bvhFactory; 672 #if 1 673 bvh = bvhFactory.Create(staticObjects, dynamicObjects, maxDepthForTestingChildren); 674 #else 675 bvh = bvhFactory.Create(bvh_filename, staticObjects, dynamicObjects, maxDepthForTestingChildren); 676 #endif 677 678 if (!bvh) 679 { 680 cerr << "loading bvh " << bvh_filename << " failed" << endl; 681 CleanUp(); 682 exit(0); 696 697 if (bvhname != "") 698 { 699 cout << "loading bvh from disc" << endl; 700 const string bvh_fullpath = string(model_path + bvhname + ".bvh"); 701 bvh = bvhFactory.Create(bvh_fullpath, staticObjects, dynamicObjects, maxDepthForTestingChildren); 702 703 if (!bvh) 704 { 705 cerr << "loading bvh " << bvh_fullpath << " failed" << endl; 706 CleanUp(); 707 exit(0); 708 } 709 } 710 else 711 { 712 cout << "creating new bvh" << endl; 713 bvh = bvhFactory.Create(staticObjects, dynamicObjects, maxDepthForTestingChildren); 683 714 } 684 715 … … 1198 1229 { 1199 1230 if (!walkThroughPlayer) 1200 walkThroughPlayer = new WalkThroughPlayer( "frames.log");1231 walkThroughPlayer = new WalkThroughPlayer(walkThroughSuffix + ".log"); 1201 1232 1202 1233 ++ currentReplayFrame; … … 1229 1260 { 1230 1261 if (!walkThroughRecorder) 1231 walkThroughRecorder = new WalkThroughRecorder( "frames.log");1262 walkThroughRecorder = new WalkThroughRecorder(walkThroughSuffix + ".log"); 1232 1263 1233 1264 if ((Distance(oldPos, camera->GetPosition()) > 1e-6f) || … … 2560 2591 { 2561 2592 const string filename = string(model_path + model); 2562 2563 2593 int numEntities = 0; 2564 2594
Note: See TracChangeset
for help on using the changeset viewer.