修改了
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,4 +1,4 @@
|
|||||||
#version 450
|
#version 450
|
||||||
|
|
||||||
layout (binding = 1) uniform sampler2D samplerColor;
|
layout (binding = 1) uniform sampler2D samplerColor;
|
||||||
layout (binding = 2) uniform sampler2D samplerColor_ex;
|
layout (binding = 2) uniform sampler2D samplerColor_ex;
|
||||||
@@ -18,21 +18,14 @@ void main()
|
|||||||
|
|
||||||
vec4 textureColor = color;
|
vec4 textureColor = color;
|
||||||
|
|
||||||
//if (textureColor.a < 0.1)
|
// 计算与 (0,0,1) 的点乘
|
||||||
//{
|
|
||||||
//textureColor = vec4(0.2, 0.2, 0.2, 0.5);
|
|
||||||
// discard;
|
|
||||||
//}
|
|
||||||
|
|
||||||
// ¼ÆËãÓë (0,0,1) µÄµã³Ë
|
|
||||||
float ndot = dot(N, vec3(0.0, 0.0, -1.0));
|
float ndot = dot(N, vec3(0.0, 0.0, -1.0));
|
||||||
|
|
||||||
// ±£Ö¤½á¹û >= 0
|
// 保证结果 >= 0
|
||||||
ndot = max(ndot, 0.0);
|
ndot = max(ndot, 0.0);
|
||||||
|
|
||||||
vec4 blendedColor = mix(color_ex, color, ndot);
|
vec4 blendedColor = mix(color_ex, color, ndot);
|
||||||
|
|
||||||
outFragColor = blendedColor;
|
outFragColor = blendedColor;
|
||||||
|
|
||||||
// outFragColor = vec4(1, 0, 0, 1);
|
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
@@ -85,23 +85,8 @@ void processWithVulkan(uint8_t* data, int width, int height, int format,
|
|||||||
TextureLoadProcessWithVulkan(data, width, height, rowStride, dataSize);
|
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"
|
extern "C"
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_com_hmwl_face_1sdk_FaceActivity_processImageNative(JNIEnv *env, jobject thiz, jobject buffer,
|
Java_com_hmwl_face_1sdk_FaceActivity_processImageNative(JNIEnv *env, jobject thiz, jobject buffer,
|
||||||
|
|||||||
@@ -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
|
||||||
@@ -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)
|
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);
|
std::unique_lock<std::mutex> lock(mtx);
|
||||||
if (out_texture.image == VK_NULL_HANDLE)
|
if (out_texture.image == VK_NULL_HANDLE)
|
||||||
{
|
{
|
||||||
|
|||||||
+9
-4
@@ -512,13 +512,13 @@ void FaceApp::render(VkCommandBuffer commandBuffer)
|
|||||||
std::unique_lock<std::mutex> lock_point(mtx_point);
|
std::unique_lock<std::mutex> lock_point(mtx_point);
|
||||||
//Application::render(commandBuffer);
|
//Application::render(commandBuffer);
|
||||||
|
|
||||||
//vkCmdBindDescriptorSets(commandBuffer, VK_PIPELINE_BIND_POINT_GRAPHICS, m_pipelineLayout_bg, 0, 1, &m_descriptor_set_bg, 0, NULL);
|
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);
|
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);
|
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)
|
void FaceApp::update_face_vertex_buffer(float* pos, int pointCount)
|
||||||
{
|
{
|
||||||
|
if(!isInited())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard<std::mutex> lock(mtx_point);
|
std::lock_guard<std::mutex> lock(mtx_point);
|
||||||
last_update_time = getCurrentTimeMillis();
|
last_update_time = getCurrentTimeMillis();
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user