update UI for file open dialog (BROKEN!)
							parent
							
								
									88660a8f35
								
							
						
					
					
						commit
						e5d0cb92cf
					
				| 
						 | 
				
			
			@ -3,10 +3,15 @@
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
// win32 api IFileOpenDialog
 | 
			
		||||
PWSTR GUIFunction::openFileFolderDialog(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
// TO DO: rewrite this function to bool and get file path through public value
 | 
			
		||||
bool  GUIFunction::openFileFolderDialog()
 | 
			
		||||
{
 | 
			
		||||
	//initialize COM lib
 | 
			
		||||
    
 | 
			
		||||
	HRESULT hResult = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
 | 
			
		||||
    
 | 
			
		||||
    if (SUCCEEDED(hResult))
 | 
			
		||||
    {
 | 
			
		||||
        IFileOpenDialog* pFileOpen = nullptr;
 | 
			
		||||
| 
						 | 
				
			
			@ -27,21 +32,25 @@ PWSTR GUIFunction::openFileFolderDialog(HINSTANCE hInstance, HINSTANCE, PWSTR pC
 | 
			
		|||
                {
 | 
			
		||||
                    PWSTR pszFilePath;
 | 
			
		||||
                    hResult = pItem->GetDisplayName(SIGDN_FILESYSPATH, &pszFilePath);
 | 
			
		||||
                    
 | 
			
		||||
                    filePath = pszFilePath;
 | 
			
		||||
                    // Display the file name to the user.
 | 
			
		||||
                    if (SUCCEEDED(hResult))
 | 
			
		||||
                    {
 | 
			
		||||
                        MessageBoxW(NULL, pszFilePath, L"File Path", MB_OK);
 | 
			
		||||
                        CoTaskMemFree(pszFilePath);
 | 
			
		||||
                        stringFilePath == pszFilePath;
 | 
			
		||||
                        
 | 
			
		||||
                    }
 | 
			
		||||
                    pItem->Release();
 | 
			
		||||
                }
 | 
			
		||||
                return true;
 | 
			
		||||
            }
 | 
			
		||||
            pFileOpen->Release();
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
        
 | 
			
		||||
        CoUninitialize();
 | 
			
		||||
        return false;
 | 
			
		||||
    }
 | 
			
		||||
    return stringFilePath;
 | 
			
		||||
    return false;
 | 
			
		||||
    
 | 
			
		||||
};
 | 
			
		||||
| 
						 | 
				
			
			@ -8,20 +8,16 @@
 | 
			
		|||
class GUIFunction
 | 
			
		||||
{
 | 
			
		||||
public:
 | 
			
		||||
	GUIFunction();
 | 
			
		||||
	~GUIFunction();
 | 
			
		||||
 | 
			
		||||
	PWSTR openFileFolderDialog(HINSTANCE hInstance, HINSTANCE, PWSTR pCmdLine, int nCmdShow);
 | 
			
		||||
	PWSTR filePath;
 | 
			
		||||
 | 
			
		||||
	
 | 
			
		||||
 | 
			
		||||
	bool openFileFolderDialog();
 | 
			
		||||
	private:
 | 
			
		||||
		PWSTR stringFilePath;
 | 
			
		||||
		
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
GUIFunction::GUIFunction()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
GUIFunction::~GUIFunction()
 | 
			
		||||
{
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1,4 +1,3 @@
 | 
			
		|||
#pragma once
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
* Vulkan Example - glTF scene loading and rendering
 | 
			
		||||
| 
						 | 
				
			
			@ -31,6 +30,7 @@
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
#include "render.h"
 | 
			
		||||
#include "GUIFunction.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -1287,7 +1287,7 @@
 | 
			
		|||
 | 
			
		||||
	auto tEnd = std::chrono::high_resolution_clock::now();
 | 
			
		||||
	auto tDiff = std::chrono::duration<double, std::milli>(tEnd - tStart).count();
 | 
			
		||||
	std::cout << "Generating pre-filtered enivornment cube with " << numMips << " mip levels took " << tDiff << " ms" << std::endl;
 | 
			
		||||
	std::cout << "Generating pre-filtered environment cube with " << numMips << " mip levels took " << tDiff << " ms" << std::endl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
	void VulkanExample::GenerateBRDFLUT()
 | 
			
		||||
| 
						 | 
				
			
			@ -1382,7 +1382,7 @@
 | 
			
		|||
		dependencies[1].dstAccessMask = VK_ACCESS_MEMORY_READ_BIT;
 | 
			
		||||
		dependencies[1].dependencyFlags = VK_DEPENDENCY_BY_REGION_BIT;
 | 
			
		||||
 | 
			
		||||
		// Create the actual renderpass
 | 
			
		||||
		// Create the actual render pass
 | 
			
		||||
		VkRenderPassCreateInfo renderPassCI = vks::initializers::renderPassCreateInfo();
 | 
			
		||||
		renderPassCI.attachmentCount = 1;
 | 
			
		||||
		renderPassCI.pAttachments = &attDesc;
 | 
			
		||||
| 
						 | 
				
			
			@ -1650,6 +1650,22 @@
 | 
			
		|||
		{
 | 
			
		||||
			overlay->checkBox("Pause", &paused);
 | 
			
		||||
		}
 | 
			
		||||
		if (overlay->header("file"))
 | 
			
		||||
		{
 | 
			
		||||
			if (overlay->button("select model")) 
 | 
			
		||||
			{
 | 
			
		||||
				GUIFunction guiFunc{};
 | 
			
		||||
 | 
			
		||||
				if (guiFunc.openFileFolderDialog())
 | 
			
		||||
				{
 | 
			
		||||
					std::cout << guiFunc.filePath << std::endl;
 | 
			
		||||
				}
 | 
			
		||||
				else
 | 
			
		||||
				{
 | 
			
		||||
					std::cerr << "file select error" << std::endl;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -27,6 +27,7 @@
 | 
			
		|||
#include "vulkanexamplebase.h"
 | 
			
		||||
#include "glTFModel.h"
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
#define ENABLE_VALIDATION false
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue