diff -pruN --exclude build ./demo_clean/CMakeLists.txt ./demo_dev/CMakeLists.txt
---- ./demo_clean/CMakeLists.txt 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/CMakeLists.txt 2020-10-02 02:10:49.198928000 +0100
+--- ./demo_clean/CMakeLists.txt 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/CMakeLists.txt 2021-04-28 11:12:00.670568720 +0100
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.16)
# Set app name.
set(APP_NAME Demo)
# Set directory paths.
-set(SDK_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../..)
-+set(SDK_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../CubismSdkForNative-4-r.1)
++set(SDK_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../CubismSdkForNative-4-r.2)
set(CORE_PATH ${SDK_ROOT_PATH}/Core)
set(FRAMEWORK_PATH ${SDK_ROOT_PATH}/Framework)
set(THIRD_PARTY_PATH ${SDK_ROOT_PATH}/Samples/OpenGL/thirdParty)
#
# * USE_RENDER_TARGET
diff -pruN --exclude build ./demo_clean/scripts/make_gcc ./demo_dev/scripts/make_gcc
---- ./demo_clean/scripts/make_gcc 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/scripts/make_gcc 2020-10-02 02:10:49.198928000 +0100
+--- ./demo_clean/scripts/make_gcc 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/scripts/make_gcc 2021-04-28 10:37:28.857660858 +0100
@@ -9,5 +9,6 @@ BUILD_PATH=$SCRIPT_PATH/../build/make_gc
# Run CMake.
cmake -S "$CMAKE_PATH" \
+ -D USE_AVX_INSTRUCTIONS=1
+cd "$BUILD_PATH" && make -j4
diff -pruN --exclude build ./demo_clean/src/CMakeLists.txt ./demo_dev/src/CMakeLists.txt
---- ./demo_clean/src/CMakeLists.txt 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/CMakeLists.txt 2020-10-02 02:10:49.198928000 +0100
-@@ -19,6 +19,4 @@ target_sources(${APP_NAME}
+--- ./demo_clean/src/CMakeLists.txt 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/CMakeLists.txt 2021-04-28 11:04:05.970837042 +0100
+@@ -6,8 +6,6 @@ target_sources(${APP_NAME}
+ ${CMAKE_CURRENT_SOURCE_DIR}/LAppDefine.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/LAppDelegate.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/LAppDelegate.hpp
+- ${CMAKE_CURRENT_SOURCE_DIR}/LAppWavFileHandler.cpp
+- ${CMAKE_CURRENT_SOURCE_DIR}/LAppWavFileHandler.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/LAppLive2DManager.cpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/LAppLive2DManager.hpp
+ ${CMAKE_CURRENT_SOURCE_DIR}/LAppModel.cpp
+@@ -21,6 +19,4 @@ target_sources(${APP_NAME}
${CMAKE_CURRENT_SOURCE_DIR}/LAppView.cpp
${CMAKE_CURRENT_SOURCE_DIR}/LAppView.hpp
${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
- ${CMAKE_CURRENT_SOURCE_DIR}/TouchManager.hpp
)
diff -pruN --exclude build ./demo_clean/src/LAppDelegate.cpp ./demo_dev/src/LAppDelegate.cpp
---- ./demo_clean/src/LAppDelegate.cpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppDelegate.cpp 2020-10-02 02:10:49.198928000 +0100
+--- ./demo_clean/src/LAppDelegate.cpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppDelegate.cpp 2021-04-28 10:37:28.857660858 +0100
@@ -45,7 +45,8 @@ void LAppDelegate::ReleaseInstance()
s_instance = NULL;
}
Csm::csmVector<string> LAppDelegate::Split(const std::string& baseString, char delimiter)
diff -pruN --exclude build ./demo_clean/src/LAppDelegate.hpp ./demo_dev/src/LAppDelegate.hpp
---- ./demo_clean/src/LAppDelegate.hpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppDelegate.hpp 2020-10-02 02:10:49.198928000 +0100
+--- ./demo_clean/src/LAppDelegate.hpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppDelegate.hpp 2021-04-28 10:37:28.857660858 +0100
@@ -40,7 +40,8 @@ public:
/**
* @brief APPに必要なものを初期化する。
-
-};
diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src/LAppLive2DManager.cpp
---- ./demo_clean/src/LAppLive2DManager.cpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppLive2DManager.cpp 2021-01-02 12:03:47.315569210 +0000
-@@ -52,9 +52,10 @@ void LAppLive2DManager::ReleaseInstance(
+--- ./demo_clean/src/LAppLive2DManager.cpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppLive2DManager.cpp 2021-04-28 11:15:12.949734617 +0100
+@@ -52,11 +52,11 @@ void LAppLive2DManager::ReleaseInstance(
LAppLive2DManager::LAppLive2DManager()
: _viewMatrix(NULL)
+ , _translateX(0.0f)
+ , _translateY(0.0f)
{
+ _viewMatrix = new CubismMatrix44();
+-
- ChangeScene(_sceneIndex);
}
LAppLive2DManager::~LAppLive2DManager()
-@@ -98,26 +99,6 @@ void LAppLive2DManager::OnTap(csmFloat32
+@@ -100,26 +100,6 @@ void LAppLive2DManager::OnTap(csmFloat32
{
LAppPal::PrintLog("[APP]tap point: {x:%.2f y:%.2f}", x, y);
}
}
void LAppLive2DManager::OnUpdate() const
-@@ -125,7 +106,9 @@ void LAppLive2DManager::OnUpdate() const
- CubismMatrix44 projection;
- int width, height;
- glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &width, &height);
-- projection.Scale(1.0f, static_cast<float>(width) / static_cast<float>(height));
-+ projection.Scale(_projScaleFactor,
-+ _projScaleFactor * static_cast<float>(width) / static_cast<float>(height));
-+ projection.Translate(_translateX, _translateY);
+@@ -136,12 +116,15 @@ void LAppLive2DManager::OnUpdate() const
+ {
+ // 横に長いモデルを縦長ウィンドウに表示する際モデルの横サイズでscaleを算出する
+ model->GetModelMatrix()->SetWidth(2.0f);
+- projection.Scale(1.0f, static_cast<float>(width) / static_cast<float>(height));
++ projection.Scale(_projScaleFactor,
++ _projScaleFactor * static_cast<float>(width) / static_cast<float>(height));
+ }
+ else
+ {
+- projection.Scale(static_cast<float>(height) / static_cast<float>(width), 1.0f);
++ projection.Scale(_projScaleFactor * static_cast<float>(height) / static_cast<float>(width),
++ _projScaleFactor);
+ }
++ projection.Translate(_translateX, _translateY);
- if (_viewMatrix != NULL)
- {
-@@ -148,30 +131,14 @@ void LAppLive2DManager::OnUpdate() const
+ // 必要があればここで乗算
+ if (_viewMatrix != NULL)
+@@ -158,30 +141,14 @@ void LAppLive2DManager::OnUpdate() const
}
}
_models[0]->LoadAssets(modelPath.c_str(), modelJsonName.c_str());
/*
-@@ -193,7 +160,7 @@ void LAppLive2DManager::ChangeScene(Csm:
+@@ -203,7 +170,7 @@ void LAppLive2DManager::ChangeScene(Csm:
#if defined(USE_RENDER_TARGET) || defined(USE_MODEL_RENDER_TARGET)
// モデル個別にαを付けるサンプルとして、もう1体モデルを作成し、少し位置をずらす
_models[1]->LoadAssets(modelPath.c_str(), modelJsonName.c_str());
_models[1]->GetModelMatrix()->TranslateX(0.2f);
#endif
-@@ -215,3 +182,20 @@ csmUint32 LAppLive2DManager::GetModelNum
- {
- return _models.GetSize();
+@@ -232,3 +199,20 @@ void LAppLive2DManager::SetViewMatrix(Cu
+ _viewMatrix->GetArray()[i] = m->GetArray()[i];
+ }
}
+
+void LAppLive2DManager::SetFacialLandmarkDetector(FacialLandmarkDetector *detector)
+ _translateY = translateY;
+}
diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src/LAppLive2DManager.hpp
---- ./demo_clean/src/LAppLive2DManager.hpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppLive2DManager.hpp 2021-01-02 12:04:05.551573634 +0000
+--- ./demo_clean/src/LAppLive2DManager.hpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppLive2DManager.hpp 2021-04-28 10:37:28.861660915 +0100
@@ -6,12 +6,15 @@
*/
#pragma once
/**
* @brief モデル個数を得る
-@@ -89,6 +90,24 @@ public:
+@@ -94,6 +95,24 @@ public:
*/
- Csm::csmUint32 GetModelNum() const;
+ void SetViewMatrix(Live2D::Cubism::Framework::CubismMatrix44* m);
+ /**
+ * @brief Set the pointer to the FacialLandmarkDetector instance
private:
/**
* @brief コンストラクタ
-@@ -102,5 +121,8 @@ private:
+@@ -107,5 +126,8 @@ private:
Csm::CubismMatrix44* _viewMatrix; ///< モデル描画に用いるView行列
Csm::csmVector<LAppModel*> _models; ///< モデルインスタンスのコンテナ
+ float _translateY;
};
diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppModel.cpp
---- ./demo_clean/src/LAppModel.cpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppModel.cpp 2021-01-02 12:07:31.408109737 +0000
+--- ./demo_clean/src/LAppModel.cpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppModel.cpp 2021-04-28 11:05:07.099822871 +0100
@@ -21,6 +21,8 @@
#include "LAppTextureManager.hpp"
#include "LAppDelegate.hpp"
}
// 物理演算の設定
-@@ -396,17 +365,6 @@ void LAppModel::Update()
+@@ -396,22 +365,6 @@ void LAppModel::Update()
_physics->Evaluate(_model, deltaTimeSeconds);
}
- // リップシンクの設定
- if (_lipSync)
- {
-- csmFloat32 value = 0; // リアルタイムでリップシンクを行う場合、システムから音量を取得して0〜1の範囲で値を入力します。
+- // リアルタイムでリップシンクを行う場合、システムから音量を取得して0〜1の範囲で値を入力します。
+- csmFloat32 value = 0.0f;
+-
+- // 状態更新/RMS値取得
+- _wavFileHandler.Update(deltaTimeSeconds);
+- value = _wavFileHandler.GetRms();
-
- for (csmUint32 i = 0; i < _lipSyncIds.GetSize(); ++i)
- {
// ポーズの設定
if (_pose != NULL)
{
-@@ -626,3 +584,37 @@ Csm::Rendering::CubismOffscreenFrame_Ope
+@@ -480,7 +433,6 @@ CubismMotionQueueEntryHandle LAppModel::
+ {
+ csmString path = voice;
+ path = _modelHomeDir + path;
+- _wavFileHandler.Start(path);
+ }
+
+ if (_debugMode)
+@@ -632,3 +584,37 @@ Csm::Rendering::CubismOffscreenFrame_Ope
{
return _renderBuffer;
}
+}
+
diff -pruN --exclude build ./demo_clean/src/LAppModel.hpp ./demo_dev/src/LAppModel.hpp
---- ./demo_clean/src/LAppModel.hpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppModel.hpp 2021-01-02 12:04:43.079607236 +0000
-@@ -13,6 +13,7 @@
+--- ./demo_clean/src/LAppModel.hpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppModel.hpp 2021-04-28 11:10:19.540909609 +0100
+@@ -13,7 +13,7 @@
#include <Type/csmRectF.hpp>
#include <Rendering/OpenGL/CubismOffscreenSurface_OpenGLES2.hpp>
+-#include "LAppWavFileHandler.hpp"
+#include "facial_landmark_detector.h"
/**
* @brief ユーザーが実際に使用するモデルの実装クラス<br>
-@@ -24,8 +25,11 @@ class LAppModel : public Csm::CubismUser
+@@ -25,8 +25,11 @@ class LAppModel : public Csm::CubismUser
public:
/**
* @brief コンストラクタ
/**
* @brief デストラクタ
-@@ -113,6 +117,13 @@ public:
+@@ -114,6 +117,13 @@ public:
*/
Csm::Rendering::CubismOffscreenFrame_OpenGLES2& GetRenderBuffer();
protected:
/**
* @brief モデルを描画する処理。モデルを描画する空間のView-Projection行列を渡す。
-@@ -166,6 +177,17 @@ private:
+@@ -167,6 +177,17 @@ private:
*/
void ReleaseExpressions();
Csm::ICubismModelSetting* _modelSetting; ///< モデルセッティング情報
Csm::csmString _modelHomeDir; ///< モデルセッティングが置かれたディレクトリ
Csm::csmFloat32 _userTimeSeconds; ///< デルタ時間の積算値[秒]
-@@ -183,6 +205,8 @@ private:
+@@ -183,9 +204,9 @@ private:
+ const Csm::CubismId* _idParamEyeBallX; ///< パラメータID: ParamEyeBallX
const Csm::CubismId* _idParamEyeBallY; ///< パラメータID: ParamEyeBallXY
+- LAppWavFileHandler _wavFileHandler; ///< wavファイルハンドラ
+-
Csm::Rendering::CubismOffscreenFrame_OpenGLES2 _renderBuffer; ///< フレームバッファ以外の描画先
+
+ FacialLandmarkDetector *_detector;
diff -pruN --exclude build ./demo_clean/src/LAppPal.cpp ./demo_dev/src/LAppPal.cpp
---- ./demo_clean/src/LAppPal.cpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppPal.cpp 2020-10-02 02:10:49.202928000 +0100
+--- ./demo_clean/src/LAppPal.cpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppPal.cpp 2021-04-28 10:37:28.861660915 +0100
@@ -6,6 +6,7 @@
*/
}
file.read(buf, size);
diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.cpp ./demo_dev/src/LAppTextureManager.cpp
---- ./demo_clean/src/LAppTextureManager.cpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppTextureManager.cpp 2020-10-02 02:10:49.202928000 +0100
+--- ./demo_clean/src/LAppTextureManager.cpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppTextureManager.cpp 2021-04-28 10:37:28.861660915 +0100
@@ -96,6 +96,46 @@ LAppTextureManager::TextureInfo* LAppTex
}
{
for (Csm::csmUint32 i = 0; i < _textures.GetSize(); i++)
diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.hpp ./demo_dev/src/LAppTextureManager.hpp
---- ./demo_clean/src/LAppTextureManager.hpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppTextureManager.hpp 2020-10-02 02:10:49.202928000 +0100
+--- ./demo_clean/src/LAppTextureManager.hpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppTextureManager.hpp 2021-04-28 10:37:28.861660915 +0100
@@ -72,6 +72,8 @@ public:
*/
TextureInfo* CreateTextureFromPngFile(std::string fileName);
* @brief 画像の解放
*
diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView.cpp
---- ./demo_clean/src/LAppView.cpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppView.cpp 2020-10-02 02:10:49.202928000 +0100
+--- ./demo_clean/src/LAppView.cpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppView.cpp 2021-04-28 10:37:28.861660915 +0100
@@ -13,7 +13,6 @@
#include "LAppLive2DManager.hpp"
#include "LAppTextureManager.hpp"
}
void LAppView::Initialize()
-@@ -97,9 +89,6 @@ void LAppView::Initialize()
+@@ -107,9 +99,6 @@ void LAppView::Initialize()
void LAppView::Render()
{
_back->Render();
LAppLive2DManager* Live2DManager = LAppLive2DManager::GetInstance();
-@@ -139,35 +128,17 @@ void LAppView::InitializeSprite()
+@@ -151,35 +140,17 @@ void LAppView::InitializeSprite()
glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &width, &height);
LAppTextureManager* textureManager = LAppDelegate::GetInstance()->GetTextureManager();
// 画面全体を覆うサイズ
x = width * 0.5f;
y = height * 0.5f;
-@@ -175,52 +146,6 @@ void LAppView::InitializeSprite()
+@@ -187,52 +158,6 @@ void LAppView::InitializeSprite()
}
float LAppView::TransformViewX(float deviceX) const
{
float screenX = _deviceToScreen->TransformX(deviceX); // 論理座標変換した座標を取得。
-@@ -362,32 +287,4 @@ void LAppView::ResizeSprite()
+@@ -374,32 +299,4 @@ void LAppView::ResizeSprite()
_back->ResetRect(x, y, fWidth, fHeight);
}
}
- }
}
diff -pruN --exclude build ./demo_clean/src/LAppView.hpp ./demo_dev/src/LAppView.hpp
---- ./demo_clean/src/LAppView.hpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/LAppView.hpp 2020-10-02 02:10:49.202928000 +0100
+--- ./demo_clean/src/LAppView.hpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/LAppView.hpp 2021-04-28 10:37:28.861660915 +0100
@@ -14,7 +14,6 @@
#include "CubismFramework.hpp"
#include <Rendering/OpenGL/CubismOffscreenSurface_OpenGLES2.hpp>
// レンダリング先を別ターゲットにする方式の場合に使用
LAppSprite* _renderSprite; ///< モードによっては_renderBufferのテクスチャを描画
diff -pruN --exclude build ./demo_clean/src/main.cpp ./demo_dev/src/main.cpp
---- ./demo_clean/src/main.cpp 2020-01-30 05:45:00.000000000 +0000
-+++ ./demo_dev/src/main.cpp 2021-01-02 12:08:38.440444044 +0000
+--- ./demo_clean/src/main.cpp 2021-02-17 01:23:17.000000000 +0000
++++ ./demo_dev/src/main.cpp 2021-04-28 11:41:08.240877810 +0100
@@ -5,18 +5,162 @@
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
*/
+ cmdArgs.windowHeight = 600;
+ cmdArgs.windowTitle = "FacialLandmarksForCubism example";
+ cmdArgs.rootDir = fs::current_path();
-+ cmdArgs.scaleFactor = 8.0f;
++ cmdArgs.scaleFactor = 4.5f;
+ cmdArgs.translateX = 0.0f;
-+ cmdArgs.translateY = -2.8f;
++ cmdArgs.translateY = -3.1f;
+ cmdArgs.modelName = "Haru";
+ cmdArgs.oldId = false;
+ cmdArgs.cfgPath = "";