reconstruct setter complete

ink-soul 2024-04-01 13:45:00 +08:00
parent 09ce004149
commit fba7cd0bae
370 changed files with 272 additions and 188 deletions

View File

@ -6,7 +6,7 @@ set(NAME PlumageRender)
project(${NAME})
include_directories(external)
include_directories(external/glfw-3.4)
include_directories(external/glfw-3.4/include)
include_directories(external/glm)
include_directories(external/gli)
include_directories(external/imgui)

View File

@ -36,7 +36,7 @@ VKAPI_ATTR VkBool32 VKAPI_CALL debugMessageCallback(VkDebugReportFlagsEXT flags,
VkResult VulkanExampleBase::createInstance(bool enableValidation)
{
this->settings.validation = enableValidation;
setter.settings.validation = enableValidation;
// Validation can also be forced via a define
#if defined(_VALIDATION)
@ -334,7 +334,7 @@ void VulkanExampleBase::renderFrame()
void VulkanExampleBase::renderLoop()
{
destWidth = width;
destWidth = settings.width;
destHeight = height;
#if defined(_WIN32)
MSG msg;
@ -500,28 +500,7 @@ void VulkanExampleBase::renderLoop()
VulkanExampleBase::VulkanExampleBase()
{
char* numConvPtr;
// Parse command line arguments
for (size_t i = 0; i < args.size(); i++)
{
if (args[i] == std::string("-validation")) {
settings.validation = true;
}
if (args[i] == std::string("-vsync")) {
settings.vsync = true;
}
if ((args[i] == std::string("-f")) || (args[i] == std::string("--fullscreen"))) {
settings.fullscreen = true;
}
if ((args[i] == std::string("-w")) || (args[i] == std::string("--width"))) {
uint32_t w = strtol(args[i + 1], &numConvPtr, 10);
if (numConvPtr != args[i + 1]) { width = w; };
}
if ((args[i] == std::string("-h")) || (args[i] == std::string("--height"))) {
uint32_t h = strtol(args[i + 1], &numConvPtr, 10);
if (numConvPtr != args[i + 1]) { height = h; };
}
}
#if defined(VK_USE_PLATFORM_ANDROID_KHR)
// Vulkan library is loaded dynamically on Android
@ -636,24 +615,6 @@ void VulkanExampleBase::initVulkan()
exit(err);
}
uint32_t selectedDevice = 0;
#if !defined(VK_USE_PLATFORM_ANDROID_KHR)
for (size_t i = 0; i < args.size(); i++) {
if ((args[i] == std::string("-g")) || (args[i] == std::string("--gpu"))) {
char* endptr;
selectedPhysicalDeviceIndex = strtol(args[i + 1], &endptr, 10);
if (endptr != args[i + 1]) {
if (selectedPhysicalDeviceIndex > gpuCount - 1) {
std::cerr << "Selected device index " << selectedPhysicalDeviceIndex << " is out of range, reverting to device 0 (use -listgpus to show available Vulkan devices)" << std::endl;
} else {
std::cout << "Selected Vulkan device " << selectedPhysicalDeviceIndex << std::endl;
selectedDevice = selectedPhysicalDeviceIndex;
}
};
break;
}
}
#endif
physicalDevice = physicalDevices[selectedDevice];
vkGetPhysicalDeviceProperties(physicalDevice, &deviceProperties);

View File

@ -101,7 +101,7 @@ protected:
std::string name = "vulkanExample";
void windowResize();
public:
static std::vector<const char*> args;
uint32_t selectedPhysicalDeviceIndex = 0;
bool prepared = false;
float frameTimer = 1.0f;

View File

Before

Width:  |  Height:  |  Size: 676 B

After

Width:  |  Height:  |  Size: 676 B

View File

Before

Width:  |  Height:  |  Size: 635 B

After

Width:  |  Height:  |  Size: 635 B

View File

Before

Width:  |  Height:  |  Size: 132 B

After

Width:  |  Height:  |  Size: 132 B

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.5 KiB

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 1.9 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.1 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

Some files were not shown because too many files have changed in this diff Show More