android 设备上跑通透明

This commit is contained in:
xsl
2025-09-26 21:52:54 +08:00
parent 326593eb4f
commit dfb973bed0
+16 -11
View File
@@ -1,12 +1,12 @@
#include "texture_loading.h"
#include "lodepng.cpp"
#ifdef _WIN32
#include <nlohmann/json.hpp>
#include <iostream>
#include <fstream>
#include <string>
#include "lodepng.cpp"
#endif
TextureLoading::TextureLoading()
@@ -1481,21 +1481,21 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options)
size_t dataSize = testImage.size();
processWithVulkan(testImage.data(), width, height, rowStride, dataSize, texture_point);
#ifdef _WIN32
//#ifdef _WIN32
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);
#else
const char* filename = "face.png";
std::vector<unsigned char> 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);
#endif
//#else
//
// const char* filename = "face.png";
// std::vector<unsigned char> 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);
//#endif
width = 256;
height = 256;
@@ -1503,8 +1503,13 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options)
auto lineImage = generateSimpleTestImage(width, height, 80);
dataSize = lineImage.size();
processWithVulkan(lineImage.data(), width, height, rowStride, dataSize, texture_point_line);
#ifdef _WIN32
const char* filename_test = "assets/test_trans.png";
#else
const char* filename_test = "/sdcard/Android/data/com.khronos.vulkan_samples/files/assets/test_trans.png";
#endif // _WIN32
std::vector<unsigned char> image_test;
unsigned w_t, h_t;
unsigned error_t = lodepng::decode(image_test, w_t, h_t, filename_test, LCT_RGBA, 8);