diff --git a/CMakeLists.txt b/CMakeLists.txt
index dfdac37..975bf74 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.22.1)
-project("sample")
+project("face_sdk")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@@ -23,7 +23,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
third_party/vma/include
)
- add_library(sample SHARED
+ add_library(face_sdk SHARED
app/src/main/cpp/main.cpp
app/src/main/cpp/AndroidOut.cpp
vulkan/AppBase.h
@@ -45,13 +45,13 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Android")
find_package(Vulkan REQUIRED)
- target_link_libraries(sample
+ target_link_libraries(face_sdk
game-activity::game-activity_static
Vulkan::Vulkan
android
log)
- target_compile_definitions(sample PRIVATE
+ target_compile_definitions(face_sdk PRIVATE
VMA_STATIC_VULKAN_FUNCTIONS=0
VMA_DYNAMIC_VULKAN_FUNCTIONS=1
)
@@ -82,7 +82,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR WIN32)
)
# 将源代码添加到此项目的可执行文件。
- add_executable (sample
+ add_executable (face_sdk
vulkan/AppBase.h
vulkan/AppBase.cpp
vulkan/Application.h
@@ -97,7 +97,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows" OR WIN32)
endif()
-# target_compile_definitions(sample PRIVATE VK_NO_PROTOTYPES) 使用volk 动态加载的时候需要定义,不自动生成vulkan接口
-target_compile_definitions(sample PRIVATE GLM_ENABLE_EXPERIMENTAL)
-# target_compile_definitions(sample PRIVATE VULKAN_HPP_NO_STRUCT_CONSTRUCTORS) 解决vs 编译c++ 20 不支持新构造函数的特性
+# target_compile_definitions(face_sdk PRIVATE VK_NO_PROTOTYPES) 使用volk 动态加载的时候需要定义,不自动生成vulkan接口
+target_compile_definitions(face_sdk PRIVATE GLM_ENABLE_EXPERIMENTAL)
+# target_compile_definitions(face_sdk PRIVATE VULKAN_HPP_NO_STRUCT_CONSTRUCTORS) 解决vs 编译c++ 20 不支持新构造函数的特性
diff --git a/app/build.gradle b/app/build.gradle
index d3d87e6..25a9dbe 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -8,10 +8,10 @@ ext.vvl_version='1.4.321.0'
apply from: "./download_vvl.gradle"
android {
- namespace 'com.hmwl.sample'
+ namespace 'com.hmwl.face_sdk'
compileSdk 36
defaultConfig {
-// applicationId "com.hmwl.sample"
+ //applicationId "com.hmwl.face_sdk"
minSdk 30
targetSdk 36
versionCode 1
diff --git a/app/src/androidTest/java/com/hmwl/sample/ExampleInstrumentedTest.java b/app/src/androidTest/java/com/hmwl/sample/ExampleInstrumentedTest.java
deleted file mode 100644
index 331a016..0000000
--- a/app/src/androidTest/java/com/hmwl/sample/ExampleInstrumentedTest.java
+++ /dev/null
@@ -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 Testing documentation
- */
-@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());
- }
-}
\ No newline at end of file
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index 0e0f6e6..1fab4eb 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -23,7 +23,7 @@
+ android:value="face_sdk" />
diff --git a/app/src/main/cpp/main.cpp b/app/src/main/cpp/main.cpp
index 22b784b..57f3879 100644
--- a/app/src/main/cpp/main.cpp
+++ b/app/src/main/cpp/main.cpp
@@ -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(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(env->GetDirectBufferAddress(buffer));
if (pos == nullptr) {
diff --git a/app/src/main/java/com/hmwl/face/FaceActivity.java b/app/src/main/java/com/hmwl/face_sdk/FaceActivity.java
similarity index 99%
rename from app/src/main/java/com/hmwl/face/FaceActivity.java
rename to app/src/main/java/com/hmwl/face_sdk/FaceActivity.java
index 8ba5640..6acec66 100644
--- a/app/src/main/java/com/hmwl/face/FaceActivity.java
+++ b/app/src/main/java/com/hmwl/face_sdk/FaceActivity.java
@@ -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;
diff --git a/app/src/main/java/com/hmwl/face/FaceLandmarkerHelper.kt b/app/src/main/java/com/hmwl/face_sdk/FaceLandmarkerHelper.kt
similarity index 99%
rename from app/src/main/java/com/hmwl/face/FaceLandmarkerHelper.kt
rename to app/src/main/java/com/hmwl/face_sdk/FaceLandmarkerHelper.kt
index b9ddb46..1623142 100644
--- a/app/src/main/java/com/hmwl/face/FaceLandmarkerHelper.kt
+++ b/app/src/main/java/com/hmwl/face_sdk/FaceLandmarkerHelper.kt
@@ -1,4 +1,4 @@
-package com.hmwl.face
+package com.hmwl.face_sdk
import android.content.Context
import android.graphics.Bitmap
diff --git a/app/src/main/java/com/hmwl/sample/MainActivity.java b/app/src/main/java/com/hmwl/sample/MainActivity.java
deleted file mode 100644
index a6772c3..0000000
--- a/app/src/main/java/com/hmwl/sample/MainActivity.java
+++ /dev/null
@@ -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);
-
- }
-
-}
\ No newline at end of file
diff --git a/example/.gitignore b/example/.gitignore
new file mode 100644
index 0000000..42afabf
--- /dev/null
+++ b/example/.gitignore
@@ -0,0 +1 @@
+/build
\ No newline at end of file
diff --git a/example/build.gradle b/example/build.gradle
new file mode 100644
index 0000000..d2068a6
--- /dev/null
+++ b/example/build.gradle
@@ -0,0 +1,56 @@
+plugins {
+ alias(libs.plugins.android.application)
+}
+
+android {
+ namespace 'com.hmwl.example'
+ compileSdk 36
+
+ defaultConfig {
+ applicationId "com.hmwl.example"
+ minSdk 30
+ targetSdk 36
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_11
+ targetCompatibility JavaVersion.VERSION_11
+ }
+}
+
+dependencies {
+
+ implementation libs.appcompat
+ implementation libs.material
+ implementation libs.games.activity
+ testImplementation libs.junit
+ androidTestImplementation libs.ext.junit
+ androidTestImplementation libs.espresso.core
+
+ implementation project(':app')
+
+ def camerax_version = '1.4.2'
+ implementation "androidx.camera:camera-core:$camerax_version"
+ implementation "androidx.camera:camera-camera2:$camerax_version"
+ implementation "androidx.camera:camera-lifecycle:$camerax_version"
+ implementation "androidx.camera:camera-view:$camerax_version"
+
+ implementation 'com.google.protobuf:protobuf-javalite:3.21.12'
+ implementation 'com.google.android.datatransport:transport-runtime:3.1.9'
+ implementation 'com.google.android.datatransport:transport-backend-cct:3.1.9'
+
+ implementation 'com.google.flogger:flogger:0.7.4'
+ implementation 'com.google.flogger:flogger-system-backend:0.7.4'
+
+ implementation 'com.google.guava:guava:31.1-android'
+}
\ No newline at end of file
diff --git a/example/proguard-rules.pro b/example/proguard-rules.pro
new file mode 100644
index 0000000..481bb43
--- /dev/null
+++ b/example/proguard-rules.pro
@@ -0,0 +1,21 @@
+# Add project specific ProGuard rules here.
+# You can control the set of applied configuration files using the
+# proguardFiles setting in build.gradle.
+#
+# For more details, see
+# http://developer.android.com/guide/developing/tools/proguard.html
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+# public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/example/src/main/AndroidManifest.xml b/example/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..2f6f785
--- /dev/null
+++ b/example/src/main/AndroidManifest.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/src/main/java/com/hmwl/example/MainActivity.java b/example/src/main/java/com/hmwl/example/MainActivity.java
new file mode 100644
index 0000000..8ea02ee
--- /dev/null
+++ b/example/src/main/java/com/hmwl/example/MainActivity.java
@@ -0,0 +1,15 @@
+package com.hmwl.example;
+
+import android.os.Bundle;
+
+import com.hmwl.face_sdk.FaceActivity;
+public class MainActivity extends FaceActivity{
+ @Override
+ protected void onCreate(Bundle savedInstanceState){
+ super.onCreate(savedInstanceState);
+
+ //这个是设置接口的参数,采用json传递,可以保证接口灵活性
+ //比如设置对应的化妆步骤为
+ ChangeState("{\"step\":\"0\"}");
+ }
+}
diff --git a/example/src/main/res/drawable/ic_launcher_background.xml b/example/src/main/res/drawable/ic_launcher_background.xml
new file mode 100644
index 0000000..07d5da9
--- /dev/null
+++ b/example/src/main/res/drawable/ic_launcher_background.xml
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/example/src/main/res/drawable/ic_launcher_foreground.xml b/example/src/main/res/drawable/ic_launcher_foreground.xml
new file mode 100644
index 0000000..2b068d1
--- /dev/null
+++ b/example/src/main/res/drawable/ic_launcher_foreground.xml
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/src/main/res/mipmap-anydpi/ic_launcher.xml b/example/src/main/res/mipmap-anydpi/ic_launcher.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/example/src/main/res/mipmap-anydpi/ic_launcher.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/src/main/res/mipmap-anydpi/ic_launcher_round.xml b/example/src/main/res/mipmap-anydpi/ic_launcher_round.xml
new file mode 100644
index 0000000..6f3b755
--- /dev/null
+++ b/example/src/main/res/mipmap-anydpi/ic_launcher_round.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/example/src/main/res/mipmap-hdpi/ic_launcher.webp b/example/src/main/res/mipmap-hdpi/ic_launcher.webp
new file mode 100644
index 0000000..c209e78
Binary files /dev/null and b/example/src/main/res/mipmap-hdpi/ic_launcher.webp differ
diff --git a/example/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/example/src/main/res/mipmap-hdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..b2dfe3d
Binary files /dev/null and b/example/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ
diff --git a/example/src/main/res/mipmap-mdpi/ic_launcher.webp b/example/src/main/res/mipmap-mdpi/ic_launcher.webp
new file mode 100644
index 0000000..4f0f1d6
Binary files /dev/null and b/example/src/main/res/mipmap-mdpi/ic_launcher.webp differ
diff --git a/example/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/example/src/main/res/mipmap-mdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..62b611d
Binary files /dev/null and b/example/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ
diff --git a/example/src/main/res/mipmap-xhdpi/ic_launcher.webp b/example/src/main/res/mipmap-xhdpi/ic_launcher.webp
new file mode 100644
index 0000000..948a307
Binary files /dev/null and b/example/src/main/res/mipmap-xhdpi/ic_launcher.webp differ
diff --git a/example/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/example/src/main/res/mipmap-xhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..1b9a695
Binary files /dev/null and b/example/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ
diff --git a/example/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/example/src/main/res/mipmap-xxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..28d4b77
Binary files /dev/null and b/example/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ
diff --git a/example/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/example/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9287f50
Binary files /dev/null and b/example/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ
diff --git a/example/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/example/src/main/res/mipmap-xxxhdpi/ic_launcher.webp
new file mode 100644
index 0000000..aa7d642
Binary files /dev/null and b/example/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ
diff --git a/example/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/example/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp
new file mode 100644
index 0000000..9126ae3
Binary files /dev/null and b/example/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ
diff --git a/example/src/main/res/values-night/themes.xml b/example/src/main/res/values-night/themes.xml
new file mode 100644
index 0000000..c0fd1e9
--- /dev/null
+++ b/example/src/main/res/values-night/themes.xml
@@ -0,0 +1,16 @@
+
+
+
+
\ No newline at end of file
diff --git a/example/src/main/res/values/colors.xml b/example/src/main/res/values/colors.xml
new file mode 100644
index 0000000..f8c6127
--- /dev/null
+++ b/example/src/main/res/values/colors.xml
@@ -0,0 +1,10 @@
+
+
+ #FFBB86FC
+ #FF6200EE
+ #FF3700B3
+ #FF03DAC5
+ #FF018786
+ #FF000000
+ #FFFFFFFF
+
\ No newline at end of file
diff --git a/example/src/main/res/values/strings.xml b/example/src/main/res/values/strings.xml
new file mode 100644
index 0000000..e16a3ca
--- /dev/null
+++ b/example/src/main/res/values/strings.xml
@@ -0,0 +1,3 @@
+
+ example
+
\ No newline at end of file
diff --git a/example/src/main/res/values/themes.xml b/example/src/main/res/values/themes.xml
new file mode 100644
index 0000000..fb0958c
--- /dev/null
+++ b/example/src/main/res/values/themes.xml
@@ -0,0 +1,16 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/src/test/java/com/hmwl/sample/ExampleUnitTest.java b/example/src/test/java/com/hmwl/example/ExampleUnitTest.java
similarity index 93%
rename from app/src/test/java/com/hmwl/sample/ExampleUnitTest.java
rename to example/src/test/java/com/hmwl/example/ExampleUnitTest.java
index 199635b..63c26a9 100644
--- a/app/src/test/java/com/hmwl/sample/ExampleUnitTest.java
+++ b/example/src/test/java/com/hmwl/example/ExampleUnitTest.java
@@ -1,4 +1,4 @@
-package com.hmwl.sample;
+package com.hmwl.example;
import org.junit.Test;
diff --git a/settings.gradle b/settings.gradle
index 77b6ccc..18deba7 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -19,5 +19,6 @@ dependencyResolutionManagement {
}
}
-rootProject.name = "Sample"
+rootProject.name = "face_sdk"
include ':app'
+include ':example'
diff --git a/vulkan/AppBase.cpp b/vulkan/AppBase.cpp
index ae9f0c8..dfdec75 100644
--- a/vulkan/AppBase.cpp
+++ b/vulkan/AppBase.cpp
@@ -147,7 +147,7 @@ void AppBase::createInstance()
VkApplicationInfo appInfo{};
appInfo.sType = VK_STRUCTURE_TYPE_APPLICATION_INFO;
- appInfo.pApplicationName = "Sample";
+ appInfo.pApplicationName = "example";
appInfo.applicationVersion = VK_MAKE_VERSION(1, 0, 0);
appInfo.pEngineName = "No Engine";
appInfo.engineVersion = VK_MAKE_VERSION(1, 0, 0);