save code

This commit is contained in:
xsl
2025-10-26 00:13:08 +08:00
parent 41a659bd6d
commit b2da84f903
66 changed files with 24834 additions and 78 deletions
+14 -2
View File
@@ -20,7 +20,7 @@ void Application::initWindow()
glfwWindowHint(GLFW_CLIENT_API, GLFW_NO_API);
glfwWindowHint(GLFW_RESIZABLE, GLFW_FALSE);
window = glfwCreateWindow(480, 480, "Vulkan", nullptr, nullptr);
window = glfwCreateWindow(480*2, 480*2, "Vulkan", nullptr, nullptr);
#else
#endif
@@ -68,6 +68,7 @@ void Application::initVulkan()
createCommandPool(); // 创建命令池
createCommandBuffer(); // 创建命令缓冲区
createSyncObjects(); // 创建同步对象
_lastDrawFrameTime = getCurrentTimeMillis();
inited = true;
}
@@ -560,6 +561,7 @@ void Application::drawFrame()
// 8. 前进到下一帧
currentFrame = (currentFrame + 1) % MAX_FRAMES_IN_FLIGHT;
_lastDrawFrameTime =
}
void DestroyDebugUtilsMessengerEXT(VkInstance instance, VkDebugUtilsMessengerEXT debugMessenger, const VkAllocationCallbacks* pAllocator) {
@@ -628,7 +630,17 @@ uint32_t Application::findMemoryType(VkPhysicalDevice physicalDevice, uint32_t t
Texture Application::loadTexture(std::string path, Texture& tex, bool srgb)
{
std::vector<unsigned char> data = readFileEx(path);
std::vector<unsigned char> data = readFileUnsignedChar(path, false);
std::vector<unsigned char> image;
unsigned w, h;
unsigned error = lodepng::decode(image, w, h, data, LCT_RGBA, 8);
processWithVulkan(image.data(), w, h, w * 4, image.size(), tex, srgb);
return tex;
}
Texture Application::loadTextureExample(std::string path, Texture& tex, bool srgb)
{
std::vector<unsigned char> data = readFileUnsignedChar(path, true);
std::vector<unsigned char> image;
unsigned w, h;
unsigned error = lodepng::decode(image, w, h, data, LCT_RGBA, 8);