From f36ec52f4ab1c6ae43bd7d761f1f1144e71e6c14 Mon Sep 17 00:00:00 2001 From: Xiang Silian Date: Mon, 22 Sep 2025 15:16:40 +0800 Subject: [PATCH] =?UTF-8?q?=E7=94=BB=E5=9B=BE=EF=BC=8C=E7=94=BB=E7=82=B9?= =?UTF-8?q?=EF=BC=8C=E7=94=BB=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/texture_loading/texture_loading.cpp | 36 +++++++++---------- 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/samples/api/texture_loading/texture_loading.cpp b/samples/api/texture_loading/texture_loading.cpp index f23787b..fab1ee0 100644 --- a/samples/api/texture_loading/texture_loading.cpp +++ b/samples/api/texture_loading/texture_loading.cpp @@ -175,10 +175,10 @@ std::vector generateSimpleTestImage(int width, int height, int cell_wid const uint8_t* color = cellColors[gridY][gridX].data(); int index = (y * width + x) * 4; - imageData[index] = color[0]/10; - imageData[index + 1] = color[1]/10; - imageData[index + 2] = color[2]/10; - imageData[index + 3] = color[3]/10; + imageData[index] = color[0]/5; + imageData[index + 1] = color[1]/3; + imageData[index + 2] = color[2]/3; + imageData[index + 3] = color[3]/3; } } } @@ -1378,20 +1378,18 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options) size_t dataSize = testImage.size(); processWithVulkan(testImage.data(), width, height, rowStride, dataSize, texture_point); - //width = 256; - //height = 256; - //rowStride = width * 4; - //auto arrowImage = generateSimpleTestImage(width, height, 80); - //dataSize = arrowImage.size(); - //processWithVulkan(arrowImage.data(), width, height, rowStride, dataSize, texture_point); + width = 640; + height = 480; + rowStride = width * 4; + auto arrowImage = generateSimpleTestImage(width, height, 80); + dataSize = arrowImage.size(); + processWithVulkan(arrowImage.data(), width, height, rowStride, dataSize, cam_text); - const char* filename = "face.png"; - std::vector image; // 存储RGB数据 - unsigned w, h; - - // 解码PNG文件 - unsigned error = lodepng::decode(image, w, h, filename, LCT_RGBA, 8); - processWithVulkan(image.data(), w, h, w*4, image.size(), cam_text); + //const char* filename = "face.png"; + //std::vector image; + //unsigned w, h; + //unsigned error = lodepng::decode(image, w, h, filename, LCT_RGBA, 8); + //processWithVulkan(image.data(), w, h, w*4, image.size(), cam_text); width = 256; height = 256; @@ -1442,8 +1440,8 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options) { nlohmann::json p = rawPoint[i]; int index = p["id"]; - pos[pos_id++] = p["x"]/480; - pos[pos_id++] = p["y"] / 480; + pos[pos_id++] = p["x"]/480.f; + pos[pos_id++] = p["y"] / 480.f; pos[pos_id++] = p["z"]; } update_point_vertex_buffer(pos, rawPoint.size());