[2197] | 1 | //--------------------------------------------------------------------------------------
|
---|
| 2 | // File: PathMap.cpp
|
---|
| 3 | //
|
---|
| 4 | // Empty starting point for new Direct3D applications
|
---|
| 5 | //
|
---|
| 6 | // Copyright (c) Microsoft Corporation. All rights reserved.
|
---|
| 7 | //--------------------------------------------------------------------------------------
|
---|
| 8 | #include "dxstdafx.h"
|
---|
| 9 | #include "resource.h"
|
---|
| 10 | #include "PathMapEffect.h"
|
---|
| 11 | #include "Parameters.h"
|
---|
| 12 |
|
---|
| 13 | PathMapEffect* pathMapEffect = NULL;
|
---|
| 14 |
|
---|
| 15 | bool gShowUI = true;
|
---|
| 16 | CDXUTDialogResourceManager gDialogResourceManager; // manager for shared resources of dialogs
|
---|
| 17 | CD3DSettingsDlg gSettingsDlg; // Device settings dialog
|
---|
| 18 | CDXUTDialog gHUD; // Dialog for sample specific controls
|
---|
| 19 |
|
---|
| 20 | ID3DXFont* gFont = NULL; // Font for drawing text
|
---|
| 21 | ID3DXSprite* gTextSprite = NULL; // Sprite for batching draw text calls
|
---|
| 22 |
|
---|
| 23 | Parameters gParameters;
|
---|
| 24 |
|
---|
| 25 | char prmDirectory[256];
|
---|
| 26 | char meshDirectory[256];
|
---|
| 27 | char mediaDirectory[256];
|
---|
| 28 | char levelFileName[256];
|
---|
| 29 | char materialFileName[256];
|
---|
| 30 |
|
---|
| 31 | bool segmentMeshes = false;
|
---|
| 32 | bool computePRM = false;
|
---|
[2304] | 33 | bool noAtlasGen = false;
|
---|
| 34 | bool uniformSampling = false;
|
---|
[2197] | 35 |
|
---|
| 36 | unsigned int nEntryPoints = 4096;
|
---|
| 37 | unsigned int nClusters = 32;
|
---|
| 38 | unsigned int depthMapResolution = 512;
|
---|
| 39 |
|
---|
| 40 | void printUsage()
|
---|
| 41 | {
|
---|
| 42 | MessageBoxA( NULL, "pathmap.exe [s|p/v] -D <media input directory> -L <level file> -M <materials file> -O <mesh output dir> -P <prm out put dir> -E <number of entry points> -C <number of clusters> -S <shadow map resolution>", "Missing argument!", MB_OK);
|
---|
| 43 | }
|
---|
| 44 |
|
---|
| 45 | //--------------------------------------------------------------------------------------
|
---|
| 46 | // Rejects any devices that aren't acceptable by returning false
|
---|
| 47 | //--------------------------------------------------------------------------------------
|
---|
| 48 | bool CALLBACK IsDeviceAcceptable( D3DCAPS9* pCaps, D3DFORMAT AdapterFormat,
|
---|
| 49 | D3DFORMAT BackBufferFormat, bool bWindowed, void* pUserContext )
|
---|
| 50 | {
|
---|
| 51 | // Typically want to skip backbuffer formats that don't support alpha blending
|
---|
| 52 | IDirect3D9* pD3D = DXUTGetD3DObject();
|
---|
| 53 | if( FAILED( pD3D->CheckDeviceFormat( pCaps->AdapterOrdinal, pCaps->DeviceType,
|
---|
| 54 | AdapterFormat, D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING,
|
---|
| 55 | D3DRTYPE_TEXTURE, BackBufferFormat ) ) )
|
---|
| 56 | return false;
|
---|
| 57 |
|
---|
| 58 | return true;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 |
|
---|
| 62 | //--------------------------------------------------------------------------------------
|
---|
| 63 | // Before a device is created, modify the device settings as needed
|
---|
| 64 | //--------------------------------------------------------------------------------------
|
---|
| 65 | bool CALLBACK ModifyDeviceSettings( DXUTDeviceSettings* pDeviceSettings, const D3DCAPS9* pCaps, void* pUserContext )
|
---|
| 66 | {
|
---|
| 67 | pDeviceSettings->pp.Flags &= ~D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL;
|
---|
| 68 | // VSync off
|
---|
| 69 | pDeviceSettings->pp.PresentationInterval = D3DPRESENT_INTERVAL_IMMEDIATE;
|
---|
| 70 | return true;
|
---|
| 71 | }
|
---|
| 72 |
|
---|
| 73 |
|
---|
| 74 | //--------------------------------------------------------------------------------------
|
---|
| 75 | // Create any D3DPOOL_MANAGED resources here
|
---|
| 76 | //--------------------------------------------------------------------------------------
|
---|
| 77 | HRESULT CALLBACK OnCreateDevice( IDirect3DDevice9* pd3dDevice, const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
|
---|
| 78 | {
|
---|
| 79 | gDialogResourceManager.OnCreateDevice( pd3dDevice );
|
---|
| 80 | gSettingsDlg.OnCreateDevice( pd3dDevice );
|
---|
| 81 |
|
---|
| 82 | // Initialize the font
|
---|
| 83 | D3DXCreateFont( pd3dDevice, 15, 0, FW_BOLD, 1, FALSE, DEFAULT_CHARSET,
|
---|
| 84 | OUT_DEFAULT_PRECIS, DEFAULT_QUALITY, DEFAULT_PITCH | FF_DONTCARE,
|
---|
| 85 | L"Arial", &gFont );
|
---|
| 86 |
|
---|
| 87 | return S_OK;
|
---|
| 88 | }
|
---|
| 89 |
|
---|
| 90 |
|
---|
| 91 | //--------------------------------------------------------------------------------------
|
---|
| 92 | // Create any D3DPOOL_DEFAULT resources here
|
---|
| 93 | //--------------------------------------------------------------------------------------
|
---|
| 94 | HRESULT CALLBACK OnResetDevice( IDirect3DDevice9* pd3dDevice,
|
---|
| 95 | const D3DSURFACE_DESC* pBackBufferSurfaceDesc, void* pUserContext )
|
---|
| 96 | {
|
---|
| 97 | gDialogResourceManager.OnResetDevice();
|
---|
| 98 | gSettingsDlg.OnResetDevice();
|
---|
| 99 |
|
---|
| 100 | if( gFont )
|
---|
| 101 | gFont->OnResetDevice();
|
---|
| 102 |
|
---|
| 103 | // Create a sprite to help batch calls when drawing many lines of text
|
---|
| 104 | D3DXCreateSprite( pd3dDevice, &gTextSprite );
|
---|
| 105 |
|
---|
| 106 | // Position the on-screen dialog
|
---|
| 107 | gHUD.SetLocation( 0, 0 );
|
---|
| 108 | gHUD.SetSize( pBackBufferSurfaceDesc->Width, pBackBufferSurfaceDesc->Height );
|
---|
| 109 |
|
---|
| 110 | pathMapEffect = new PathMapEffect(pd3dDevice,
|
---|
| 111 | prmDirectory,
|
---|
| 112 | meshDirectory,
|
---|
| 113 | mediaDirectory,
|
---|
| 114 | levelFileName,
|
---|
| 115 | materialFileName,
|
---|
| 116 | segmentMeshes,
|
---|
| 117 | computePRM,
|
---|
[2304] | 118 | uniformSampling,
|
---|
| 119 | !noAtlasGen,
|
---|
[2197] | 120 | nEntryPoints,
|
---|
| 121 | nClusters,
|
---|
| 122 | depthMapResolution);
|
---|
| 123 | return S_OK;
|
---|
| 124 | }
|
---|
| 125 |
|
---|
| 126 |
|
---|
| 127 | //--------------------------------------------------------------------------------------
|
---|
| 128 | // Handle updates to the scene
|
---|
| 129 | //--------------------------------------------------------------------------------------
|
---|
| 130 | void CALLBACK OnFrameMove( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
|
---|
| 131 | {
|
---|
| 132 | if(pathMapEffect)
|
---|
| 133 | pathMapEffect->move(fElapsedTime);
|
---|
| 134 | }
|
---|
| 135 |
|
---|
| 136 |
|
---|
| 137 | //--------------------------------------------------------------------------------------
|
---|
| 138 | // Render the help and statistics text.
|
---|
| 139 | //--------------------------------------------------------------------------------------
|
---|
| 140 | void RenderText()
|
---|
| 141 | {
|
---|
| 142 | const D3DSURFACE_DESC* backBufferDesc = DXUTGetBackBufferSurfaceDesc();
|
---|
| 143 |
|
---|
| 144 | CDXUTTextHelper txtHelper( gFont, gTextSprite, 15 );
|
---|
| 145 | txtHelper.Begin();
|
---|
| 146 |
|
---|
| 147 | txtHelper.SetInsertionPos( 5, 5 );
|
---|
| 148 | txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) );
|
---|
| 149 |
|
---|
| 150 | if(gShowUI)
|
---|
| 151 | {
|
---|
| 152 | txtHelper.DrawFormattedTextLine( L"%.2f fps @ %i x %i",
|
---|
| 153 | DXUTGetFPS(), backBufferDesc->Width, backBufferDesc->Height );
|
---|
| 154 | txtHelper.DrawTextLine( DXUTGetFrameStats() );
|
---|
| 155 | txtHelper.DrawTextLine( DXUTGetDeviceStats() );
|
---|
| 156 |
|
---|
| 157 | txtHelper.SetInsertionPos( 5, 180 );
|
---|
| 158 | txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 1.0f, 1.0f ) );
|
---|
| 159 |
|
---|
| 160 | if(pathMapEffect)
|
---|
| 161 | {
|
---|
| 162 | txtHelper.DrawFormattedTextLine( pathMapEffect->getCurrentMethodName());
|
---|
[2304] | 163 | txtHelper.DrawFormattedTextLine( pathMapEffect->getCruiseLoop());
|
---|
[2197] | 164 | }
|
---|
| 165 |
|
---|
| 166 | }
|
---|
| 167 | txtHelper.SetForegroundColor( D3DXCOLOR( 1.0f, 1.0f, 0.0f, 1.0f ) );
|
---|
| 168 |
|
---|
| 169 | if ( gParameters.Get( bShowHelp ) )
|
---|
| 170 | {
|
---|
| 171 | txtHelper.SetInsertionPos( backBufferDesc->Width - 260, backBufferDesc->Height-24*8 );
|
---|
| 172 |
|
---|
| 173 | txtHelper.DrawTextLine(
|
---|
| 174 | L"Controls (F1 to hide):\n\n"
|
---|
| 175 | L"___________________________________\n"
|
---|
| 176 | L" GENERAL CONTROLS\n"
|
---|
| 177 | L"Left click drag: Turn camera\n"
|
---|
| 178 | L"Space: Show/Hide UI Elements\n"
|
---|
| 179 | L"___________________________________\n"
|
---|
| 180 | L"___________________________________\n"
|
---|
| 181 | L" Quit: ESC");
|
---|
| 182 | }
|
---|
| 183 | else
|
---|
| 184 | {
|
---|
| 185 | // txtHelper.DrawTextLine( L"Press F1 for help" );
|
---|
| 186 | }
|
---|
| 187 |
|
---|
| 188 | txtHelper.End();
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 | //--------------------------------------------------------------------------------------
|
---|
| 192 | // Render the scene
|
---|
| 193 | //--------------------------------------------------------------------------------------
|
---|
| 194 | void CALLBACK OnFrameRender( IDirect3DDevice9* pd3dDevice, double fTime, float fElapsedTime, void* pUserContext )
|
---|
| 195 | {
|
---|
| 196 | HRESULT hr;
|
---|
| 197 |
|
---|
| 198 | pathMapEffect->render();
|
---|
| 199 | pd3dDevice->BeginScene();
|
---|
| 200 | RenderText();
|
---|
| 201 | if(gShowUI)
|
---|
| 202 | gHUD.OnRender( fElapsedTime );
|
---|
| 203 | pd3dDevice->EndScene();}
|
---|
| 204 |
|
---|
| 205 |
|
---|
| 206 | //--------------------------------------------------------------------------------------
|
---|
| 207 | // Handle messages to the application
|
---|
| 208 | //--------------------------------------------------------------------------------------
|
---|
| 209 | LRESULT CALLBACK MsgProc( HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam,
|
---|
| 210 | bool* pbNoFurtherProcessing, void* pUserContext )
|
---|
| 211 | {
|
---|
| 212 | *pbNoFurtherProcessing = gDialogResourceManager.MsgProc( hWnd, uMsg, wParam, lParam );
|
---|
| 213 | if( *pbNoFurtherProcessing )
|
---|
| 214 | return 0;
|
---|
| 215 |
|
---|
| 216 | if( gSettingsDlg.IsActive() )
|
---|
| 217 | {
|
---|
| 218 | gSettingsDlg.MsgProc( hWnd, uMsg, wParam, lParam );
|
---|
| 219 | return 0;
|
---|
| 220 | }
|
---|
| 221 |
|
---|
| 222 | // Give the dialogs a chance to handle the message first
|
---|
| 223 | *pbNoFurtherProcessing = gHUD.MsgProc( hWnd, uMsg, wParam, lParam );
|
---|
| 224 | if( *pbNoFurtherProcessing )
|
---|
| 225 | return 0;
|
---|
| 226 |
|
---|
| 227 | if(pathMapEffect)
|
---|
| 228 | pathMapEffect->handleMessage(hWnd, uMsg, wParam, lParam);
|
---|
| 229 |
|
---|
| 230 |
|
---|
| 231 | return 0;
|
---|
| 232 | }
|
---|
| 233 |
|
---|
| 234 |
|
---|
| 235 | void CALLBACK KeyboardProc( UINT nChar, bool bKeyDown, bool bAltDown, void* pUserContext )
|
---|
| 236 | {
|
---|
| 237 | if( bKeyDown )
|
---|
| 238 | {
|
---|
| 239 | switch(nChar)
|
---|
| 240 | {
|
---|
| 241 | case VK_SPACE:
|
---|
| 242 | gShowUI=!gShowUI;
|
---|
| 243 | break;
|
---|
| 244 | case VK_TAB:
|
---|
| 245 | if(pathMapEffect)
|
---|
| 246 | pathMapEffect->nextMethod();
|
---|
| 247 | break;
|
---|
| 248 | case '0':
|
---|
| 249 | if(pathMapEffect)
|
---|
| 250 | pathMapEffect->prevMethod();
|
---|
| 251 | break;
|
---|
| 252 | case VK_DOWN:
|
---|
| 253 | break;
|
---|
| 254 | case VK_UP:
|
---|
| 255 | break;
|
---|
| 256 | case VK_LEFT:
|
---|
| 257 | break;
|
---|
| 258 | case VK_RIGHT:
|
---|
| 259 | break;
|
---|
| 260 | case VK_DELETE:
|
---|
| 261 | break;
|
---|
| 262 | case VK_END:
|
---|
| 263 | break;
|
---|
| 264 | default:
|
---|
| 265 | break;
|
---|
| 266 | }
|
---|
| 267 | }
|
---|
| 268 | }
|
---|
| 269 |
|
---|
| 270 | void CALLBACK OnGUIEvent( UINT nEvent, int nControlID, CDXUTControl* pControl, void* pUserContext )
|
---|
| 271 | {
|
---|
| 272 | gParameters.UpdateFromHUD( nControlID );
|
---|
| 273 | if(nControlID == IDC_GEN_BUTTON)
|
---|
| 274 | {
|
---|
| 275 | LPDIRECT3DDEVICE9 dev = pathMapEffect->getDevice();
|
---|
| 276 | delete pathMapEffect;
|
---|
| 277 | pathMapEffect = new PathMapEffect(dev,
|
---|
| 278 | prmDirectory,
|
---|
| 279 | meshDirectory,
|
---|
| 280 | mediaDirectory,
|
---|
| 281 | levelFileName,
|
---|
| 282 | materialFileName,
|
---|
| 283 | segmentMeshes,
|
---|
| 284 | computePRM,
|
---|
[2304] | 285 | uniformSampling,
|
---|
| 286 | !noAtlasGen,
|
---|
[2197] | 287 | nEntryPoints,
|
---|
| 288 | nClusters,
|
---|
| 289 | depthMapResolution);
|
---|
| 290 | }
|
---|
| 291 | }
|
---|
| 292 |
|
---|
| 293 | void OnLoad()
|
---|
| 294 | {
|
---|
| 295 | }
|
---|
| 296 |
|
---|
| 297 | void OnSave()
|
---|
| 298 | {
|
---|
| 299 | }
|
---|
| 300 |
|
---|
| 301 | void OnReset()
|
---|
| 302 | {
|
---|
| 303 | }
|
---|
| 304 |
|
---|
| 305 | //--------------------------------------------------------------------------------------
|
---|
| 306 | // Release resources created in the OnResetDevice callback here
|
---|
| 307 | //--------------------------------------------------------------------------------------
|
---|
| 308 | void CALLBACK OnLostDevice( void* pUserContext )
|
---|
| 309 | {
|
---|
| 310 | gDialogResourceManager.OnLostDevice();
|
---|
| 311 | gSettingsDlg.OnLostDevice();
|
---|
| 312 |
|
---|
| 313 | if( gFont )
|
---|
| 314 | gFont->OnLostDevice();
|
---|
| 315 |
|
---|
| 316 | gTextSprite->Release();
|
---|
| 317 |
|
---|
| 318 | delete pathMapEffect;
|
---|
| 319 | pathMapEffect = NULL;
|
---|
| 320 | }
|
---|
| 321 |
|
---|
| 322 |
|
---|
| 323 | //--------------------------------------------------------------------------------------
|
---|
| 324 | // Release resources created in the OnCreateDevice callback here
|
---|
| 325 | //--------------------------------------------------------------------------------------
|
---|
| 326 | void CALLBACK OnDestroyDevice( void* pUserContext )
|
---|
| 327 | {
|
---|
| 328 | gDialogResourceManager.OnDestroyDevice();
|
---|
| 329 | gSettingsDlg.OnDestroyDevice();
|
---|
| 330 |
|
---|
| 331 | gFont->Release();
|
---|
| 332 |
|
---|
| 333 | }
|
---|
| 334 |
|
---|
| 335 |
|
---|
| 336 |
|
---|
| 337 | //--------------------------------------------------------------------------------------
|
---|
| 338 | // Initialize everything and go into a render loop
|
---|
| 339 | //--------------------------------------------------------------------------------------
|
---|
| 340 | INT WINAPI WinMain( HINSTANCE, HINSTANCE, LPSTR commandLine, int )
|
---|
| 341 | {
|
---|
| 342 | // Enable run-time memory check for debug builds.
|
---|
| 343 | #if defined(DEBUG) | defined(_DEBUG)
|
---|
| 344 | _CrtSetDbgFlag( _CRTDBG_ALLOC_MEM_DF | _CRTDBG_LEAK_CHECK_DF );
|
---|
| 345 | #endif
|
---|
| 346 |
|
---|
| 347 | // Set the callback functions
|
---|
| 348 | DXUTSetCallbackDeviceCreated( OnCreateDevice );
|
---|
| 349 | DXUTSetCallbackDeviceReset( OnResetDevice );
|
---|
| 350 | DXUTSetCallbackDeviceLost( OnLostDevice );
|
---|
| 351 | DXUTSetCallbackDeviceDestroyed( OnDestroyDevice );
|
---|
| 352 | DXUTSetCallbackMsgProc( MsgProc );
|
---|
| 353 | DXUTSetCallbackFrameRender( OnFrameRender );
|
---|
| 354 | DXUTSetCallbackFrameMove( OnFrameMove );
|
---|
| 355 | DXUTSetCallbackKeyboard( KeyboardProc );
|
---|
| 356 |
|
---|
| 357 | // TODO: Perform any application-level initialization here
|
---|
| 358 |
|
---|
| 359 | gSettingsDlg.Init( &gDialogResourceManager );
|
---|
| 360 | gHUD.Init( &gDialogResourceManager );
|
---|
| 361 | gHUD.SetCallback( OnGUIEvent ); // Event handling
|
---|
| 362 |
|
---|
| 363 | gParameters.Setup( &gHUD, OnReset, OnSave, OnLoad); // you can add callbacks to these actions
|
---|
| 364 |
|
---|
| 365 | gParameters.Add( bShowHelp, "Show Help", VK_F1 );
|
---|
| 366 |
|
---|
| 367 | PathMapEffect::addUiParameters(&gParameters);
|
---|
| 368 |
|
---|
| 369 | gParameters.UpdateFromHUD( IDC_RESET_BUTTON ); // do a reset
|
---|
| 370 |
|
---|
| 371 | PathMapEffect::setUiParameterDefaults(&gParameters);
|
---|
| 372 |
|
---|
| 373 | std::cerr << commandLine;
|
---|
| 374 |
|
---|
| 375 | if(commandLine[0] == 's' || commandLine[1] == 's')
|
---|
| 376 | segmentMeshes = true;
|
---|
| 377 | else
|
---|
| 378 | segmentMeshes = false;
|
---|
| 379 |
|
---|
| 380 | if(commandLine[0] == 'p' || commandLine[1] == 'p')
|
---|
| 381 | computePRM = true;
|
---|
| 382 | else
|
---|
| 383 | computePRM = false;
|
---|
| 384 |
|
---|
| 385 | strcpy(mediaDirectory, "media");
|
---|
| 386 | strcpy(prmDirectory, "prm");
|
---|
| 387 | strcpy(meshDirectory, "processedMeshes");
|
---|
[2212] | 388 | strcpy(levelFileName, "space.level");
|
---|
| 389 | strcpy(materialFileName, "space.materials");
|
---|
| 390 | nClusters = 64;
|
---|
| 391 | nEntryPoints = 4096;
|
---|
| 392 | depthMapResolution = 512;
|
---|
[2197] | 393 |
|
---|
| 394 | char* toki;
|
---|
| 395 | toki = strtok(commandLine, " ");
|
---|
| 396 | while(toki)
|
---|
| 397 | {
|
---|
| 398 | if(toki[0] == '-')
|
---|
| 399 | {
|
---|
| 400 | switch(toki[1])
|
---|
| 401 | {
|
---|
[2304] | 402 | case 'A' :
|
---|
| 403 | noAtlasGen = true;
|
---|
| 404 | break;
|
---|
| 405 | case 'U' :
|
---|
| 406 | uniformSampling = true;
|
---|
| 407 | break;
|
---|
[2197] | 408 | case 'D' :
|
---|
| 409 | toki = strtok(NULL, " ");
|
---|
| 410 | if(toki == NULL)
|
---|
| 411 | printUsage();
|
---|
| 412 | strcpy(mediaDirectory, toki);
|
---|
| 413 | break;
|
---|
| 414 | case 'P' :
|
---|
| 415 | toki = strtok(NULL, " ");
|
---|
| 416 | if(toki == NULL)
|
---|
| 417 | printUsage();
|
---|
| 418 | strcpy(prmDirectory, toki);
|
---|
| 419 | break;
|
---|
| 420 | case 'O' :
|
---|
| 421 | toki = strtok(NULL, " ");
|
---|
| 422 | if(toki == NULL)
|
---|
| 423 | printUsage();
|
---|
| 424 | strcpy(meshDirectory, toki);
|
---|
| 425 | break;
|
---|
| 426 | case 'L' :
|
---|
| 427 | toki = strtok(NULL, " ");
|
---|
| 428 | if(toki == NULL)
|
---|
| 429 | printUsage();
|
---|
| 430 | strcpy(levelFileName, toki);
|
---|
| 431 | break;
|
---|
| 432 | case 'M' :
|
---|
| 433 | toki = strtok(NULL, " ");
|
---|
| 434 | if(toki == NULL)
|
---|
| 435 | printUsage();
|
---|
| 436 | strcpy(materialFileName, toki);
|
---|
| 437 | break;
|
---|
| 438 | case 'E' :
|
---|
| 439 | toki = strtok(NULL, " ");
|
---|
| 440 | if(toki == NULL)
|
---|
| 441 | printUsage();
|
---|
| 442 | nEntryPoints = atoi(toki);
|
---|
| 443 | break;
|
---|
| 444 | case 'C' :
|
---|
| 445 | toki = strtok(NULL, " ");
|
---|
| 446 | if(toki == NULL)
|
---|
| 447 | printUsage();
|
---|
| 448 | nClusters = atoi(toki);
|
---|
| 449 | break;
|
---|
| 450 | case 'S' :
|
---|
| 451 | toki = strtok(NULL, " ");
|
---|
| 452 | if(toki == NULL)
|
---|
| 453 | printUsage();
|
---|
| 454 | depthMapResolution = atoi(toki);
|
---|
| 455 | break;
|
---|
| 456 | default:
|
---|
| 457 | printUsage();
|
---|
| 458 | }
|
---|
| 459 | }
|
---|
| 460 | toki = strtok(NULL, " ");
|
---|
| 461 | }
|
---|
| 462 |
|
---|
| 463 | // Initialize DXUT and create the desired Win32 window and Direct3D device for the application
|
---|
| 464 | DXUTInit( true, true, true ); // Parse the command line, handle the default hotkeys, and show msgboxes
|
---|
| 465 | DXUTSetCursorSettings( true, true ); // Show the cursor and clip it when in full screen
|
---|
| 466 | DXUTCreateWindow( L"PathMap" );
|
---|
| 467 | DXUTCreateDevice( D3DADAPTER_DEFAULT, true, 640, 480, IsDeviceAcceptable, ModifyDeviceSettings );
|
---|
| 468 |
|
---|
| 469 | // Start the render loop
|
---|
| 470 | DXUTMainLoop();
|
---|
| 471 |
|
---|
| 472 | // TODO: Perform any application-level cleanup here
|
---|
| 473 |
|
---|
| 474 | return DXUTGetExitCode();
|
---|
| 475 | }
|
---|
| 476 |
|
---|
| 477 |
|
---|