- Timestamp:
- 10/17/08 02:29:01 (16 years ago)
- Location:
- GTP/trunk/App/Demos/Vis/FriendlyCulling
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/FriendlyCulling.sln
r3019 r3037 7 7 EndProject 8 8 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MainApp", "MainApp.vcproj", "{A564071F-D054-4556-883B-999D7F9CC58C}" 9 ProjectSection(ProjectDependencies) = postProject 10 {03661866-4093-4B02-B26A-028EA91AF023} = {03661866-4093-4B02-B26A-028EA91AF023} 11 EndProjectSection 12 EndProject 13 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "IrradianceMapping", "IrradianceMapping.vcproj", "{91680C49-A358-48AE-A02C-66CB884B7D7F}" 9 14 ProjectSection(ProjectDependencies) = postProject 10 15 {03661866-4093-4B02-B26A-028EA91AF023} = {03661866-4093-4B02-B26A-028EA91AF023} … … 29 34 {A564071F-D054-4556-883B-999D7F9CC58C}.Release|Win32.ActiveCfg = Release|Win32 30 35 {A564071F-D054-4556-883B-999D7F9CC58C}.Release|Win32.Build.0 = Release|Win32 36 {91680C49-A358-48AE-A02C-66CB884B7D7F}.Debug|Win32.ActiveCfg = Debug|Win32 37 {91680C49-A358-48AE-A02C-66CB884B7D7F}.Debug|Win32.Build.0 = Debug|Win32 38 {91680C49-A358-48AE-A02C-66CB884B7D7F}.Release|Win32.ActiveCfg = Release|Win32 39 {91680C49-A358-48AE-A02C-66CB884B7D7F}.Release|Win32.Build.0 = Release|Win32 31 40 EndGlobalSection 32 41 GlobalSection(SolutionProperties) = preSolution -
GTP/trunk/App/Demos/Vis/FriendlyCulling/IrradianceMapping.vcproj
r3017 r3037 183 183 <Files> 184 184 <Filter 185 Name="Source Files"186 Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"187 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"188 >189 <File190 RelativePath=".\src\irradiance.cpp"191 >192 </File>193 </Filter>194 <Filter195 185 Name="Header Files" 196 186 Filter="h;hpp;hxx;hm;inl;inc;xsd" 197 187 UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" 198 188 > 189 <Filter 190 Name="Source Files" 191 Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" 192 UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" 193 > 194 <File 195 RelativePath=".\src\irradiance.cpp" 196 > 197 </File> 198 </Filter> 199 199 </Filter> 200 200 </Files> -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.cpp
r3036 r3037 32 32 { 33 33 34 // only instance of the resource manager 35 ResourceManager *ResourceManager::sResourceManager = NULL; 34 36 35 37 ResourceManager::~ResourceManager() … … 44 46 CLEAR_CONTAINER(mLODs); 45 47 CLEAR_CONTAINER(mGPUParameters); 48 CLEAR_CONTAINER(mShaders); 46 49 } 47 50 … … 324 327 } 325 328 326 } 327 329 330 ShaderProgram *CreateShaderProgram(const std::string &filename, const std::string &funcName, bool isFragment) 331 { 332 ShaderProgram *p; 333 return p; 334 } 335 336 } 337 -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/ResourceManager.h
r3036 r3037 33 33 public: 34 34 35 ~ResourceManager(); 35 /** Returns the resource manager as a singleton. 36 */ 37 static ResourceManager *GetSingleton() 38 { 39 if (!sResourceManager) 40 { 41 sResourceManager = new ResourceManager(); 42 } 43 44 return sResourceManager; 45 } 46 47 /** We also want full control over the delete. 48 */ 49 static void DelSingleton() 50 { 51 DEL_PTR(sResourceManager); 52 } 53 36 54 /** Loads a model 37 55 */ … … 43 61 */ 44 62 GPUProgramParameters *CreateGPUProgramParameters(ShaderProgram *p); 63 /** Creates a new shader program. 64 */ 65 ShaderProgram *CreateShaderProgram(const std::string &filename, const std::string &funcName, bool isFragment); 45 66 46 67 protected: 47 68 69 /** Default constructor. The constructor is protected 70 to have control over instantiation using the 71 singleton pattern. 72 */ 73 ResourceManager() {} 74 75 ~ResourceManager(); 76 48 77 void LoadTextures(igzstream &str); 49 78 void LoadShapes(igzstream &str); … … 74 103 /// the scene entities 75 104 SceneEntityContainer mSceneEntities; 105 106 private: 107 108 static ResourceManager *sResourceManager; 76 109 }; 110 77 111 78 112 } -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3036 r3037 457 457 perfGraph = new PerformanceGraph(1000); 458 458 459 loader = new ResourceManager();459 loader = ResourceManager::GetSingleton(); 460 460 461 461 const string filename = string(model_path + "city.dem"); … … 521 521 522 522 state.SetRenderPassType(RenderState::FIXED); 523 sceneQuery = new SceneQuery(bvh->GetBox(), traverser);524 523 525 524 // frame time is restarted every frame … … 1733 1732 DEL_PTR(visualization); 1734 1733 DEL_PTR(camera); 1735 DEL_PTR(loader);1736 1734 DEL_PTR(renderQueue); 1737 1735 DEL_PTR(perfGraph); … … 1747 1745 DEL_PTR(RenderState::sCgMrtVertexProgram); 1748 1746 1747 ResourceManager::DelSingleton(); 1748 loader = NULL; 1749 1749 1750 DeferredRenderer::ReleaseCG(); 1750 1751 SkyPreetham::ReleaseCG(); … … 2033 2034 void PlaceViewer(const Vector3 &oldPos) 2034 2035 { 2036 if (!sceneQuery) 2037 sceneQuery = new SceneQuery(bvh->GetBox(), traverser); 2038 2035 2039 Vector3 playerPos = camera->GetPosition(); 2036 2040 bool validIntersect = sceneQuery->CalcIntersection(playerPos); -
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/irradiance.cpp
r3020 r3037 1 1 // chcdemo.cpp : Defines the entry point for the console application. 2 2 // 3 #include "glInterface.h" 3 4 5 #include "common.h" 6 7 #ifdef _CRT_SET 8 #define _CRTDBG_MAP_ALLOC 9 #include <stdlib.h> 10 #include <crtdbg.h> 11 12 // redefine new operator 13 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 14 #define new DEBUG_NEW 15 #endif 16 4 17 #include <math.h> 5 18 #include <time.h> 6 #include "common.h" 19 #include "glInterface.h" 20 21 #include <Cg/cg.h> 22 #include <Cg/cgGL.h> 23 24 7 25 #include "RenderTraverser.h" 8 26 #include "SceneEntity.h" … … 24 42 #include "RenderQueue.h" 25 43 #include "Material.h" 26 #include <Cg/cg.h>27 #include <Cg/cgGL.h>28 44 #include "glfont2.h" 29 45 #include "PerformanceGraph.h" … … 42 58 #include "EntityMerger.h" 43 59 44 45 46 60 using namespace std; 47 61 using namespace CHCDemoEngine; … … 59 73 /// the renderable scene geometry 60 74 SceneEntityContainer sceneEntities; 61 SceneEntityContainer sceneEntities2; 62 SceneEntity *buddha = NULL; 75 63 76 // traverses and renders the hierarchy 64 77 RenderTraverser *traverser = NULL; … … 255 268 inline float KeyRotationAngle() { return keyRotation * elapsedTime * 1e-3f; } 256 269 inline float KeyShift() { return keyForwardMotion * elapsedTime * 1e-3f; } 257 270 // initialise the frame buffer objects 258 271 void InitFBO(); 259 272 … … 268 281 269 282 static CGcontext sCgContext = NULL; 270 static CGprogram sCgMrtVertexProgram = NULL; 271 272 static CGparameter sMaxDepthParam; 273 static CGparameter sMaxDepthParamTex; 283 274 284 static CGparameter sEyePosParamTex; 275 285 static CGparameter sEyePosParam; 276 277 static CGparameter sTLParam;278 static CGparameter sTRParam;279 static CGparameter sBRParam;280 static CGparameter sBLParam;281 282 static CGparameter sTLParamTex;283 static CGparameter sTRParamTex;284 static CGparameter sBRParamTex;285 static CGparameter sBLParamTex;286 286 287 287 static Matrix4x4 viewProjMat = IdentityMatrix(); … … 321 321 int main(int argc, char* argv[]) 322 322 { 323 /* 324 #ifdef _CRT_SET 325 326 //Now just call this function at the start of your program and if you're 327 //compiling in debug mode (F5), any leaks will be displayed in the Output 328 //window when the program shuts down. If you're not in debug mode this will 329 //be ignored. Use it as you will! 330 //note: from GDNet Direct [3.8.04 - 3.14.04] void detectMemoryLeaks() { 331 332 _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF); 333 _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); 334 _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR); 335 #endif 336 */ 337 cout << "=== reading environment file ===" << endl << endl; 338 323 339 int returnCode = 0; 324 340 … … 329 345 cout << "=== reading environment file ===" << endl << endl; 330 346 331 string envFileName = "default.env";347 const string envFileName = "default.env"; 332 348 if (!env.Read(envFileName)) 333 349 { … … 359 375 //env.GetStringParam(string("modelPath"), model_path); 360 376 //env.GetIntParam(string("numSssaoSamples"), numSsaoSamples); 361 362 377 363 378 cout << "assumedVisibleFrames: " << assumedVisibleFrames << endl; … … 407 422 SceneEntity::SetUseLODs(useLODs); 408 423 409 410 424 if (!useFullScreen) 411 425 { … … 432 446 InitGLstate(); 433 447 434 435 448 glEnable(GL_MULTISAMPLE_ARB); 436 449 glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST); … … 439 452 MiddleMotion(0, 0); 440 453 454 // init cg shader programs 455 InitCg(); 456 441 457 perfGraph = new PerformanceGraph(1000); 442 458 443 loader = new ResourceManager();459 loader = ResourceManager::GetSingleton(); 444 460 445 461 const string filename = string(model_path + "city.dem"); 446 462 447 463 if (loader->Load(filename, sceneEntities)) 448 464 cout << "model " << filename << " loaded" << endl; … … 453 469 exit(0); 454 470 } 471 455 472 456 473 const string bvh_filename = string(model_path + "city.bvh"); … … 464 481 exit(0); 465 482 } 466 467 468 const string buddhafilename = string(model_path + "hbuddha.dem");469 470 if (loader->Load(buddhafilename, sceneEntities2))471 cout << "model " << buddhafilename << " loaded" << endl;472 else473 {474 cerr << "loading model " << buddhafilename << " failed" << endl;475 CleanUp();476 exit(0);477 }478 479 buddha = sceneEntities2[0];480 481 Matrix4x4 translation = TranslationMatrix(camera->GetPosition());482 483 buddha->GetTransform()->SetMatrix(translation);484 485 486 #if 0487 488 int merged = 0;489 490 SceneEntity *oldEnt = NULL;491 492 cout << "merging entities .. " << endl;493 SceneEntityContainer::const_iterator sit, sit_end = sceneEntities.end();494 495 for (sit = sceneEntities.begin(); sit < sit_end; ++ sit)496 {497 SceneEntity *newEnt = (*sit);498 499 if (!newEnt->GetTransform()->IsIdentity())500 {501 sceneEntities2.push_back(newEnt);502 continue;503 }504 505 if (oldEnt)506 {507 EntityMerger merger(newEnt, oldEnt);508 SceneEntity *ent = merger.Merge();509 510 sceneEntities2.push_back(ent);511 512 oldEnt = NULL;513 514 ++ merged;515 }516 else517 {518 oldEnt = newEnt;519 }520 }521 522 if (oldEnt && oldEnt->GetTransform()->IsIdentity())523 sceneEntities2.push_back(oldEnt);524 525 cout << "merged " << merged << " of " << (int)sceneEntities.size() << " entities " << endl;526 #endif527 483 528 484 // set far plane based on scene extent … … 532 488 camera->SetFar(Magnitude(bvh->GetBox().Diagonal())); 533 489 534 InitCg();535 536 DeferredRenderer::Init(sCgContext);537 SkyPreetham::Init(sCgContext);538 539 490 Vector3 cubeCenter(470.398f, 240.364f, 182.5f); 540 491 541 492 Matrix4x4 transl = TranslationMatrix(cubeCenter); 542 543 493 544 494 SceneEntityContainer dummy; … … 546 496 string skyDomeStr(model_path + "sky.dem"); 547 497 548 if (loader->Load(skyDomeStr, dummy)) 549 cout << "successfully loaded " << dummy.size() << " scene entities" << endl; 498 if (loader->Load(skyDomeStr, sceneEntities)) 499 { 500 cout << "successfully loaded " << sceneEntities.size() << " scene entities" << endl; 501 } 550 502 else 551 503 { … … 556 508 } 557 509 558 skyDome = dummy[0]; 559 510 skyDome = sceneEntities.back(); 511 512 //InitCg(); 560 513 561 514 const float turbitiy = 5.0f; … … 568 521 569 522 state.SetRenderPassType(RenderState::FIXED); 570 sceneQuery = new SceneQuery(bvh->GetBox(), traverser);571 523 572 524 // frame time is restarted every frame … … 578 530 // clean up 579 531 CleanUp(); 580 532 581 533 return 0; 582 534 } … … 585 537 void InitCg(void) 586 538 { 587 // Setup Cg539 // setup cg 588 540 cgSetErrorCallback(cgErrorCallback); 589 541 590 // Create cgContext.542 // create context. 591 543 sCgContext = cgCreateContext(); 592 544 593 // get the best profile for this hardware545 // get the optimal profile 594 546 RenderState::sCgFragmentProfile = cgGLGetLatestProfile(CG_GL_FRAGMENT); 595 547 cgGLSetOptimalOptions(RenderState::sCgFragmentProfile); … … 598 550 cgGLSetOptimalOptions(RenderState::sCgVertexProfile); 599 551 600 sCgMrtVertexProgram = 601 cgCreateProgramFromFile(sCgContext, 602 CG_SOURCE, 603 "src/shaders/mrt.cg", 604 RenderState::sCgVertexProfile, 605 "vtx", 606 NULL); 607 608 if (sCgMrtVertexProgram != NULL) 609 { 610 cgGLLoadProgram(sCgMrtVertexProgram); 611 612 //sInvViewProjParam = cgGetNamedParameter(sCgMrtVertexProgram, "InvViewProj"); 613 Transform3::sModelMatrixParam = cgGetNamedParameter(sCgMrtVertexProgram, "ModelView"); 614 } 552 // set textures to auto load 553 cgGLSetManageTextureParameters(sCgContext, false); 554 555 RenderState::sCgMrtVertexProgram = 556 new ShaderProgram(sCgContext, "src/shaders/mrt.cg", RenderState::sCgVertexProfile, "vtx"); 557 558 if (!RenderState::sCgMrtVertexProgram->IsValid()) 559 cerr << "fragment program failed to load" << endl; 615 560 616 561 RenderState::sCgMrtFragmentTexProgram = 617 cgCreateProgramFromFile(sCgContext, 618 CG_SOURCE, 619 "src/shaders/mrt.cg", 620 RenderState::sCgFragmentProfile, 621 "fragtex", 622 NULL); 623 624 if (RenderState::sCgMrtFragmentTexProgram != NULL) 625 { 626 cgGLLoadProgram(RenderState::sCgMrtFragmentTexProgram); 627 628 sMaxDepthParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "maxDepth"); 629 sEyePosParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "eyePos"); 630 RenderState::sTexParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "tex"); 631 632 cgGLSetParameter1f(sMaxDepthParamTex, MAX_DEPTH_CONST / farDist); 633 634 sTLParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "tl"); 635 sTRParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "tr"); 636 sBRParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "br"); 637 sBLParamTex = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "bl"); 638 } 639 else 562 new ShaderProgram(sCgContext, "src/shaders/mrt.cg", RenderState::sCgFragmentProfile, "fragtex"); 563 564 565 if (!RenderState::sCgMrtFragmentTexProgram->IsValid()) 640 566 cerr << "fragment tex program failed to load" << endl; 641 567 568 RenderState::sCgMrtFragmentTexProgram->AddParameter("tex", 0); 569 642 570 RenderState::sCgMrtFragmentProgram = 643 cgCreateProgramFromFile(sCgContext, 644 CG_SOURCE, 645 "src/shaders/mrt.cg", 646 RenderState::sCgFragmentProfile, 647 "frag", 648 NULL); 649 650 if (RenderState::sCgMrtFragmentProgram != NULL) 651 { 652 cgGLLoadProgram(RenderState::sCgMrtFragmentProgram); 653 654 sMaxDepthParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "maxDepth"); 655 sEyePosParam = cgGetNamedParameter(RenderState::sCgMrtFragmentTexProgram, "eyePos"); 656 657 cgGLSetParameter1f(sMaxDepthParam, MAX_DEPTH_CONST / farDist); 658 659 sTLParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "tl"); 660 sTRParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "tr"); 661 sBRParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "br"); 662 sBLParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "bl"); 663 } 664 else 571 new ShaderProgram(sCgContext, "src/shaders/mrt.cg", RenderState::sCgFragmentProfile, "frag"); 572 573 if (!RenderState::sCgMrtFragmentProgram->IsValid()) 665 574 cerr << "fragment program failed to load" << endl; 666 575 667 576 668 577 PrintGLerror("init"); 578 579 DeferredRenderer::InitCG(sCgContext); 580 SkyPreetham::InitCG(sCgContext); 669 581 670 582 cout << "cg initialization successful" << endl; … … 682 594 683 595 // the diffuse color buffer 684 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_ NEAREST, ColorBufferObject::FILTER_NEAREST);596 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, ColorBufferObject::FILTER_NEAREST); 685 597 // the normals buffer 686 fbo->AddColorBuffer(ColorBufferObject::RGB A_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST);598 fbo->AddColorBuffer(ColorBufferObject::RGB_FLOAT_16, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST); 687 599 // the positions buffer 688 600 //fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST); 689 601 fbo->AddColorBuffer(ColorBufferObject::RGB_UBYTE, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_NEAREST); 690 602 // another color buffer 691 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_ NEAREST, ColorBufferObject::FILTER_NEAREST);603 fbo->AddColorBuffer(ColorBufferObject::RGBA_FLOAT_32, ColorBufferObject::WRAP_CLAMP_TO_EDGE, ColorBufferObject::FILTER_LINEAR, ColorBufferObject::FILTER_NEAREST); 692 604 693 605 PrintGLerror("fbo"); … … 701 613 glGenTextures(1, &fontTex); 702 614 glBindTexture(GL_TEXTURE_2D, fontTex); 615 703 616 if (!myfont.Create("data/fonts/verdana.glf", fontTex)) 704 617 return false; … … 942 855 // store matrix for later use 943 856 viewProjMat = matViewing * matProjection; 944 945 if ((renderMethod == RENDER_DEFERRED) || (renderMethod == RENDER_DEPTH_PASS_DEFERRED))946 {947 cgGLSetMatrixParameterfc(Transform3::sModelMatrixParam, (const float *)IdentityMatrix().x);948 }949 857 } 950 858 … … 997 905 998 906 cgGLEnableProfile(RenderState::sCgVertexProfile); 999 cgGLBindProgram(sCgMrtVertexProgram);907 RenderState::sCgMrtVertexProgram->Bind(); 1000 908 1001 909 cgGLEnableProfile(RenderState::sCgFragmentProfile); 1002 cgGLBindProgram(RenderState::sCgMrtFragmentProgram);910 RenderState::sCgMrtFragmentProgram->Bind(); 1003 911 1004 912 const Vector3 pos = camera->GetPosition(); 1005 913 1006 cgGLSetParameter3f(sEyePosParam, pos.x, pos.y, pos.z);1007 cgGLSetParameter3f(sEyePosParamTex, pos.x, pos.y, pos.z);1008 1009 Vector3 tl, tr, bl, br;1010 ComputeViewVectors(tl, tr, bl, br);1011 1012 cgGLSetParameter3f(sBLParam, bl.x, bl.y, bl.z);1013 cgGLSetParameter3f(sBRParam, br.x, br.y, br.z);1014 cgGLSetParameter3f(sTLParam, tl.x, tl.y, tl.z);1015 cgGLSetParameter3f(sTRParam, tr.x, tr.y, tr.z);1016 1017 cgGLSetParameter3f(sBLParamTex, bl.x, bl.y, bl.z);1018 cgGLSetParameter3f(sBRParamTex, br.x, br.y, br.z);1019 cgGLSetParameter3f(sTLParamTex, tl.x, tl.y, tl.z);1020 cgGLSetParameter3f(sTRParamTex, tr.x, tr.y, tr.z);1021 914 1022 915 // draw to 3 color buffers … … 1075 968 1076 969 } 1077 1078 970 1079 971 // bring eye modelview matrix up-to-date … … 1192 1084 // actually render the scene geometry using the specified algorithm 1193 1085 traverser->RenderScene(); 1194 1195 buddha->Render(&state);1196 renderQueue->Apply();1197 1086 } 1198 1087 … … 1843 1732 DEL_PTR(visualization); 1844 1733 DEL_PTR(camera); 1845 DEL_PTR(loader);1846 1734 DEL_PTR(renderQueue); 1847 1735 DEL_PTR(perfGraph); 1848 1849 1736 DEL_PTR(fbo); 1850 1737 DEL_PTR(ssaoShader); 1851 1852 if (sCgMrtVertexProgram) 1853 cgDestroyProgram(sCgMrtVertexProgram); 1854 if (RenderState::sCgMrtFragmentProgram) 1855 cgDestroyProgram(RenderState::sCgMrtFragmentProgram); 1856 if (RenderState::sCgMrtFragmentTexProgram) 1857 cgDestroyProgram(RenderState::sCgMrtFragmentTexProgram); 1858 1738 DEL_PTR(light); 1739 DEL_PTR(visCamera); 1740 DEL_PTR(preetham); 1741 DEL_PTR(shadowMap); 1742 DEL_PTR(shadowTraverser); 1743 DEL_PTR(RenderState::sCgMrtFragmentProgram); 1744 DEL_PTR(RenderState::sCgMrtFragmentTexProgram); 1745 DEL_PTR(RenderState::sCgMrtVertexProgram); 1746 1747 ResourceManager::DelSingleton(); 1748 loader = NULL; 1749 1750 DeferredRenderer::ReleaseCG(); 1751 SkyPreetham::ReleaseCG(); 1752 1859 1753 if (sCgContext) 1860 1754 cgDestroyContext(sCgContext); … … 2074 1968 state.SetRenderPassType(RenderState::DEFERRED); 2075 1969 2076 const bool useToneMapping = ((renderMethod == RENDER_DEPTH_PASS_DEFERRED) || (renderMethod == RENDER_DEFERRED)) && useHDR; 1970 const bool useToneMapping = 1971 ((renderMethod == RENDER_DEPTH_PASS_DEFERRED) || 1972 (renderMethod == RENDER_DEFERRED)) && useHDR; 2077 1973 2078 1974 preetham->RenderSkyDome(-light->GetDirection(), camera, &state, !useToneMapping); … … 2138 2034 void PlaceViewer(const Vector3 &oldPos) 2139 2035 { 2036 if (!sceneQuery) 2037 sceneQuery = new SceneQuery(bvh->GetBox(), traverser); 2038 2140 2039 Vector3 playerPos = camera->GetPosition(); 2141 2040 bool validIntersect = sceneQuery->CalcIntersection(playerPos);
Note: See TracChangeset
for help on using the changeset viewer.