MCPcopy Create free account
hub / github.com/assimp/assimp / LoadSkybox

Function LoadSkybox

tools/assimp_view/MessageProc.cpp:503–540  ·  view source on GitHub ↗

------------------------------------------------------------------------------- Display the OpenFile dialog and let the user choose a new slybox as bg -------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

501// Display the OpenFile dialog and let the user choose a new slybox as bg
502//-------------------------------------------------------------------------------
503void LoadSkybox() {
504 char szFileName[MAX_PATH];
505
506 DWORD dwTemp = MAX_PATH;
507 if(ERROR_SUCCESS != RegQueryValueEx(g_hRegistry,"SkyBoxSrc",nullptr,nullptr,
508 (BYTE*)szFileName,&dwTemp))
509 {
510 // Key was not found. Use C:
511 strcpy(szFileName,"");
512 }
513 else
514 {
515 // need to remove the file name
516 char* sz = strrchr(szFileName,'\\');
517 if (!sz)
518 sz = strrchr(szFileName,'/');
519 if (sz)
520 *sz = 0;
521 }
522 OPENFILENAME sFilename1 = {
523 sizeof(OPENFILENAME),
524 g_hDlg,GetModuleHandle(nullptr),
525 "Skyboxes\0*.dds\0*.*\0", nullptr, 0, 1,
526 szFileName, MAX_PATH, nullptr, 0, nullptr,
527 "Open skybox as background",
528 OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY | OFN_NOCHANGEDIR,
529 0, 1, ".dds", 0, nullptr, nullptr
530 };
531 if(GetOpenFileName(&sFilename1) == 0) return;
532
533 // Now store the file in the registry
534 RegSetValueExA(g_hRegistry,"SkyBoxSrc",0,REG_SZ,(const BYTE*)szFileName,MAX_PATH);
535 RegSetValueExA(g_hRegistry,"LastSkyBoxSrc",0,REG_SZ,(const BYTE*)szFileName,MAX_PATH);
536 RegSetValueExA(g_hRegistry,"LastTextureSrc",0,REG_SZ,(const BYTE*)"",MAX_PATH);
537
538 CBackgroundPainter::Instance().SetCubeMapBG(szFileName);
539 return;
540}
541
542template<class T>
543inline

Callers 1

MessageProcFunction · 0.85

Calls 2

InstanceClass · 0.85
SetCubeMapBGMethod · 0.80

Tested by

no test coverage detected