Changeset 3019 for GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
- Timestamp:
- 10/09/08 18:36:03 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/App/Demos/Vis/FriendlyCulling/src/chcdemo.cpp
r3018 r3019 1 1 // chcdemo.cpp : Defines the entry point for the console application. 2 2 // 3 #include "glInterface.h" 3 4 #ifdef _CRT_SET 5 #define _CRTDBG_MAP_ALLOC 6 #include <stdlib.h> 7 #include <crtdbg.h> 8 #endif 9 10 #include "common.h" 11 12 #ifdef _CRT_SET 13 // redefine new operator 14 #define DEBUG_NEW new(_NORMAL_BLOCK, __FILE__, __LINE__) 15 #define new DEBUG_NEW 16 #endif 17 18 4 19 #include <math.h> 5 20 #include <time.h> 6 #include "common.h" 21 #include "glInterface.h" 22 23 #include <Cg/cg.h> 24 #include <Cg/cgGL.h> 25 26 7 27 #include "RenderTraverser.h" 8 28 #include "SceneEntity.h" … … 40 60 #include "EntityMerger.h" 41 61 42 #include <Cg/cg.h>43 #include <Cg/cgGL.h>44 45 46 62 using namespace std; 47 63 using namespace CHCDemoEngine; … … 59 75 /// the renderable scene geometry 60 76 SceneEntityContainer sceneEntities; 61 SceneEntityContainer sceneEntities2;62 77 63 78 // traverses and renders the hierarchy … … 255 270 inline float KeyRotationAngle() { return keyRotation * elapsedTime * 1e-3f; } 256 271 inline float KeyShift() { return keyForwardMotion * elapsedTime * 1e-3f; } 257 272 // initialise the frame buffer objects 258 273 void InitFBO(); 259 274 … … 309 324 int main(int argc, char* argv[]) 310 325 { 326 #ifdef _CRT_SET 327 328 //Now just call this function at the start of your program and if you're 329 //compiling in debug mode (F5), any leaks will be displayed in the Output 330 //window when the program shuts down. If you're not in debug mode this will 331 //be ignored. Use it as you will! 332 //note: from GDNet Direct [3.8.04 - 3.14.04] void detectMemoryLeaks() { 333 334 _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF); 335 _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); 336 _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR); 337 #endif 338 339 cout << "=== reading environment file ===" << endl << endl; 340 311 341 int returnCode = 0; 312 342 … … 317 347 cout << "=== reading environment file ===" << endl << endl; 318 348 319 string envFileName = "default.env";349 const string envFileName = "default.env"; 320 350 if (!env.Read(envFileName)) 321 351 { … … 347 377 //env.GetStringParam(string("modelPath"), model_path); 348 378 //env.GetIntParam(string("numSssaoSamples"), numSsaoSamples); 349 350 379 351 380 cout << "assumedVisibleFrames: " << assumedVisibleFrames << endl; … … 395 424 SceneEntity::SetUseLODs(useLODs); 396 425 397 398 426 if (!useFullScreen) 399 427 { … … 420 448 InitGLstate(); 421 449 422 423 450 glEnable(GL_MULTISAMPLE_ARB); 424 451 glHint(GL_MULTISAMPLE_FILTER_HINT_NV, GL_NICEST); … … 432 459 433 460 const string filename = string(model_path + "city.dem"); 461 434 462 435 463 if (loader->Load(filename, sceneEntities)) … … 441 469 exit(0); 442 470 } 471 443 472 444 473 const string bvh_filename = string(model_path + "city.bvh"); … … 452 481 exit(0); 453 482 } 454 455 483 456 484 // set far plane based on scene extent … … 468 496 469 497 Matrix4x4 transl = TranslationMatrix(cubeCenter); 470 471 498 472 499 SceneEntityContainer dummy; … … 474 501 string skyDomeStr(model_path + "sky.dem"); 475 502 476 if (loader->Load(skyDomeStr, dummy))477 cout << "successfully loaded " << dummy.size() << " scene entities" << endl;503 if (loader->Load(skyDomeStr, sceneEntities)) 504 cout << "successfully loaded " << sceneEntities.size() << " scene entities" << endl; 478 505 else 479 506 { … … 484 511 } 485 512 486 skyDome = dummy[0];513 skyDome = sceneEntities.back(); 487 514 488 515 … … 506 533 // clean up 507 534 CleanUp(); 508 535 509 536 return 0; 510 537 } … … 572 599 cgGLLoadProgram(RenderState::sCgMrtFragmentProgram); 573 600 574 sEyePosParam = cgGetNamedParameter(RenderState::sCgMrtFragment TexProgram, "eyePos");601 sEyePosParam = cgGetNamedParameter(RenderState::sCgMrtFragmentProgram, "eyePos"); 575 602 } 576 603 else … … 613 640 glGenTextures(1, &fontTex); 614 641 glBindTexture(GL_TEXTURE_2D, fontTex); 642 615 643 if (!myfont.Create("data/fonts/verdana.glf", fontTex)) 616 644 return false; … … 1747 1775 DEL_PTR(ssaoShader); 1748 1776 1777 DEL_PTR(light); 1778 DEL_PTR(visCamera); 1779 1780 DEL_PTR(preetham); 1781 1749 1782 if (sCgMrtVertexProgram) 1750 1783 cgDestroyProgram(sCgMrtVertexProgram);
Note: See TracChangeset
for help on using the changeset viewer.