添加Example 模块,并且在设备上跑通双纹理效果

This commit is contained in:
xsl
2025-10-22 22:11:01 +08:00
parent f6dd3ab38e
commit 2876599568
34 changed files with 413 additions and 64 deletions
@@ -1,26 +0,0 @@
package com.hmwl.sample;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.hmwl.sample", appContext.getPackageName());
}
}
+1 -1
View File
@@ -23,7 +23,7 @@
<meta-data
android:name="android.app.lib_name"
android:value="sample" />
android:value="face_sdk" />
</activity>
</application>
+20 -4
View File
@@ -92,6 +92,23 @@ Java_com_hmwl_face_FaceActivity_processImageNative(JNIEnv *env, jobject thiz, jo
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,
jint width, jint height, jint format,
jint row_stride, jint pixel_stride,
jint rotation) {
// TODO: implement processImageNative()
uint8_t* imageData = static_cast<uint8_t*>(env->GetDirectBufferAddress(buffer));
jlong capacity = env->GetDirectBufferCapacity(buffer);
@@ -103,12 +120,11 @@ Java_com_hmwl_face_FaceActivity_processImageNative(JNIEnv *env, jobject thiz, jo
// 创建 Vulkan 图像或更新现有图像
processWithVulkan(imageData, width, height, format, row_stride, capacity);
}
extern "C"
JNIEXPORT void JNICALL
Java_com_hmwl_face_FaceActivity_passDataToNative(JNIEnv *env, jobject thiz, jobject buffer,
jint point_count, jint width, jint height) {
Java_com_hmwl_face_1sdk_FaceActivity_passDataToNative(JNIEnv *env, jobject thiz, jobject buffer,
jint point_count, jint width, jint height) {
// TODO: implement passDataToNative()
float* pos = static_cast<float*>(env->GetDirectBufferAddress(buffer));
if (pos == nullptr) {
@@ -1,4 +1,4 @@
package com.hmwl.face;
package com.hmwl.face_sdk;
import android.Manifest;
import android.content.pm.PackageManager;
@@ -37,7 +37,7 @@ public class FaceActivity extends GameActivity implements FaceLandmarkerHelper.L
private static final String TAG = "FaceActivity";
static {
System.loadLibrary("sample");
System.loadLibrary("face_sdk");
}
private ProcessCameraProvider cameraProvider;
@@ -1,4 +1,4 @@
package com.hmwl.face
package com.hmwl.face_sdk
import android.content.Context
import android.graphics.Bitmap
@@ -1,17 +0,0 @@
package com.hmwl.sample;
import android.os.Bundle;
import com.hmwl.face.FaceActivity;
public class MainActivity extends FaceActivity {
private static final String TAG = "MainActivity";
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
}
}
@@ -1,17 +0,0 @@
package com.hmwl.sample;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}