Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7ab4274e4f | ||
|
|
5d8e108306 | ||
|
|
52c9da08ed | ||
|
|
496d56f9c6 | ||
|
|
60b40bfd5f | ||
|
|
b44162e6cb | ||
|
|
6ef6e012bd | ||
|
|
f5b2d490c0 | ||
|
|
4c5a05ae21 | ||
|
|
1f9e4939b9 | ||
|
|
c83f36c976 | ||
|
|
29e0c1e9a8 | ||
|
|
7b07e7fbc1 | ||
|
|
b6ac86a134 | ||
|
|
6bbbb3c3ef | ||
|
|
e38da96e37 |
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 139 KiB After Width: | Height: | Size: 1.5 KiB |
@@ -9,7 +9,33 @@ layout(location = 0) out vec4 outColor;
|
|||||||
// 纹理采样器
|
// 纹理采样器
|
||||||
layout(binding = 0) uniform sampler2D texSampler;
|
layout(binding = 0) uniform sampler2D texSampler;
|
||||||
|
|
||||||
|
layout(push_constant) uniform PushConstants {
|
||||||
|
float zoom;
|
||||||
|
float r;
|
||||||
|
float g;
|
||||||
|
float b;
|
||||||
|
float radius;
|
||||||
|
float ux;
|
||||||
|
float uy;
|
||||||
|
} pushConstants;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
// 采样纹理
|
// outFragColor = color;
|
||||||
outColor = texture(texSampler, inTexCoord);
|
// 获取当前片元的屏幕坐标(左下角为原点)
|
||||||
|
vec2 fragCoord = gl_FragCoord.xy;
|
||||||
|
|
||||||
|
// 屏幕中心(480x480 的中心是 (240, 240))
|
||||||
|
vec2 center = vec2(240.0, 240.0);
|
||||||
|
|
||||||
|
// 计算到中心的距离(欧氏距离,单位:像素)
|
||||||
|
float dist = length(fragCoord - center);
|
||||||
|
|
||||||
|
// 判断是否在半径之外
|
||||||
|
if (dist > pushConstants.radius) {
|
||||||
|
// 使用 push constant 中的 RGB 颜色(注意 alpha 设为 1.0)
|
||||||
|
outColor = vec4(pushConstants.r, pushConstants.g, pushConstants.b, 1.0);
|
||||||
|
} else {
|
||||||
|
// 采样纹理
|
||||||
|
outColor = texture(texSampler, inTexCoord);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -38,7 +38,15 @@ const vec2 texCoords[6] = vec2[6](
|
|||||||
|
|
||||||
// 定义 Push Constant,只有一个 float
|
// 定义 Push Constant,只有一个 float
|
||||||
layout(push_constant) uniform PushConstants {
|
layout(push_constant) uniform PushConstants {
|
||||||
float myValue;
|
float zoom;
|
||||||
|
float r;
|
||||||
|
float g;
|
||||||
|
float b;
|
||||||
|
float radius;
|
||||||
|
float ux;
|
||||||
|
float uy;
|
||||||
|
float offset_x;
|
||||||
|
float offset_y;
|
||||||
} pushConstants;
|
} pushConstants;
|
||||||
|
|
||||||
|
|
||||||
@@ -48,7 +56,9 @@ layout(location = 0) out vec2 outTexCoord;
|
|||||||
void main() {
|
void main() {
|
||||||
// 获取顶点位置
|
// 获取顶点位置
|
||||||
vec2 position = positions[gl_VertexIndex];
|
vec2 position = positions[gl_VertexIndex];
|
||||||
position = position * pushConstants.myValue;
|
position = position * pushConstants.zoom;
|
||||||
|
position.x = position.x + (pushConstants.offset_x/480);
|
||||||
|
position.y = position.y + (pushConstants.offset_y/480);
|
||||||
|
|
||||||
// 设置输出位置(Vulkan使用不同的坐标系)
|
// 设置输出位置(Vulkan使用不同的坐标系)
|
||||||
gl_Position = vec4(position, 0.0, 1.0);
|
gl_Position = vec4(position, 0.0, 1.0);
|
||||||
|
|||||||
@@ -5,13 +5,40 @@ layout (binding = 1) uniform sampler2D samplerColor;
|
|||||||
layout (location = 0) in vec2 inUV;
|
layout (location = 0) in vec2 inUV;
|
||||||
layout (location = 1) in vec3 inNormal;
|
layout (location = 1) in vec3 inNormal;
|
||||||
|
|
||||||
|
layout(push_constant) uniform PushConstants {
|
||||||
|
float zoom;
|
||||||
|
float r;
|
||||||
|
float g;
|
||||||
|
float b;
|
||||||
|
float radius;
|
||||||
|
float ux;
|
||||||
|
float uy;
|
||||||
|
} pushConstants;
|
||||||
|
|
||||||
|
|
||||||
layout (location = 0) out vec4 outFragColor;
|
layout (location = 0) out vec4 outFragColor;
|
||||||
|
|
||||||
void main()
|
void main()
|
||||||
{
|
{
|
||||||
vec4 color = texture(samplerColor, inUV);
|
// outFragColor = color;
|
||||||
|
// 获取当前片元的屏幕坐标(左下角为原点)
|
||||||
|
vec2 fragCoord = gl_FragCoord.xy;
|
||||||
|
|
||||||
outFragColor = color;
|
// 屏幕中心(480x480 的中心是 (240, 240))
|
||||||
|
vec2 center = vec2(240.0, 240.0);
|
||||||
|
|
||||||
|
// 计算到中心的距离(欧氏距离,单位:像素)
|
||||||
|
float dist = length(fragCoord - center);
|
||||||
|
|
||||||
|
// 判断是否在半径之外
|
||||||
|
if (dist > pushConstants.radius) {
|
||||||
|
// 使用 push constant 中的 RGB 颜色(注意 alpha 设为 1.0)
|
||||||
|
outFragColor = vec4(pushConstants.r, pushConstants.g, pushConstants.b, 1.0);
|
||||||
|
} else {
|
||||||
|
vec2 pos = vec2(pushConstants.ux/4096.f, pushConstants.uy/2048.f);
|
||||||
|
vec2 uv = pos + vec2(inUV.x/8.f, inUV.y/4.f);
|
||||||
|
vec4 color = texture(samplerColor, uv);
|
||||||
|
outFragColor = color;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -17,7 +17,15 @@ layout (location = 0) out vec2 outUV;
|
|||||||
layout (location = 1) out vec3 outNormal;
|
layout (location = 1) out vec3 outNormal;
|
||||||
|
|
||||||
layout(push_constant) uniform PushConstants {
|
layout(push_constant) uniform PushConstants {
|
||||||
float myValue;
|
float zoom;
|
||||||
|
float r;
|
||||||
|
float g;
|
||||||
|
float b;
|
||||||
|
float radius;
|
||||||
|
float ux;
|
||||||
|
float uy;
|
||||||
|
float offset_x;
|
||||||
|
float offset_y;
|
||||||
} pushConstants;
|
} pushConstants;
|
||||||
|
|
||||||
out gl_PerVertex
|
out gl_PerVertex
|
||||||
@@ -30,7 +38,9 @@ void main()
|
|||||||
outUV = inUV;
|
outUV = inUV;
|
||||||
|
|
||||||
vec2 position = vec2(inPos.xy*2 -1);
|
vec2 position = vec2(inPos.xy*2 -1);
|
||||||
position = position * pushConstants.myValue;
|
position = position * pushConstants.zoom;
|
||||||
|
position.x = position.x + (pushConstants.offset_x/480);
|
||||||
|
position.y = position.y + (pushConstants.offset_y/480);
|
||||||
gl_Position = vec4(position, 0.5, 1.0);
|
gl_Position = vec4(position, 0.5, 1.0);
|
||||||
|
|
||||||
vec4 pos = ubo.model * vec4(inPos, 1.0);
|
vec4 pos = ubo.model * vec4(inPos, 1.0);
|
||||||
|
|||||||
@@ -39,9 +39,12 @@ void android_main(struct android_app *pApp) {
|
|||||||
aout << "Welcome to android_main" << std::endl;
|
aout << "Welcome to android_main" << std::endl;
|
||||||
g_android_app = pApp;
|
g_android_app = pApp;
|
||||||
g_assetManager = pApp->activity->assetManager;
|
g_assetManager = pApp->activity->assetManager;
|
||||||
FaceApp application;
|
//FaceApp application;
|
||||||
g_Application = &application;
|
//g_Application = &application;
|
||||||
application.SetInitArg(g_InitArgString);
|
if(g_Application == nullptr) {
|
||||||
|
g_Application = new FaceApp();
|
||||||
|
}
|
||||||
|
g_Application->SetInitArg(g_InitArgString);
|
||||||
pApp->onAppCmd = handle_cmd;
|
pApp->onAppCmd = handle_cmd;
|
||||||
long long last_update_time = 0;
|
long long last_update_time = 0;
|
||||||
android_app_set_motion_event_filter(pApp, nullptr);
|
android_app_set_motion_event_filter(pApp, nullptr);
|
||||||
@@ -73,11 +76,11 @@ void android_main(struct android_app *pApp) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(application.isInited())
|
if(g_Application->isInited())
|
||||||
{
|
{
|
||||||
auto frameTime = (start_time - _lastDrawFrameTime);
|
auto frameTime = (start_time - _lastDrawFrameTime);
|
||||||
_lastDrawFrameTime = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now().time_since_epoch()).count();
|
_lastDrawFrameTime = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now().time_since_epoch()).count();
|
||||||
application.drawFrame(frameTime);
|
g_Application->drawFrame(frameTime);
|
||||||
}
|
}
|
||||||
auto end_time = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now().time_since_epoch()).count();
|
auto end_time = chrono::duration_cast<chrono::milliseconds>(chrono::system_clock::now().time_since_epoch()).count();
|
||||||
auto frameTime = end_time - last_update_time;
|
auto frameTime = end_time - last_update_time;
|
||||||
@@ -89,7 +92,9 @@ void android_main(struct android_app *pApp) {
|
|||||||
this_thread::sleep_for(chrono::milliseconds((35-function_time)));
|
this_thread::sleep_for(chrono::milliseconds((35-function_time)));
|
||||||
}
|
}
|
||||||
} while (!pApp->destroyRequested);
|
} while (!pApp->destroyRequested);
|
||||||
application.cleanup();
|
//application.cleanup();
|
||||||
|
g_Application->cleanupSecondInit();
|
||||||
|
g_Application->clearnSecondFaceApp();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,7 +159,7 @@ Java_com_hmwl_face_1sdk_FaceActivity_SetCppInitArg(JNIEnv *env, jobject thiz, js
|
|||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
Java_com_hmwl_face_1sdk_FaceActivity_StopRunning(JNIEnv *env, jobject thiz) {
|
Java_com_hmwl_face_1sdk_FaceActivity_StopRunning(JNIEnv *env, jobject thiz) {
|
||||||
g_Application->_running = false;
|
g_Application->Stop();
|
||||||
}
|
}
|
||||||
|
|
||||||
JavaVM* g_jvm = nullptr;
|
JavaVM* g_jvm = nullptr;
|
||||||
@@ -165,7 +170,7 @@ JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) {
|
|||||||
return JNI_VERSION_1_6;
|
return JNI_VERSION_1_6;
|
||||||
}
|
}
|
||||||
|
|
||||||
void CppCallback(const string& motion_type)
|
void CppCallback()
|
||||||
{
|
{
|
||||||
JNIEnv* env = nullptr;
|
JNIEnv* env = nullptr;
|
||||||
bool needDetach = false;
|
bool needDetach = false;
|
||||||
@@ -196,7 +201,7 @@ void CppCallback(const string& motion_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取 OnLoadActionFinished 方法 ID(注意方法名大小写必须一致!)
|
// 2. 获取 OnLoadActionFinished 方法 ID(注意方法名大小写必须一致!)
|
||||||
jmethodID methodId = env->GetMethodID(callbackClass, "OnLoadActionFinished", "(Ljava/lang/String;)V");
|
jmethodID methodId = env->GetMethodID(callbackClass, "OnLoadMotionListFinished", "(Ljava/lang/String;)V");
|
||||||
if (methodId == nullptr) {
|
if (methodId == nullptr) {
|
||||||
env->ExceptionDescribe(); // 打印异常
|
env->ExceptionDescribe(); // 打印异常
|
||||||
env->ExceptionClear();
|
env->ExceptionClear();
|
||||||
@@ -205,7 +210,7 @@ void CppCallback(const string& motion_type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 3. 构造 jstring 参数
|
// 3. 构造 jstring 参数
|
||||||
jstring jResult = env->NewStringUTF(motion_type.c_str());
|
jstring jResult = env->NewStringUTF("ok");
|
||||||
|
|
||||||
// 4. 调用 Java 回调
|
// 4. 调用 Java 回调
|
||||||
env->CallVoidMethod(g_callback, methodId, jResult);
|
env->CallVoidMethod(g_callback, methodId, jResult);
|
||||||
@@ -258,7 +263,7 @@ void CppAnimationFinishedCallback()
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 2. 获取 OnLoadActionFinished 方法 ID(注意方法名大小写必须一致!)
|
// 2. 获取 OnLoadActionFinished 方法 ID(注意方法名大小写必须一致!)
|
||||||
jmethodID methodId = env->GetMethodID(callbackClass, "OnAnimationFinished", "()V");
|
jmethodID methodId = env->GetMethodID(callbackClass, "OnPlayMotionListFinished", "()V");
|
||||||
if (methodId == nullptr) {
|
if (methodId == nullptr) {
|
||||||
env->ExceptionDescribe(); // 打印异常
|
env->ExceptionDescribe(); // 打印异常
|
||||||
env->ExceptionClear();
|
env->ExceptionClear();
|
||||||
@@ -309,10 +314,29 @@ Java_com_hmwl_face_1sdk_FaceActivity_PreReadAction(JNIEnv *env, jobject thiz, js
|
|||||||
aout << "ArgLen to long:" << len << std::endl;
|
aout << "ArgLen to long:" << len << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string ret = g_Application->preReadyMotion(nativeString, CppCallback);
|
std::string ret = g_Application->preLoadMotionList(nativeString, CppCallback);
|
||||||
return env->NewStringUTF(ret.c_str());
|
return env->NewStringUTF(ret.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const char DELIMITER = 0x1F; // same as \u001F
|
||||||
|
|
||||||
|
std::vector<std::string> splitMotionString(const std::string& input) {
|
||||||
|
std::vector<std::string> result;
|
||||||
|
if (input.empty()) return result;
|
||||||
|
|
||||||
|
size_t start = 0;
|
||||||
|
size_t pos = input.find(DELIMITER);
|
||||||
|
|
||||||
|
while (pos != std::string::npos) {
|
||||||
|
result.push_back(input.substr(start, pos - start));
|
||||||
|
start = pos + 1;
|
||||||
|
pos = input.find(DELIMITER, start);
|
||||||
|
}
|
||||||
|
// Add last part
|
||||||
|
result.push_back(input.substr(start));
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
JNIEXPORT void JNICALL
|
JNIEXPORT void JNICALL
|
||||||
@@ -336,6 +360,18 @@ Java_com_hmwl_face_1sdk_FaceActivity_ChangeMotionCpp(JNIEnv *env, jobject thiz,
|
|||||||
|
|
||||||
if(g_Application->isInited())
|
if(g_Application->isInited())
|
||||||
{
|
{
|
||||||
g_Application->changeMotion(nativeString, CppAnimationFinishedCallback, loop);
|
std::vector<std::string> motions = splitMotionString(nativeString);
|
||||||
|
g_Application->changeMotionList(motions, CppAnimationFinishedCallback, loop);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_hmwl_face_1sdk_FaceActivity_StopMotionNative(JNIEnv *env, jobject thiz) {
|
||||||
|
g_Application->StopMotion();
|
||||||
|
}
|
||||||
|
extern "C"
|
||||||
|
JNIEXPORT void JNICALL
|
||||||
|
Java_com_hmwl_face_1sdk_FaceActivity_ResumeMotionNative(JNIEnv *env, jobject thiz) {
|
||||||
|
// TODO: implement ResumeMotionNative()
|
||||||
|
g_Application->ResumeMotion();
|
||||||
|
}
|
||||||
@@ -4,7 +4,6 @@ import android.Manifest;
|
|||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
import androidx.annotation.NonNull;
|
||||||
@@ -31,7 +30,6 @@ import java.util.List;
|
|||||||
import java.util.concurrent.ExecutionException;
|
import java.util.concurrent.ExecutionException;
|
||||||
import java.util.concurrent.ExecutorService;
|
import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
public class FaceActivity extends GameActivity implements FaceLandmarkerHelper.LandmarkerListener {
|
public class FaceActivity extends GameActivity implements FaceLandmarkerHelper.LandmarkerListener {
|
||||||
private static final String TAG = "FaceActivity";
|
private static final String TAG = "FaceActivity";
|
||||||
@@ -96,12 +94,12 @@ public class FaceActivity extends GameActivity implements FaceLandmarkerHelper.L
|
|||||||
{
|
{
|
||||||
detectFace(image);
|
detectFace(image);
|
||||||
}
|
}
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
image.close();
|
// image.close();
|
||||||
}
|
// }
|
||||||
} finally {
|
} finally {
|
||||||
//image.close(); // 确保在这里关闭
|
image.close(); // 确保在这里关闭
|
||||||
//Log.d("Camera", "Image closed, ready for next frame");
|
//Log.d("Camera", "Image closed, ready for next frame");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -141,6 +139,16 @@ public class FaceActivity extends GameActivity implements FaceLandmarkerHelper.L
|
|||||||
StopRunning();
|
StopRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private native void StopMotionNative();
|
||||||
|
public void StopMotion(){
|
||||||
|
StopMotionNative();
|
||||||
|
}
|
||||||
|
|
||||||
|
private native void ResumeMotionNative();
|
||||||
|
public void ResumeMotion(){
|
||||||
|
ResumeMotionNative();
|
||||||
|
}
|
||||||
|
|
||||||
private native void StopRunning();
|
private native void StopRunning();
|
||||||
|
|
||||||
// Native 方法
|
// Native 方法
|
||||||
@@ -282,28 +290,39 @@ public class FaceActivity extends GameActivity implements FaceLandmarkerHelper.L
|
|||||||
|
|
||||||
protected native void SetCppInitArg(String json);
|
protected native void SetCppInitArg(String json);
|
||||||
|
|
||||||
protected void SetInitArg(String json)
|
public void SetInitArg(String json)
|
||||||
{
|
{
|
||||||
SetCppInitArg(json);
|
SetCppInitArg(json);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface CallbackInterface {
|
public interface LoadMotionListFinishedCallback {
|
||||||
void OnLoadActionFinished(String result);
|
void OnLoadMotionListFinished(String result);
|
||||||
}
|
}
|
||||||
|
|
||||||
public interface AnimationFinishedCallbackInterface {
|
public interface PlayMotionListFinishedCallback {
|
||||||
void OnAnimationFinished();
|
void OnPlayMotionListFinished();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected native String PreReadAction(String motion, CallbackInterface callback);
|
protected native String PreReadAction(String motion, LoadMotionListFinishedCallback callback);
|
||||||
protected String PreLoadAction(String json, CallbackInterface callback){
|
public String PreLoadAction(String json, LoadMotionListFinishedCallback callback){
|
||||||
return PreReadAction(json, callback);
|
return PreReadAction(json, callback);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected native void ChangeMotionCpp(String json, AnimationFinishedCallbackInterface callback, boolean loop);
|
protected native void ChangeMotionCpp(String json, PlayMotionListFinishedCallback callback, boolean loop);
|
||||||
protected void ChangeMotion(String json, AnimationFinishedCallbackInterface callback, boolean loop){
|
public void PlayMotionList(List<String> motionList, boolean loop, PlayMotionListFinishedCallback callback)
|
||||||
Log.i("FaceActivity", "ChangeState:" + json);
|
{
|
||||||
ChangeMotionCpp(json, callback, loop);
|
if(callback == null)
|
||||||
|
{
|
||||||
|
callback = new PlayMotionListFinishedCallback() {
|
||||||
|
@Override
|
||||||
|
public void OnPlayMotionListFinished() {
|
||||||
|
Log.i(TAG, "OnPlayMotionListFinished: ");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
final String DELIMITER = "\u001F"; // ASCII Unit Separator
|
||||||
|
String motion_list_str = String.join(DELIMITER, motionList);
|
||||||
|
ChangeMotionCpp(motion_list_str, callback, loop);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 添加这个缺失的方法
|
// 添加这个缺失的方法
|
||||||
|
|||||||
@@ -192,7 +192,7 @@ class FaceLandmarkerHelper(
|
|||||||
Bitmap.Config.ARGB_8888
|
Bitmap.Config.ARGB_8888
|
||||||
)
|
)
|
||||||
imageProxy.use { bitmapBuffer.copyPixelsFromBuffer(imageProxy.planes[0].buffer) }
|
imageProxy.use { bitmapBuffer.copyPixelsFromBuffer(imageProxy.planes[0].buffer) }
|
||||||
imageProxy.close()
|
//imageProxy.close()
|
||||||
|
|
||||||
val matrix = Matrix().apply {
|
val matrix = Matrix().apply {
|
||||||
// Rotate the frame received from the camera to be in the same direction as it'll be shown
|
// Rotate the frame received from the camera to be in the same direction as it'll be shown
|
||||||
|
|||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.hmwl.face_sdk;
|
||||||
|
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
public class Frame {
|
||||||
|
public String name;
|
||||||
|
public float x;
|
||||||
|
public float y;
|
||||||
|
public Frame(String name, float x, float y)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.x = x;
|
||||||
|
this.y = y;
|
||||||
|
}
|
||||||
|
public JSONObject toJsonObject(){
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
jsonObject.put("name", name);
|
||||||
|
jsonObject.put("x", x);
|
||||||
|
jsonObject.put("y", y);
|
||||||
|
return jsonObject;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,12 +4,23 @@ import org.json.JSONObject;
|
|||||||
public class InitArg {
|
public class InitArg {
|
||||||
public int action_fps;
|
public int action_fps;
|
||||||
public float zoom;
|
public float zoom;
|
||||||
|
public float r;
|
||||||
|
public float g;
|
||||||
|
public float b;
|
||||||
|
public float radius;
|
||||||
|
public float offset_x;
|
||||||
|
public float offset_y;
|
||||||
public String toJson() {
|
public String toJson() {
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("action_fps", action_fps);
|
jsonObject.put("action_fps", action_fps);
|
||||||
jsonObject.put("zoom", zoom);
|
jsonObject.put("zoom", zoom);
|
||||||
|
jsonObject.put("r", r);
|
||||||
|
jsonObject.put("g", g);
|
||||||
|
jsonObject.put("b", b);
|
||||||
|
jsonObject.put("radius", radius);
|
||||||
|
jsonObject.put("offset_x", offset_x);
|
||||||
|
jsonObject.put("offset_y", offset_y);
|
||||||
return jsonObject.toString();
|
return jsonObject.toString();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|||||||
@@ -5,32 +5,29 @@ import org.json.JSONObject;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class Motion {
|
public class Motion {
|
||||||
public String type = "no";
|
public String name = "no";
|
||||||
public List<String> png_names = new ArrayList<>();
|
public List<Frame> frames = new ArrayList<>();
|
||||||
|
public Motion(String name, List<Frame> frames)
|
||||||
|
{
|
||||||
|
this.name = name;
|
||||||
|
this.frames = frames;
|
||||||
|
}
|
||||||
|
|
||||||
public JSONObject toJsonObject() {
|
public JSONObject toJsonObject() {
|
||||||
try {
|
try {
|
||||||
JSONObject jsonObject = new JSONObject();
|
JSONObject jsonObject = new JSONObject();
|
||||||
jsonObject.put("type", type);
|
jsonObject.put("name", name);
|
||||||
JSONArray ja = new JSONArray();
|
JSONArray jframes = new JSONArray();
|
||||||
for(int i = 0; i < png_names.size(); ++i){
|
for(int i = 0; i < frames.size(); ++i){
|
||||||
ja.put(png_names.get(i));
|
jframes.put(frames.get(i).toJsonObject());
|
||||||
}
|
}
|
||||||
jsonObject.put("png_names", ja);
|
jsonObject.put("frames", jframes);
|
||||||
return jsonObject;
|
return jsonObject;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toJson() {
|
|
||||||
try {
|
|
||||||
return toJsonObject().toString();
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
package com.hmwl.face_sdk;
|
||||||
|
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class MotionList {
|
||||||
|
public List<Motion> motions = new ArrayList<>();
|
||||||
|
public JSONObject toJsonObject() {
|
||||||
|
try {
|
||||||
|
JSONObject jsonObject = new JSONObject();
|
||||||
|
JSONArray jMotions = new JSONArray();
|
||||||
|
for(int i = 0; i < motions.size(); ++i){
|
||||||
|
jMotions.put(motions.get(i).toJsonObject());
|
||||||
|
}
|
||||||
|
jsonObject.put("motions", jMotions);
|
||||||
|
return jsonObject;
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
return new JSONObject();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public String toJsonString(){
|
||||||
|
return toJsonObject().toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -4,8 +4,9 @@ glslangValidator -V app/src/main/assets/shaders/bg.vert -o app/src/main/assets/s
|
|||||||
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.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/texture.vert -o app/src/main/assets/shaders/texture.vert.spv
|
||||||
|
|
||||||
glslangValidator -V app/src/main/assets/shaders/texture_thick.frag -o app/src/main/assets/shaders/texture_thick.frag.spv
|
|
||||||
glslangValidator -V app/src/main/assets/shaders/texture_thick.vert -o app/src/main/assets/shaders/texture_thick.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.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
|
glslangValidator -V app/src/main/assets/shaders/simple_shader.vert -o app/src/main/assets/shaders/simple_shader.vert.spv
|
||||||
|
|
||||||
|
glslangValidator -V app/src/main/assets/shaders/texture_thick.frag -o app/src/main/assets/shaders/texture_thick.frag.spv
|
||||||
|
rem glslangValidator -V app/src/main/assets/shaders/texture_thick.vert -o app/src/main/assets/shaders/texture_thick.vert.spv
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ android {
|
|||||||
compileSdk 36
|
compileSdk 36
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.inewme.uvmirror.f20251129"
|
applicationId "com.inewme.uvmirror.f20260113"
|
||||||
minSdk 30
|
minSdk 30
|
||||||
targetSdk 36
|
targetSdk 36
|
||||||
versionCode 1
|
versionCode 1
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 2.8 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.1 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
After Width: | Height: | Size: 2.9 KiB |
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 13 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 14 KiB |
|
Before Width: | Height: | Size: 15 KiB |
|
Before Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 56 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.1 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.2 KiB |
|
After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
Before Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 3.3 KiB |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 3.5 KiB |
|
After Width: | Height: | Size: 3.6 KiB |
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 4.0 KiB |
|
After Width: | Height: | Size: 4.2 KiB |
|
After Width: | Height: | Size: 4.4 KiB |
|
After Width: | Height: | Size: 4.5 KiB |
|
After Width: | Height: | Size: 4.6 KiB |
|
After Width: | Height: | Size: 4.8 KiB |
|
After Width: | Height: | Size: 4.9 KiB |