diff --git a/components/android/src/context.cpp b/components/android/src/context.cpp index c84bdf2..d2cf61b 100644 --- a/components/android/src/context.cpp +++ b/components/android/src/context.cpp @@ -110,6 +110,7 @@ Java_com_khronos_vulkan_1samples_MainActivity_nativeButtonClicked(JNIEnv *env, j } extern void TextureLoadProcessWithVulkan(uint8_t* data, int width, int height, int rowStride, size_t dataSize); +extern void ReceiveFacePoint(float* pos, int count, int width, int height); void processWithVulkan(uint8_t* data, int width, int height, int format, int rowStride, size_t dataSize) { @@ -142,4 +143,21 @@ Java_com_khronos_vulkan_1samples_MainActivity_processImageNative(JNIEnv *env, jo // 在这里将图像数据传递给 Vulkan // 创建 Vulkan 图像或更新现有图像 processWithVulkan(imageData, width, height, format, row_stride, capacity); +} +extern "C" +JNIEXPORT void JNICALL +Java_com_khronos_vulkan_1samples_MainActivity_passDataToNative(JNIEnv *env, jobject thiz, + jobject buffer, jint pointCount, jint width, jint height) { + // TODO: implement passDataToNative() + + // 获取直接缓冲区的指针 + float* pos = static_cast(env->GetDirectBufferAddress(buffer)); + + if (pos == nullptr) { + // 处理错误 + return; + } + + // 或者直接将指针传递给Vulkan + ReceiveFacePoint(pos, pointCount, width, height); } \ No newline at end of file