save code

This commit is contained in:
xsl
2025-10-26 00:13:08 +08:00
parent 41a659bd6d
commit b2da84f903
66 changed files with 24834 additions and 78 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

After

Width:  |  Height:  |  Size: 24 KiB

+16 -8
View File
@@ -25,13 +25,13 @@ void main()
// 重新映射ndot值,让中间2/3部分进行融合
// 当ndot在[0.166, 0.833]范围内时进行混合,两端保持不变
float blendFactor;
if (ndot < 0.266) {
blendFactor = 0.0; // 完全使用color_ex
} else if (ndot > 0.733) {
blendFactor = 1.0; // 完全使用color
if (ndot < 0.0) {
blendFactor = 0.0; // 完全使用color_ex
} else if (ndot > 0.1) {
blendFactor = 1.0; // 完全使用color
} else {
// 在中间2/3部分进行平滑过渡
blendFactor = (ndot - 0.166) / (0.833 - 0.166);
// 在中间2/3部分进行平滑过渡
blendFactor = (ndot - 0.0) / (1 - 0);
}
// 使用smoothstep创建中间2/3的融合区域
@@ -40,9 +40,17 @@ void main()
//float blendFactor = smoothstep(0.166, 0.833, ndot);
vec4 blendedColor = mix(color_ex, color, blendFactor);
// vec4 blendedColor = mix(color_ex, color, ndot);
outFragColor = blendedColor;
// outFragColor = blendedColor;
if (ndot < 0.3){
outFragColor = color_ex;
}
else
{
outFragColor = color;
}
// outFragColor = vec4(1, 0, 0, 1);
}
Binary file not shown.
+18
View File
@@ -29,12 +29,16 @@ void handle_cmd(android_app *pApp, int32_t cmd) {
}
}
const int ArgLen = 128*1024;
char g_InitArgString[ArgLen] = {0};
void android_main(struct android_app *pApp) {
aout << "Welcome to android_main" << std::endl;
g_android_app = pApp;
g_assetManager = pApp->activity->assetManager;
FaceApp application;
g_Application = &application;
application.SetInitArg(g_InitArgString);
pApp->onAppCmd = handle_cmd;
android_app_set_motion_event_filter(pApp, nullptr);
@@ -119,4 +123,18 @@ Java_com_hmwl_face_1sdk_FaceActivity_passDataToNative(JNIEnv *env, jobject thiz,
// 或者直接将指针传递给Vulkan
ReceiveFacePoint(pos, point_count, width, height);
}
extern "C"
JNIEXPORT void JNICALL
Java_com_hmwl_face_1sdk_FaceActivity_SetCppInitArg(JNIEnv *env, jobject thiz, jstring json) {
// TODO: implement SetCppInitArg()
const char *nativeString = env->GetStringUTFChars(json, nullptr);
jsize len = env->GetStringUTFLength(json);
if(len > ArgLen)
{
aout << "ArgLen to long:" << len << std::endl;
return;
}
memcpy(g_InitArgString, nativeString, len);
}
@@ -309,6 +309,12 @@ public class FaceActivity extends GameActivity implements FaceLandmarkerHelper.L
public native void passDataToNative(ByteBuffer buffer, int pointCount, int width, int height);
protected native void SetCppInitArg(String json);
protected void SetInitArg(String json)
{
SetCppInitArg(json);
}
protected void ChangeState(String json){
Log.i("FaceActivity", "ChangeState:" + json);
}