1 diff -pruN --exclude build ./demo_clean/CMakeLists.txt ./demo_dev/CMakeLists.txt
2 --- ./demo_clean/CMakeLists.txt 2021-02-17 01:23:17.000000000 +0000
3 +++ ./demo_dev/CMakeLists.txt 2021-04-28 12:32:48.468744883 +0100
4 @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16)
8 -set(SDK_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../..)
9 +set(SDK_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../CubismSdkForNative-4-r.2)
10 set(CORE_PATH ${SDK_ROOT_PATH}/Core)
11 set(FRAMEWORK_PATH ${SDK_ROOT_PATH}/Framework)
12 set(THIRD_PARTY_PATH ${SDK_ROOT_PATH}/Samples/OpenGL/thirdParty)
13 @@ -32,7 +32,7 @@ set(GLFW_INSTALL OFF CACHE BOOL "" FORCE
14 set(BUILD_UTILS OFF CACHE BOOL "" FORCE)
16 # Specify version of compiler.
17 -set(CMAKE_CXX_STANDARD 14)
18 +set(CMAKE_CXX_STANDARD 17)
19 set(CMAKE_CXX_STANDARD_REQUIRED ON)
20 set(CMAKE_CXX_EXTENSIONS OFF)
22 @@ -64,6 +64,11 @@ target_link_libraries(Framework Live2DCu
23 # Find opengl libraries.
24 find_package(OpenGL REQUIRED)
26 +# Add MouseTrackerForCubism
27 +find_package(PkgConfig)
28 +pkg_check_modules(GTKMM gtkmm-3.0)
29 +add_subdirectory(../.. MouseTrackerForCubism_build)
31 # Make executable app.
32 add_executable(${APP_NAME})
34 @@ -73,9 +78,20 @@ target_link_libraries(${APP_NAME}
38 + MouseTrackerForCubism
41 # Specify include directories.
42 -target_include_directories(${APP_NAME} PRIVATE ${STB_PATH})
43 +target_include_directories(${APP_NAME} PRIVATE ${STB_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/../../include ${GTKMM_INCLUDE_DIRS})
45 +# Copy GUI to build directory
51 + copy ${CMAKE_CURRENT_SOURCE_DIR}/../../src/gui.glade $<TARGET_FILE_DIR:${APP_NAME}>/gui.glade
54 # Copy resource directory to build directory.
56 diff -pruN --exclude build ./demo_clean/scripts/make_gcc ./demo_dev/scripts/make_gcc
57 --- ./demo_clean/scripts/make_gcc 2021-02-17 01:23:17.000000000 +0000
58 +++ ./demo_dev/scripts/make_gcc 2021-04-28 12:18:50.948333190 +0100
59 @@ -10,4 +10,4 @@ BUILD_PATH=$SCRIPT_PATH/../build/make_gc
60 cmake -S "$CMAKE_PATH" \
62 -D CMAKE_BUILD_TYPE=Release
63 -cd "$BUILD_PATH" && make
64 +cd "$BUILD_PATH" && make -j4
65 diff -pruN --exclude build ./demo_clean/src/CMakeLists.txt ./demo_dev/src/CMakeLists.txt
66 --- ./demo_clean/src/CMakeLists.txt 2021-02-17 01:23:17.000000000 +0000
67 +++ ./demo_dev/src/CMakeLists.txt 2021-04-28 12:21:56.795134807 +0100
68 @@ -6,8 +6,6 @@ target_sources(${APP_NAME}
69 ${CMAKE_CURRENT_SOURCE_DIR}/LAppDefine.hpp
70 ${CMAKE_CURRENT_SOURCE_DIR}/LAppDelegate.cpp
71 ${CMAKE_CURRENT_SOURCE_DIR}/LAppDelegate.hpp
72 - ${CMAKE_CURRENT_SOURCE_DIR}/LAppWavFileHandler.cpp
73 - ${CMAKE_CURRENT_SOURCE_DIR}/LAppWavFileHandler.hpp
74 ${CMAKE_CURRENT_SOURCE_DIR}/LAppLive2DManager.cpp
75 ${CMAKE_CURRENT_SOURCE_DIR}/LAppLive2DManager.hpp
76 ${CMAKE_CURRENT_SOURCE_DIR}/LAppModel.cpp
77 @@ -21,6 +19,4 @@ target_sources(${APP_NAME}
78 ${CMAKE_CURRENT_SOURCE_DIR}/LAppView.cpp
79 ${CMAKE_CURRENT_SOURCE_DIR}/LAppView.hpp
80 ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
81 - ${CMAKE_CURRENT_SOURCE_DIR}/TouchManager.cpp
82 - ${CMAKE_CURRENT_SOURCE_DIR}/TouchManager.hpp
84 diff -pruN --exclude build ./demo_clean/src/LAppDefine.cpp ./demo_dev/src/LAppDefine.cpp
85 --- ./demo_clean/src/LAppDefine.cpp 2021-02-17 01:23:17.000000000 +0000
86 +++ ./demo_dev/src/LAppDefine.cpp 2021-04-28 12:18:50.948333190 +0100
87 @@ -64,11 +64,11 @@ namespace LAppDefine {
88 const csmInt32 PriorityForce = 3;
91 - const csmBool DebugLogEnable = true;
92 + const csmBool DebugLogEnable = false;
93 const csmBool DebugTouchLogEnable = false;
95 // Frameworkから出力するログのレベル設定
96 - const CubismFramework::Option::LogLevel CubismLoggingLevel = CubismFramework::Option::LogLevel_Verbose;
97 + const CubismFramework::Option::LogLevel CubismLoggingLevel = CubismFramework::Option::LogLevel_Warning;
100 const csmInt32 RenderTargetWidth = 1900;
101 diff -pruN --exclude build ./demo_clean/src/LAppDelegate.cpp ./demo_dev/src/LAppDelegate.cpp
102 --- ./demo_clean/src/LAppDelegate.cpp 2021-02-17 01:23:17.000000000 +0000
103 +++ ./demo_dev/src/LAppDelegate.cpp 2021-04-28 12:18:50.948333190 +0100
104 @@ -45,7 +45,8 @@ void LAppDelegate::ReleaseInstance()
108 -bool LAppDelegate::Initialize()
109 +bool LAppDelegate::Initialize(int initWindowWidth, int initWindowHeight,
110 + const char *windowTitle)
114 @@ -63,7 +64,13 @@ bool LAppDelegate::Initialize()
118 - _window = glfwCreateWindow(RenderTargetWidth, RenderTargetHeight, "SAMPLE", NULL, NULL);
119 + _window = glfwCreateWindow(
120 + initWindowWidth ? initWindowWidth : RenderTargetWidth,
121 + initWindowHeight ? initWindowHeight : RenderTargetHeight,
122 + windowTitle ? windowTitle : "SAMPLE",
129 @@ -95,10 +102,6 @@ bool LAppDelegate::Initialize()
131 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
134 - glfwSetMouseButtonCallback(_window, EventHandler::OnMouseCallBack);
135 - glfwSetCursorPosCallback(_window, EventHandler::OnMouseCallBack);
139 glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &width, &height);
140 @@ -111,8 +114,6 @@ bool LAppDelegate::Initialize()
144 - SetRootDirectory();
147 LAppLive2DManager::GetInstance();
149 @@ -214,49 +215,6 @@ void LAppDelegate::InitializeCubism()
150 LAppPal::UpdateTime();
153 -void LAppDelegate::OnMouseCallBack(GLFWwindow* window, int button, int action, int modify)
159 - if (GLFW_MOUSE_BUTTON_LEFT != button)
164 - if (GLFW_PRESS == action)
167 - _view->OnTouchesBegan(_mouseX, _mouseY);
169 - else if (GLFW_RELEASE == action)
174 - _view->OnTouchesEnded(_mouseX, _mouseY);
179 -void LAppDelegate::OnMouseCallBack(GLFWwindow* window, double x, double y)
181 - _mouseX = static_cast<float>(x);
182 - _mouseY = static_cast<float>(y);
193 - _view->OnTouchesMoved(_mouseX, _mouseY);
196 GLuint LAppDelegate::CreateShader()
199 @@ -299,29 +257,9 @@ GLuint LAppDelegate::CreateShader()
203 -void LAppDelegate::SetRootDirectory()
204 +void LAppDelegate::SetRootDirectory(std::string rootDir)
207 - ssize_t len = readlink("/proc/self/exe", path, 1024 - 1);
214 - std::string pathString(path);
216 - pathString = pathString.substr(0, pathString.rfind("Demo"));
217 - Csm::csmVector<string> splitStrings = this->Split(pathString, '/');
219 - this->_rootDirectory = "";
221 - for(int i = 0; i < splitStrings.GetSize(); i++)
223 - this->_rootDirectory = this->_rootDirectory + "/" +splitStrings[i];
226 - this->_rootDirectory += "/";
227 + this->_rootDirectory = rootDir + "/";
230 Csm::csmVector<string> LAppDelegate::Split(const std::string& baseString, char delimiter)
231 diff -pruN --exclude build ./demo_clean/src/LAppDelegate.hpp ./demo_dev/src/LAppDelegate.hpp
232 --- ./demo_clean/src/LAppDelegate.hpp 2021-02-17 01:23:17.000000000 +0000
233 +++ ./demo_dev/src/LAppDelegate.hpp 2021-04-28 12:18:50.948333190 +0100
234 @@ -40,7 +40,8 @@ public:
236 * @brief APPに必要なものを初期化する。
239 + bool Initialize(int initWindowWidth = 0, int initWindowHeight = 0,
240 + const char *windowTitle = "SAMPLE");
244 @@ -53,25 +54,6 @@ public:
248 - * @brief OpenGL用 glfwSetMouseButtonCallback用関数。
250 - * @param[in] window コールバックを呼んだWindow情報
251 - * @param[in] button ボタン種類
252 - * @param[in] action 実行結果
253 - * @param[in] modify
255 - void OnMouseCallBack(GLFWwindow* window, int button, int action, int modify);
258 - * @brief OpenGL用 glfwSetCursorPosCallback用関数。
260 - * @param[in] window コールバックを呼んだWindow情報
264 - void OnMouseCallBack(GLFWwindow* window, double x, double y);
269 GLuint CreateShader();
270 @@ -98,8 +80,10 @@ public:
273 * @brief ルートディレクトリを設定する。
275 + * @param[in] rootDir : The root directory to set to.
277 - void SetRootDirectory();
278 + void SetRootDirectory(std::string rootDir);
281 * @brief ルートディレクトリを取得する。
282 @@ -146,24 +130,3 @@ private:
283 int _windowWidth; ///< Initialize関数で設定したウィンドウ幅
284 int _windowHeight; ///< Initialize関数で設定したウィンドウ高さ
291 - * @brief glfwSetMouseButtonCallback用コールバック関数。
293 - static void OnMouseCallBack(GLFWwindow* window, int button, int action, int modify)
295 - LAppDelegate::GetInstance()->OnMouseCallBack(window, button, action, modify);
299 - * @brief glfwSetCursorPosCallback用コールバック関数。
301 - static void OnMouseCallBack(GLFWwindow* window, double x, double y)
303 - LAppDelegate::GetInstance()->OnMouseCallBack(window, x, y);
307 diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src/LAppLive2DManager.cpp
308 --- ./demo_clean/src/LAppLive2DManager.cpp 2021-02-17 01:23:17.000000000 +0000
309 +++ ./demo_dev/src/LAppLive2DManager.cpp 2021-04-28 12:24:45.405646016 +0100
310 @@ -52,11 +52,11 @@ void LAppLive2DManager::ReleaseInstance(
312 LAppLive2DManager::LAppLive2DManager()
315 + , _projScaleFactor(1.0f)
316 + , _translateX(0.0f)
317 + , _translateY(0.0f)
319 _viewMatrix = new CubismMatrix44();
321 - ChangeScene(_sceneIndex);
324 LAppLive2DManager::~LAppLive2DManager()
325 @@ -100,26 +100,6 @@ void LAppLive2DManager::OnTap(csmFloat32
327 LAppPal::PrintLog("[APP]tap point: {x:%.2f y:%.2f}", x, y);
330 - for (csmUint32 i = 0; i < _models.GetSize(); i++)
332 - if (_models[i]->HitTest(HitAreaNameHead, x, y))
334 - if (DebugLogEnable)
336 - LAppPal::PrintLog("[APP]hit area: [%s]", HitAreaNameHead);
338 - _models[i]->SetRandomExpression();
340 - else if (_models[i]->HitTest(HitAreaNameBody, x, y))
342 - if (DebugLogEnable)
344 - LAppPal::PrintLog("[APP]hit area: [%s]", HitAreaNameBody);
346 - _models[i]->StartRandomMotion(MotionGroupTapBody, PriorityNormal, FinishedMotion);
351 void LAppLive2DManager::OnUpdate() const
352 @@ -136,12 +116,15 @@ void LAppLive2DManager::OnUpdate() const
354 // 横に長いモデルを縦長ウィンドウに表示する際モデルの横サイズでscaleを算出する
355 model->GetModelMatrix()->SetWidth(2.0f);
356 - projection.Scale(1.0f, static_cast<float>(width) / static_cast<float>(height));
357 + projection.Scale(_projScaleFactor,
358 + _projScaleFactor * static_cast<float>(width) / static_cast<float>(height));
362 - projection.Scale(static_cast<float>(height) / static_cast<float>(width), 1.0f);
363 + projection.Scale(_projScaleFactor * static_cast<float>(height) / static_cast<float>(width),
366 + projection.Translate(_translateX, _translateY);
369 if (_viewMatrix != NULL)
370 @@ -158,30 +141,14 @@ void LAppLive2DManager::OnUpdate() const
374 -void LAppLive2DManager::NextScene()
376 - csmInt32 no = (_sceneIndex + 1) % ModelDirSize;
380 -void LAppLive2DManager::ChangeScene(Csm::csmInt32 index)
381 +void LAppLive2DManager::SetModel(std::string modelName, bool useOldParamId)
383 - _sceneIndex = index;
384 - if (DebugLogEnable)
386 - LAppPal::PrintLog("[APP]model index: %d", _sceneIndex);
389 - // ModelDir[]に保持したディレクトリ名から
390 - // model3.jsonのパスを決定する.
391 - // ディレクトリ名とmodel3.jsonの名前を一致させておくこと.
392 - std::string model = ModelDir[index];
393 - std::string modelPath = LAppDelegate::GetInstance()->GetRootDirectory() + ResourcesPath + model + "/";
394 - std::string modelJsonName = ModelDir[index];
395 + std::string modelPath = LAppDelegate::GetInstance()->GetRootDirectory() + ResourcesPath + modelName + "/";
396 + std::string modelJsonName = modelName;
397 modelJsonName += ".model3.json";
400 - _models.PushBack(new LAppModel());
401 + _models.PushBack(new LAppModel(useOldParamId));
402 _models[0]->LoadAssets(modelPath.c_str(), modelJsonName.c_str());
405 @@ -203,7 +170,7 @@ void LAppLive2DManager::ChangeScene(Csm:
407 #if defined(USE_RENDER_TARGET) || defined(USE_MODEL_RENDER_TARGET)
408 // モデル個別にαを付けるサンプルとして、もう1体モデルを作成し、少し位置をずらす
409 - _models.PushBack(new LAppModel());
410 + _models.PushBack(new LAppModel(useOldParamId));
411 _models[1]->LoadAssets(modelPath.c_str(), modelJsonName.c_str());
412 _models[1]->GetModelMatrix()->TranslateX(0.2f);
414 @@ -232,3 +199,20 @@ void LAppLive2DManager::SetViewMatrix(Cu
415 _viewMatrix->GetArray()[i] = m->GetArray()[i];
419 +void LAppLive2DManager::SetTracker(MouseCursorTracker *tracker)
421 + for (auto it = _models.Begin(); it != _models.End(); ++it)
423 + (*it)->SetTracker(tracker);
427 +void LAppLive2DManager::SetProjectionScaleTranslate(float scaleFactor,
431 + _projScaleFactor = scaleFactor;
432 + _translateX = translateX;
433 + _translateY = translateY;
435 diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src/LAppLive2DManager.hpp
436 --- ./demo_clean/src/LAppLive2DManager.hpp 2021-02-17 01:23:17.000000000 +0000
437 +++ ./demo_dev/src/LAppLive2DManager.hpp 2021-04-28 12:18:50.948333190 +0100
443 #include <CubismFramework.hpp>
444 #include <Math/CubismMatrix44.hpp>
445 #include <Type/csmVector.hpp>
449 +class MouseCursorTracker;
452 * @brief サンプルアプリケーションにおいてCubismModelを管理するクラス<br>
453 * モデル生成と破棄、タップイベントの処理、モデル切り替えを行う。
454 @@ -72,16 +75,14 @@ public:
455 void OnUpdate() const;
458 - * @brief 次のシーンに切り替える<br>
459 - * サンプルアプリケーションではモデルセットの切り替えを行う。
464 - * @brief シーンを切り替える<br>
465 - * サンプルアプリケーションではモデルセットの切り替えを行う。
467 - void ChangeScene(Csm::csmInt32 index);
468 + * @brief Set model data
470 + * @param[in] modelName : Name of model, should be the same for both
471 + * the directory and the model3.json file
472 + * @param[in] useOldParamId : If true, translate new (Cubism 3+)
473 + * parameter IDs to old (Cubism 2.1) ones
475 + void SetModel(std::string modelName, bool useOldParamId);
479 @@ -94,6 +95,24 @@ public:
481 void SetViewMatrix(Live2D::Cubism::Framework::CubismMatrix44* m);
484 + * @brief Set the pointer to the MouseCursorTracker instance
486 + * @param[in] tracker : Pointer to MouseCursorTracker instance
488 + void SetTracker(MouseCursorTracker *tracker);
491 + * @brief Set projection scale factor and translation parameters
493 + * @param[in] scaleFactor : Scale factor applied in both X and Y directions
494 + * @param[in] translateX : Translation in X direction
495 + * @param[in] translateY : Translation in Y direction
497 + void SetProjectionScaleTranslate(float scaleFactor,
504 @@ -107,5 +126,8 @@ private:
506 Csm::CubismMatrix44* _viewMatrix; ///< モデル描画に用いるView行列
507 Csm::csmVector<LAppModel*> _models; ///< モデルインスタンスのコンテナ
508 - Csm::csmInt32 _sceneIndex; ///< 表示するシーンのインデックス値
510 + float _projScaleFactor;
514 diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppModel.cpp
515 --- ./demo_clean/src/LAppModel.cpp 2021-02-17 01:23:17.000000000 +0000
516 +++ ./demo_dev/src/LAppModel.cpp 2021-04-28 12:26:56.699586813 +0100
518 #include "LAppTextureManager.hpp"
519 #include "LAppDelegate.hpp"
521 +#include "mouse_cursor_tracker.h"
525 using namespace Live2D::Cubism::Framework;
526 using namespace Live2D::Cubism::Framework::DefaultParameterId;
527 using namespace LAppDefine;
528 @@ -45,22 +49,24 @@ namespace {
532 -LAppModel::LAppModel()
533 +LAppModel::LAppModel(bool useOldParamId)
535 , _modelSetting(NULL)
536 , _userTimeSeconds(0.0f)
537 + , _tracker(nullptr)
538 + , _useOldParamId(useOldParamId)
545 - _idParamAngleX = CubismFramework::GetIdManager()->GetId(ParamAngleX);
546 - _idParamAngleY = CubismFramework::GetIdManager()->GetId(ParamAngleY);
547 - _idParamAngleZ = CubismFramework::GetIdManager()->GetId(ParamAngleZ);
548 - _idParamBodyAngleX = CubismFramework::GetIdManager()->GetId(ParamBodyAngleX);
549 - _idParamEyeBallX = CubismFramework::GetIdManager()->GetId(ParamEyeBallX);
550 - _idParamEyeBallY = CubismFramework::GetIdManager()->GetId(ParamEyeBallY);
551 + _idParamAngleX = CubismFramework::GetIdManager()->GetId(_(ParamAngleX));
552 + _idParamAngleY = CubismFramework::GetIdManager()->GetId(_(ParamAngleY));
553 + _idParamAngleZ = CubismFramework::GetIdManager()->GetId(_(ParamAngleZ));
554 + _idParamBodyAngleX = CubismFramework::GetIdManager()->GetId(_(ParamBodyAngleX));
555 + _idParamEyeBallX = CubismFramework::GetIdManager()->GetId(_(ParamEyeBallX));
556 + _idParamEyeBallY = CubismFramework::GetIdManager()->GetId(_(ParamEyeBallY));
559 LAppModel::~LAppModel()
560 @@ -190,7 +196,7 @@ void LAppModel::SetupModel(ICubismModelS
561 breathParameters.PushBack(CubismBreath::BreathParameterData(_idParamAngleY, 0.0f, 8.0f, 3.5345f, 0.5f));
562 breathParameters.PushBack(CubismBreath::BreathParameterData(_idParamAngleZ, 0.0f, 10.0f, 5.5345f, 0.5f));
563 breathParameters.PushBack(CubismBreath::BreathParameterData(_idParamBodyAngleX, 0.0f, 4.0f, 15.5345f, 0.5f));
564 - breathParameters.PushBack(CubismBreath::BreathParameterData(CubismFramework::GetIdManager()->GetId(ParamBreath), 0.5f, 0.5f, 3.2345f, 0.5f));
565 + breathParameters.PushBack(CubismBreath::BreathParameterData(CubismFramework::GetIdManager()->GetId(_(ParamBreath)), 0.5f, 0.5f, 3.2345f, 0.5f));
567 _breath->SetParameters(breathParameters);
569 @@ -335,83 +341,118 @@ void LAppModel::Update()
570 const csmFloat32 deltaTimeSeconds = LAppPal::GetDeltaTime();
571 _userTimeSeconds += deltaTimeSeconds;
573 - _dragManager->Update(deltaTimeSeconds);
574 - _dragX = _dragManager->GetX();
575 - _dragY = _dragManager->GetY();
577 - // モーションによるパラメータ更新の有無
578 - csmBool motionUpdated = false;
580 - //-----------------------------------------------------------------
581 - _model->LoadParameters(); // 前回セーブされた状態をロード
582 - if (_motionManager->IsFinished())
584 - // モーションの再生がない場合、待機モーションの中からランダムで再生する
585 - StartRandomMotion(MotionGroupIdle, PriorityIdle);
590 - motionUpdated = _motionManager->UpdateMotion(_model, deltaTimeSeconds); // モーションを更新
592 - _model->SaveParameters(); // 状態を保存
593 - //-----------------------------------------------------------------
594 + auto idMan = CubismFramework::GetIdManager();
595 + auto params = _tracker->getParams();
598 - if (!motionUpdated)
600 - if (_eyeBlink != NULL)
601 + _model->LoadParameters(); // 前回セーブされた状態をロード
603 + int paramsMotionPriority = static_cast<int>(params.motionPriority);
605 + if (paramsMotionPriority != PriorityNone)
607 - // メインモーションの更新がないとき
608 - _eyeBlink->UpdateParameters(_model, deltaTimeSeconds); // 目パチ
609 + StartMotion(params.motionGroup.c_str(), params.motionNumber,
610 + paramsMotionPriority);
612 + else if (params.randomIdleMotion && _motionManager->IsFinished())
614 + // モーションの再生がない場合、待機モーションの中からランダムで再生する
615 + StartRandomMotion(MotionGroupIdle, PriorityIdle);
619 - if (_expressionManager != NULL)
621 - _expressionManager->UpdateMotion(_model, deltaTimeSeconds); // 表情でパラメータ更新(相対変化)
623 + // FIXME pose does not return to normal after motion
624 + // if we don't have randomIdleMotion set
627 + _motionManager->UpdateMotion(_model, deltaTimeSeconds); // モーションを更新
629 + _model->SaveParameters(); // 状態を保存
633 - _model->AddParameterValue(_idParamAngleX, _dragX * 30); // -30から30の値を加える
634 - _model->AddParameterValue(_idParamAngleY, _dragY * 30);
635 - _model->AddParameterValue(_idParamAngleZ, _dragX * _dragY * -30);
636 + if (params.expression != "")
638 + SetExpression(params.expression.c_str());
640 + if (_expressionManager != NULL)
642 + _expressionManager->UpdateMotion(_model, deltaTimeSeconds); // 表情でパラメータ更新(相対変化)
646 - _model->AddParameterValue(_idParamBodyAngleX, _dragX * 10); // -10から10の値を加える
647 + bool autoBlink = params.autoBlink && _eyeBlink;
648 + auto eyeLOpenIt = params.live2d.find("ParamEyeLOpen");
649 + auto eyeROpenIt = params.live2d.find("ParamEyeROpen");
652 - _model->AddParameterValue(_idParamEyeBallX, _dragX); // -1から1の値を加える
653 - _model->AddParameterValue(_idParamEyeBallY, _dragY);
656 + // Handle blink first
657 + _eyeBlink->UpdateParameters(_model, deltaTimeSeconds);
661 - if (_breath != NULL)
663 - _breath->UpdateParameters(_model, deltaTimeSeconds);
665 + if (eyeLOpenIt != params.live2d.end())
667 + // If value specified, override blinking
668 + _model->SetParameterValue(idMan->GetId(_("ParamEyeLOpen")),
669 + eyeLOpenIt->second);
671 + else if (!autoBlink)
673 + // If no value specified and no auto blink, set to 1
674 + _model->SetParameterValue(idMan->GetId(_("ParamEyeLOpen")), 1);
677 - if (_physics != NULL)
679 - _physics->Evaluate(_model, deltaTimeSeconds);
686 - // リアルタイムでリップシンクを行う場合、システムから音量を取得して0〜1の範囲で値を入力します。
687 - csmFloat32 value = 0.0f;
688 + if (eyeROpenIt != params.live2d.end())
690 + _model->SetParameterValue(idMan->GetId(_("ParamEyeROpen")),
691 + eyeROpenIt->second);
693 + else if (!autoBlink)
695 + _model->SetParameterValue(idMan->GetId(_("ParamEyeROpen")), 1);
699 - _wavFileHandler.Update(deltaTimeSeconds);
700 - value = _wavFileHandler.GetRms();
702 - for (csmUint32 i = 0; i < _lipSyncIds.GetSize(); ++i)
703 + if (params.useLipSync && _lipSync)
705 - _model->AddParameterValue(_lipSyncIds[i], value, 0.8f);
706 + csmFloat32 value = params.lipSyncParam; // 0 to 1
708 + for (csmUint32 i = 0; i < _lipSyncIds.GetSize(); ++i)
710 + _model->AddParameterValue(_lipSyncIds[i], value, 0.8f);
715 + _model->SetParameterValue(idMan->GetId(_("ParamMouthOpenY")),
716 + params.live2d["ParamMouthOpenY"]);
719 + for (auto const &entry : params.live2d)
721 + std::string key = entry.first;
722 + double val = entry.second;
724 + if (key != "ParamEyeLOpen" && key != "ParamEyeROpen" &&
725 + key != "ParamMouthOpenY")
727 + _model->SetParameterValue(idMan->GetId(_(key)), val);
731 + if (params.autoBreath && _breath)
733 + // Note: _model->LoadParameters and SaveParameters is needed
734 + // before - see above.
735 + _breath->UpdateParameters(_model, deltaTimeSeconds);
740 + if (_physics != NULL)
742 + _physics->Evaluate(_model, deltaTimeSeconds);
748 @@ -480,7 +521,6 @@ CubismMotionQueueEntryHandle LAppModel::
750 csmString path = voice;
751 path = _modelHomeDir + path;
752 - _wavFileHandler.Start(path);
756 @@ -632,3 +672,42 @@ Csm::Rendering::CubismOffscreenFrame_Ope
758 return _renderBuffer;
761 +void LAppModel::SetTracker(MouseCursorTracker *tracker)
763 + _tracker = tracker;
766 +Csm::ICubismModelSetting* LAppModel::GetModelSetting(void) const
768 + return _modelSetting;
771 +Csm::csmString LAppModel::_(std::string s)
774 + if (_useOldParamId)
776 + if (s == "ParamTere")
778 + ans = "PARAM_CHEEK";
782 + for (size_t i = 0; i < s.size(); i++)
784 + if (std::isupper(s[i]) && i != 0)
788 + ans += std::toupper(s[i]);
796 + return csmString(ans.c_str());
799 diff -pruN --exclude build ./demo_clean/src/LAppModel.hpp ./demo_dev/src/LAppModel.hpp
800 --- ./demo_clean/src/LAppModel.hpp 2021-02-17 01:23:17.000000000 +0000
801 +++ ./demo_dev/src/LAppModel.hpp 2021-04-28 12:27:55.836457680 +0100
803 #include <Type/csmRectF.hpp>
804 #include <Rendering/OpenGL/CubismOffscreenSurface_OpenGLES2.hpp>
806 -#include "LAppWavFileHandler.hpp"
807 +#include "mouse_cursor_tracker.h"
810 * @brief ユーザーが実際に使用するモデルの実装クラス<br>
811 @@ -25,8 +25,11 @@ class LAppModel : public Csm::CubismUser
816 + * @param[in] useOldParamId : If true, translate new (Cubism 3+)
817 + * parameter IDs to old (Cubism 2.1) ones
820 + LAppModel(bool useOldParamId);
824 @@ -114,6 +117,15 @@ public:
826 Csm::Rendering::CubismOffscreenFrame_OpenGLES2& GetRenderBuffer();
829 + * @brief Set the pointer to the MouseCursorTracker instance
831 + * @param[in] tracker : Pointer to MouseCursorTracker instance
833 + void SetTracker(MouseCursorTracker *tracker);
835 + Csm::ICubismModelSetting* GetModelSetting(void) const;
839 * @brief モデルを描画する処理。モデルを描画する空間のView-Projection行列を渡す。
840 @@ -167,6 +179,17 @@ private:
842 void ReleaseExpressions();
845 + * @brief Translate new (Cubism 3+) parameter IDs to old (Cubism 2.1) ones
847 + * @param[in] s : New parameter ID
849 + * @return Old parameter ID
851 + Csm::csmString _(std::string s);
853 + bool _useOldParamId;
855 Csm::ICubismModelSetting* _modelSetting; ///< モデルセッティング情報
856 Csm::csmString _modelHomeDir; ///< モデルセッティングが置かれたディレクトリ
857 Csm::csmFloat32 _userTimeSeconds; ///< デルタ時間の積算値[秒]
858 @@ -183,9 +206,9 @@ private:
859 const Csm::CubismId* _idParamEyeBallX; ///< パラメータID: ParamEyeBallX
860 const Csm::CubismId* _idParamEyeBallY; ///< パラメータID: ParamEyeBallXY
862 - LAppWavFileHandler _wavFileHandler; ///< wavファイルハンドラ
864 Csm::Rendering::CubismOffscreenFrame_OpenGLES2 _renderBuffer; ///< フレームバッファ以外の描画先
866 + MouseCursorTracker *_tracker;
870 diff -pruN --exclude build ./demo_clean/src/LAppPal.cpp ./demo_dev/src/LAppPal.cpp
871 --- ./demo_clean/src/LAppPal.cpp 2021-02-17 01:23:17.000000000 +0000
872 +++ ./demo_dev/src/LAppPal.cpp 2021-04-28 12:18:50.952333251 +0100
876 #include "LAppPal.hpp"
877 +#include <stdexcept>
881 @@ -36,7 +37,6 @@ csmByte* LAppPal::LoadFileAsBytes(const
882 if (stat(path, &statBuf) == 0)
884 size = statBuf.st_size;
889 @@ -45,10 +45,7 @@ csmByte* LAppPal::LoadFileAsBytes(const
890 file.open(path, std::ios::in | std::ios::binary);
893 - if (DebugLogEnable)
895 - PrintLog("file open error");
897 + throw std::runtime_error("Failed to open file " + filePath);
900 file.read(buf, size);
901 diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.cpp ./demo_dev/src/LAppTextureManager.cpp
902 --- ./demo_clean/src/LAppTextureManager.cpp 2021-02-17 01:23:17.000000000 +0000
903 +++ ./demo_dev/src/LAppTextureManager.cpp 2021-04-28 12:18:50.952333251 +0100
904 @@ -96,6 +96,46 @@ LAppTextureManager::TextureInfo* LAppTex
908 +LAppTextureManager::TextureInfo* LAppTextureManager::CreateTextureFromColor(
909 + uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha
912 + int width = 8, height = 8;
914 + uint8_t pixels[height][width][4];
915 + for (std::size_t h = 0; h < height; h++)
917 + for (std::size_t w = 0; w < width; w++)
919 + pixels[h][w][0] = red;
920 + pixels[h][w][1] = green;
921 + pixels[h][w][2] = blue;
922 + pixels[h][w][3] = alpha;
927 + glGenTextures(1, &textureId);
928 + glBindTexture(GL_TEXTURE_2D, textureId);
929 + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, pixels);
931 + glGenerateMipmap(GL_TEXTURE_2D);
932 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT);
933 + glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
934 + glBindTexture(GL_TEXTURE_2D, 0);
937 + LAppTextureManager::TextureInfo* textureInfo = new LAppTextureManager::TextureInfo();
938 + textureInfo->fileName = "";
939 + textureInfo->width = width;
940 + textureInfo->height = height;
941 + textureInfo->id = textureId;
943 + _textures.PushBack(textureInfo);
945 + return textureInfo;
948 void LAppTextureManager::ReleaseTextures()
950 for (Csm::csmUint32 i = 0; i < _textures.GetSize(); i++)
951 diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.hpp ./demo_dev/src/LAppTextureManager.hpp
952 --- ./demo_clean/src/LAppTextureManager.hpp 2021-02-17 01:23:17.000000000 +0000
953 +++ ./demo_dev/src/LAppTextureManager.hpp 2021-04-28 12:18:50.952333251 +0100
954 @@ -72,6 +72,8 @@ public:
956 TextureInfo* CreateTextureFromPngFile(std::string fileName);
958 + TextureInfo *CreateTextureFromColor(uint8_t red, uint8_t green, uint8_t blue, uint8_t alpha = 255);
963 diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView.cpp
964 --- ./demo_clean/src/LAppView.cpp 2021-02-17 01:23:17.000000000 +0000
965 +++ ./demo_dev/src/LAppView.cpp 2021-04-28 12:18:50.952333251 +0100
967 #include "LAppLive2DManager.hpp"
968 #include "LAppTextureManager.hpp"
969 #include "LAppDefine.hpp"
970 -#include "TouchManager.hpp"
971 #include "LAppSprite.hpp"
972 #include "LAppModel.hpp"
974 @@ -26,8 +25,6 @@ using namespace LAppDefine;
975 LAppView::LAppView():
981 _renderTarget(SelectTarget_None)
983 @@ -35,8 +32,6 @@ LAppView::LAppView():
984 _clearColor[1] = 1.0f;
985 _clearColor[2] = 1.0f;
986 _clearColor[3] = 0.0f;
988 - _touchManager = new TouchManager();
990 // デバイス座標からスクリーン座標に変換するための
991 _deviceToScreen = new CubismMatrix44();
992 @@ -52,10 +47,7 @@ LAppView::~LAppView()
995 delete _deviceToScreen;
996 - delete _touchManager;
1002 void LAppView::Initialize()
1003 @@ -107,9 +99,6 @@ void LAppView::Initialize()
1004 void LAppView::Render()
1011 LAppLive2DManager* Live2DManager = LAppLive2DManager::GetInstance();
1013 @@ -151,35 +140,17 @@ void LAppView::InitializeSprite()
1014 glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &width, &height);
1016 LAppTextureManager* textureManager = LAppDelegate::GetInstance()->GetTextureManager();
1017 - const string resourcesPath = LAppDelegate::GetInstance()->GetRootDirectory() + ResourcesPath;
1019 - string imageName = BackImageName;
1020 - LAppTextureManager::TextureInfo* backgroundTexture = textureManager->CreateTextureFromPngFile(resourcesPath + imageName);
1022 + LAppTextureManager::TextureInfo* backgroundTexture =
1023 + textureManager->CreateTextureFromColor(0, 255, 0);
1025 float x = width * 0.5f;
1026 float y = height * 0.5f;
1027 - float fWidth = static_cast<float>(backgroundTexture->width * 2.0f);
1028 - float fHeight = static_cast<float>(height) * 0.95f;
1029 + float fWidth = static_cast<float>(width);
1030 + float fHeight = static_cast<float>(height);
1031 _back = new LAppSprite(x, y, fWidth, fHeight, backgroundTexture->id, _programId);
1033 - imageName = GearImageName;
1034 - LAppTextureManager::TextureInfo* gearTexture = textureManager->CreateTextureFromPngFile(resourcesPath + imageName);
1036 - x = static_cast<float>(width - gearTexture->width * 0.5f);
1037 - y = static_cast<float>(height - gearTexture->height * 0.5f);
1038 - fWidth = static_cast<float>(gearTexture->width);
1039 - fHeight = static_cast<float>(gearTexture->height);
1040 - _gear = new LAppSprite(x, y, fWidth, fHeight, gearTexture->id, _programId);
1042 - imageName = PowerImageName;
1043 - LAppTextureManager::TextureInfo* powerTexture = textureManager->CreateTextureFromPngFile(resourcesPath + imageName);
1045 - x = static_cast<float>(width - powerTexture->width * 0.5f);
1046 - y = static_cast<float>(powerTexture->height * 0.5f);
1047 - fWidth = static_cast<float>(powerTexture->width);
1048 - fHeight = static_cast<float>(powerTexture->height);
1049 - _power = new LAppSprite(x, y, fWidth, fHeight, powerTexture->id, _programId);
1054 @@ -187,52 +158,6 @@ void LAppView::InitializeSprite()
1058 -void LAppView::OnTouchesBegan(float px, float py) const
1060 - _touchManager->TouchesBegan(px, py);
1063 -void LAppView::OnTouchesMoved(float px, float py) const
1065 - float viewX = this->TransformViewX(_touchManager->GetX());
1066 - float viewY = this->TransformViewY(_touchManager->GetY());
1068 - _touchManager->TouchesMoved(px, py);
1070 - LAppLive2DManager* Live2DManager = LAppLive2DManager::GetInstance();
1071 - Live2DManager->OnDrag(viewX, viewY);
1074 -void LAppView::OnTouchesEnded(float px, float py) const
1077 - LAppLive2DManager* live2DManager = LAppLive2DManager::GetInstance();
1078 - live2DManager->OnDrag(0.0f, 0.0f);
1082 - float x = _deviceToScreen->TransformX(_touchManager->GetX()); // 論理座標変換した座標を取得。
1083 - float y = _deviceToScreen->TransformY(_touchManager->GetY()); // 論理座標変換した座標を取得。
1084 - if (DebugTouchLogEnable)
1086 - LAppPal::PrintLog("[APP]touchesEnded x:%.2f y:%.2f", x, y);
1088 - live2DManager->OnTap(x, y);
1091 - if (_gear->IsHit(px, py))
1093 - live2DManager->NextScene();
1097 - if (_power->IsHit(px, py))
1099 - LAppDelegate::GetInstance()->AppEnd();
1104 float LAppView::TransformViewX(float deviceX) const
1106 float screenX = _deviceToScreen->TransformX(deviceX); // 論理座標変換した座標を取得。
1107 @@ -374,32 +299,4 @@ void LAppView::ResizeSprite()
1108 _back->ResetRect(x, y, fWidth, fHeight);
1114 - GLuint id = _power->GetTextureId();
1115 - LAppTextureManager::TextureInfo* texInfo = textureManager->GetTextureInfoById(id);
1118 - x = static_cast<float>(width - texInfo->width * 0.5f);
1119 - y = static_cast<float>(texInfo->height * 0.5f);
1120 - fWidth = static_cast<float>(texInfo->width);
1121 - fHeight = static_cast<float>(texInfo->height);
1122 - _power->ResetRect(x, y, fWidth, fHeight);
1128 - GLuint id = _gear->GetTextureId();
1129 - LAppTextureManager::TextureInfo* texInfo = textureManager->GetTextureInfoById(id);
1132 - x = static_cast<float>(width - texInfo->width * 0.5f);
1133 - y = static_cast<float>(height - texInfo->height * 0.5f);
1134 - fWidth = static_cast<float>(texInfo->width);
1135 - fHeight = static_cast<float>(texInfo->height);
1136 - _gear->ResetRect(x, y, fWidth, fHeight);
1140 diff -pruN --exclude build ./demo_clean/src/LAppView.hpp ./demo_dev/src/LAppView.hpp
1141 --- ./demo_clean/src/LAppView.hpp 2021-02-17 01:23:17.000000000 +0000
1142 +++ ./demo_dev/src/LAppView.hpp 2021-04-28 12:18:50.952333251 +0100
1144 #include "CubismFramework.hpp"
1145 #include <Rendering/OpenGL/CubismOffscreenSurface_OpenGLES2.hpp>
1147 -class TouchManager;
1151 @@ -66,30 +65,6 @@ public:
1152 void ResizeSprite();
1155 - * @brief タッチされたときに呼ばれる。
1157 - * @param[in] pointX スクリーンX座標
1158 - * @param[in] pointY スクリーンY座標
1160 - void OnTouchesBegan(float pointX, float pointY) const;
1163 - * @brief タッチしているときにポインタが動いたら呼ばれる。
1165 - * @param[in] pointX スクリーンX座標
1166 - * @param[in] pointY スクリーンY座標
1168 - void OnTouchesMoved(float pointX, float pointY) const;
1171 - * @brief タッチが終了したら呼ばれる。
1173 - * @param[in] pointX スクリーンX座標
1174 - * @param[in] pointY スクリーンY座標
1176 - void OnTouchesEnded(float pointX, float pointY) const;
1179 * @brief X座標をView座標に変換する。
1181 * @param[in] deviceX デバイスX座標
1182 @@ -147,13 +122,10 @@ public:
1183 void SetRenderTargetClearColor(float r, float g, float b);
1186 - TouchManager* _touchManager; ///< タッチマネージャー
1187 Csm::CubismMatrix44* _deviceToScreen; ///< デバイスからスクリーンへの行列
1188 Csm::CubismViewMatrix* _viewMatrix; ///< viewMatrix
1189 GLuint _programId; ///< シェーダID
1190 LAppSprite* _back; ///< 背景画像
1191 - LAppSprite* _gear; ///< ギア画像
1192 - LAppSprite* _power; ///< 電源画像
1194 // レンダリング先を別ターゲットにする方式の場合に使用
1195 LAppSprite* _renderSprite; ///< モードによっては_renderBufferのテクスチャを描画
1196 diff -pruN --exclude build ./demo_clean/src/main.cpp ./demo_dev/src/main.cpp
1197 --- ./demo_clean/src/main.cpp 2021-02-17 01:23:17.000000000 +0000
1198 +++ ./demo_dev/src/main.cpp 2021-04-28 12:28:55.845339613 +0100
1200 * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
1204 +#include <stdexcept>
1210 +#ifdef __cpp_lib_filesystem
1211 +#include <filesystem>
1212 +namespace fs = std::filesystem;
1214 +#include <experimental/filesystem>
1215 +namespace fs = std::experimental::filesystem;
1218 +#include "ICubismModelSetting.hpp"
1219 #include "LAppDelegate.hpp"
1220 +#include "LAppLive2DManager.hpp"
1221 +#include "LAppModel.hpp"
1222 +#include "mouse_cursor_tracker.h"
1228 + std::string windowTitle;
1229 + std::string rootDir;
1230 + float scaleFactor;
1233 + std::string modelName;
1234 + bool oldId; // If true, translate new (Cubism 3+) parameter IDs to old (Cubism 2.1) IDs
1235 + std::string cfgPath; // Path to config file for MouseCursorTracker
1238 +CmdArgs parseArgv(int argc, char *argv[])
1240 + // I think the command-line args are simple enough to not justify using a library...
1242 + // Set default values
1243 + cmdArgs.windowWidth = 600;
1244 + cmdArgs.windowHeight = 600;
1245 + cmdArgs.windowTitle = "MouseTrackerForCubism example";
1246 + cmdArgs.rootDir = fs::current_path();
1247 + cmdArgs.scaleFactor = 4.5f;
1248 + cmdArgs.translateX = 0.0f;
1249 + cmdArgs.translateY = -3.1f;
1250 + cmdArgs.modelName = "Haru";
1251 + cmdArgs.oldId = false;
1252 + cmdArgs.cfgPath = "";
1257 + std::string arg = argv[i];
1258 + std::stringstream ss;
1260 + if (arg == "--window-width" || arg == "-W") // capital W for consistency with height
1262 + ss << argv[i + 1];
1263 + if (!(ss >> cmdArgs.windowWidth))
1265 + throw std::runtime_error("Invalid argument for window width");
1268 + else if (arg == "--window-height" || arg == "-H") // avoiding "-h", typically for help
1270 + ss << argv[i + 1];
1271 + if (!(ss >> cmdArgs.windowHeight))
1273 + throw std::runtime_error("Invalid argument for window height");
1276 + else if (arg == "--window-title" || arg == "-t")
1278 + cmdArgs.windowTitle = argv[i + 1];
1280 + else if (arg == "--root-dir" || arg == "-d")
1282 + cmdArgs.rootDir = argv[i + 1];
1284 + else if (arg == "--scale-factor" || arg == "-f")
1286 + ss << argv[i + 1];
1287 + if (!(ss >> cmdArgs.scaleFactor))
1289 + throw std::runtime_error("Invalid argument for scale factor");
1292 + else if (arg == "--translate-x" || arg == "-x")
1294 + ss << argv[i + 1];
1295 + if (!(ss >> cmdArgs.translateX))
1297 + throw std::runtime_error("Invalid argument for translate X");
1300 + else if (arg == "--translate-y" || arg == "-y")
1302 + ss << argv[i + 1];
1303 + if (!(ss >> cmdArgs.translateY))
1305 + throw std::runtime_error("Invalid argument for translate Y");
1308 + else if (arg == "--model" || arg == "-m")
1310 + cmdArgs.modelName = argv[i + 1];
1312 + else if (arg == "--config" || arg == "-c")
1314 + cmdArgs.cfgPath = argv[i + 1];
1316 + else if (arg == "--old-param-id" || arg == "-o")
1318 + cmdArgs.oldId = (argv[i + 1][0] == '1');
1322 + throw std::runtime_error("Unrecognized argument: " + arg);
1331 int main(int argc, char* argv[])
1333 - // create the application instance
1334 - if (LAppDelegate::GetInstance()->Initialize() == GL_FALSE)
1335 + auto cmdArgs = parseArgv(argc, argv);
1337 + LAppDelegate *delegate = LAppDelegate::GetInstance();
1339 + if (!delegate->Initialize(cmdArgs.windowWidth,
1340 + cmdArgs.windowHeight,
1341 + cmdArgs.windowTitle.c_str()))
1344 + throw std::runtime_error("Unable to initialize LAppDelegate");
1347 - LAppDelegate::GetInstance()->Run();
1348 + delegate->SetRootDirectory(cmdArgs.rootDir);
1350 + LAppLive2DManager *manager = LAppLive2DManager::GetInstance();
1351 + manager->SetModel(cmdArgs.modelName, cmdArgs.oldId);
1353 + manager->SetProjectionScaleTranslate(cmdArgs.scaleFactor,
1354 + cmdArgs.translateX,
1355 + cmdArgs.translateY);
1357 + LAppModel *model = manager->GetModel(0);
1358 + if (!model) throw std::runtime_error("model is null");
1360 + Live2D::Cubism::Framework::ICubismModelSetting *modelSetting = model->GetModelSetting();
1361 + if (!modelSetting) throw std::runtime_error("modelSetting is null");
1363 + std::vector<std::pair<std::string, int> > motions;
1364 + int motionGroupCount = modelSetting->GetMotionGroupCount();
1365 + for (int i = 0; i < motionGroupCount; i++)
1367 + const char *motionGroup = modelSetting->GetMotionGroupName(i);
1368 + int motionCount = modelSetting->GetMotionCount(motionGroup);
1369 + motions.push_back(std::make_pair(std::string(motionGroup), motionCount));
1372 + std::vector<std::string> expressions;
1373 + int expCount = modelSetting->GetExpressionCount();
1374 + for (int i = 0; i < expCount; i++)
1376 + const char *expName = modelSetting->GetExpressionName(i);
1377 + expressions.push_back(std::string(expName));
1380 + MouseCursorTracker tracker(cmdArgs.cfgPath, motions, expressions);
1382 + std::thread trackerThread(&MouseCursorTracker::mainLoop, &tracker);
1383 + manager->SetTracker(&tracker);
1388 + trackerThread.join();