android 设备上跑通透明
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
|
|
||||||
|
|
||||||
#include "texture_loading.h"
|
#include "texture_loading.h"
|
||||||
|
#include "lodepng.cpp"
|
||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
#include <nlohmann/json.hpp>
|
#include <nlohmann/json.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "lodepng.cpp"
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TextureLoading::TextureLoading()
|
TextureLoading::TextureLoading()
|
||||||
@@ -1481,21 +1481,21 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options)
|
|||||||
size_t dataSize = testImage.size();
|
size_t dataSize = testImage.size();
|
||||||
processWithVulkan(testImage.data(), width, height, rowStride, dataSize, texture_point);
|
processWithVulkan(testImage.data(), width, height, rowStride, dataSize, texture_point);
|
||||||
|
|
||||||
#ifdef _WIN32
|
//#ifdef _WIN32
|
||||||
width = 640;
|
width = 640;
|
||||||
height = 480;
|
height = 480;
|
||||||
rowStride = width * 4;
|
rowStride = width * 4;
|
||||||
auto arrowImage = generateSimpleTestImage(width, height, 80);
|
auto arrowImage = generateSimpleTestImage(width, height, 80);
|
||||||
dataSize = arrowImage.size();
|
dataSize = arrowImage.size();
|
||||||
processWithVulkan(arrowImage.data(), width, height, rowStride, dataSize, cam_text);
|
processWithVulkan(arrowImage.data(), width, height, rowStride, dataSize, cam_text);
|
||||||
#else
|
//#else
|
||||||
|
//
|
||||||
const char* filename = "face.png";
|
// const char* filename = "face.png";
|
||||||
std::vector<unsigned char> image;
|
// std::vector<unsigned char> image;
|
||||||
unsigned w, h;
|
// unsigned w, h;
|
||||||
unsigned error = lodepng::decode(image, w, h, filename, LCT_RGBA, 8);
|
// unsigned error = lodepng::decode(image, w, h, filename, LCT_RGBA, 8);
|
||||||
processWithVulkan(image.data(), w, h, w*4, image.size(), cam_text);
|
// processWithVulkan(image.data(), w, h, w*4, image.size(), cam_text);
|
||||||
#endif
|
//#endif
|
||||||
|
|
||||||
width = 256;
|
width = 256;
|
||||||
height = 256;
|
height = 256;
|
||||||
@@ -1503,8 +1503,13 @@ bool TextureLoading::prepare(const vkb::ApplicationOptions& options)
|
|||||||
auto lineImage = generateSimpleTestImage(width, height, 80);
|
auto lineImage = generateSimpleTestImage(width, height, 80);
|
||||||
dataSize = lineImage.size();
|
dataSize = lineImage.size();
|
||||||
processWithVulkan(lineImage.data(), width, height, rowStride, dataSize, texture_point_line);
|
processWithVulkan(lineImage.data(), width, height, rowStride, dataSize, texture_point_line);
|
||||||
|
#ifdef _WIN32
|
||||||
const char* filename_test = "assets/test_trans.png";
|
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;
|
std::vector<unsigned char> image_test;
|
||||||
unsigned w_t, h_t;
|
unsigned w_t, h_t;
|
||||||
unsigned error_t = lodepng::decode(image_test, w_t, h_t, filename_test, LCT_RGBA, 8);
|
unsigned error_t = lodepng::decode(image_test, w_t, h_t, filename_test, LCT_RGBA, 8);
|
||||||
|
|||||||
Reference in New Issue
Block a user