修改了

This commit is contained in:
xsl
2025-10-23 21:16:10 +08:00
parent 2876599568
commit b73e94b7bf
11 changed files with 24 additions and 29 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+3 -10
View File
@@ -1,4 +1,4 @@
#version 450
#version 450
layout (binding = 1) uniform sampler2D samplerColor;
layout (binding = 2) uniform sampler2D samplerColor_ex;
@@ -18,21 +18,14 @@ void main()
vec4 textureColor = color;
//if (textureColor.a < 0.1)
//{
//textureColor = vec4(0.2, 0.2, 0.2, 0.5);
// discard;
//}
// ¼ÆËãÓë (0,0,1) µÄµã³Ë
// 计算与 (0,0,1) 的点乘
float ndot = dot(N, vec3(0.0, 0.0, -1.0));
// ±£Ö¤½á¹û >= 0
// 保证结果 >= 0
ndot = max(ndot, 0.0);
vec4 blendedColor = mix(color_ex, color, ndot);
outFragColor = blendedColor;
// outFragColor = vec4(1, 0, 0, 1);
}
Binary file not shown.
Binary file not shown.
-15
View File
@@ -85,23 +85,8 @@ void processWithVulkan(uint8_t* data, int width, int height, int format,
TextureLoadProcessWithVulkan(data, width, height, rowStride, dataSize);
}
extern "C"
JNIEXPORT void JNICALL
Java_com_hmwl_face_FaceActivity_processImageNative(JNIEnv *env, jobject thiz, jobject buffer,
jint width, jint height, jint format,
jint row_stride, jint pixel_stride,
jint rotation) {
}
extern "C"
JNIEXPORT void JNICALL
Java_com_hmwl_face_FaceActivity_passDataToNative(JNIEnv *env, jobject thiz, jobject buffer,
jint point_count, jint width, jint height) {
}
extern "C"
JNIEXPORT void JNICALL
Java_com_hmwl_face_1sdk_FaceActivity_processImageNative(JNIEnv *env, jobject thiz, jobject buffer,
+8
View File
@@ -0,0 +1,8 @@
glslangValidator -V app/src/main/assets/shaders/bg.frag -o app/src/main/assets/shaders/bg.frag.spv
glslangValidator -V app/src/main/assets/shaders/bg.vert -o app/src/main/assets/shaders/bg.vert.spv
glslangValidator -V app/src/main/assets/shaders/texture.frag -o app/src/main/assets/shaders/texture.frag.spv
glslangValidator -V app/src/main/assets/shaders/texture.vert -o app/src/main/assets/shaders/texture.vert.spv
glslangValidator -V app/src/main/assets/shaders/simple_shader.frag -o app/src/main/assets/shaders/simple_shader.frag.spv
glslangValidator -V app/src/main/assets/shaders/simple_shader.vert -o app/src/main/assets/shaders/simple_shader.vert.spv
+4
View File
@@ -737,6 +737,10 @@ void Application::createTexture(VkDevice device, VkPhysicalDevice physicalDevice
void Application::processWithVulkan(uint8_t* data, int width, int height, int rowStride, size_t dataSize, Texture& out_texture, bool srgb)
{
if(!isInited())
{
return;
}
std::unique_lock<std::mutex> lock(mtx);
if (out_texture.image == VK_NULL_HANDLE)
{
+9 -4
View File
@@ -512,13 +512,13 @@ void FaceApp::render(VkCommandBuffer commandBuffer)
std::unique_lock<std::mutex> lock_point(mtx_point);
//Application::render(commandBuffer);
//vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout_bg, 0, 1, &m_descriptor_set_bg, 0, NULL);
//vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphicsPipeline_bg);
vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout_bg, 0, 1, &m_descriptor_set_bg, 0, NULL);
vkCmdBindPipeline(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_graphicsPipeline_bg);
//vkCmdPushConstants(commandBuffer, m_pipelineLayout_bg, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(float), &myFloatValue);
vkCmdPushConstants(commandBuffer, m_pipelineLayout_bg, VK_SHADER_STAGE_VERTEX_BIT, 0, sizeof(float), &myFloatValue);
//vkCmdDraw(commandBuffer, 6, 1, 0, 0);
vkCmdDraw(commandBuffer, 6, 1, 0, 0);
vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout, 0, 1, &m_descriptor_set, 0, NULL);
@@ -674,6 +674,11 @@ void FaceApp::uploadVertexData() {
void FaceApp::update_face_vertex_buffer(float* pos, int pointCount)
{
if(!isInited())
{
return;
}
std::lock_guard<std::mutex> lock(mtx_point);
last_update_time = getCurrentTimeMillis();