From: Adrian Iain Lam Date: Thu, 2 Apr 2026 20:12:24 +0000 (+0100) Subject: Upgrade to Cubism 5 Release R5. X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=b81aa13d6ea18f935247d9f6cdaf11632d99f55d;p=facial-landmarks-for-cubism.git Upgrade to Cubism 5 Release R5. Use new git-based patching mechanism. --- diff --git a/README.md b/README.md index 65b1bd2..619cc65 100644 --- a/README.md +++ b/README.md @@ -71,17 +71,17 @@ if you don't have C++17 support. To build the example program: -5. Download "Cubism 5 SDK for Native R4.1" from the Live2D website: +5. Download "Cubism 5 SDK for Native R5" from the Live2D website: . - Extract the archive -- put the "CubismSdkForNative-5-r.4.1" folder under + Extract the archive -- put the "CubismSdkForNative-5-r.5" folder under the "example" folder of this repo. Note: The Cubism SDK is the property of Live2D and is not part of this project. You must agree to Live2D's license agreements to use it. 6. Go into the - "example/CubismSdkForNative-5-r.4.1/Samples/OpenGL/thirdParty/scripts" + "example/CubismSdkForNative-5-r.5/Samples/OpenGL/thirdParty/scripts" directory and run ./setup_glew_glfw diff --git a/example/build.sh b/example/build.sh index 34bc808..00bb34a 100755 --- a/example/build.sh +++ b/example/build.sh @@ -1,13 +1,23 @@ #!/bin/sh -e +os=linux +patch=demo.patch +if [ "$OSTYPE" = "msys" -o "$OSTYPE" = "cygwin" ]; then + os=win + patch=demo_win.patch +fi + mkdir -p demo_build +cp -r CubismSdkForNative-5-r.5/Samples/OpenGL/Demo/proj."$os".cmake/* ./demo_build/ +cd demo_build +git init +git add . +git commit -m "Original example from CubismSdkForNative" +git apply ../"$patch" + if [ "$OSTYPE" = "msys" -o "$OSTYPE" = "cygwin" ]; then - cp -r CubismSdkForNative-5-r.4.1/Samples/OpenGL/Demo/proj.win.cmake/* ./demo_build/ - patch -d demo_build -p2 < demo_win.patch echo "Now go into ./demo_build/scripts and run the corresponding script for your MSVC version" else - cp -r CubismSdkForNative-5-r.4.1/Samples/OpenGL/Demo/proj.linux.cmake/* ./demo_build/ - patch -d demo_build -p2 < demo.patch - ./demo_build/scripts/make_gcc + ./scripts/make_gcc fi diff --git a/example/demo.patch b/example/demo.patch index 53a3c24..5b6ccdb 100644 --- a/example/demo.patch +++ b/example/demo.patch @@ -1,16 +1,17 @@ -diff -pruN --exclude build ./demo_clean/CMakeLists.txt ./demo_dev/CMakeLists.txt ---- ./demo_clean/CMakeLists.txt 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/CMakeLists.txt 2025-05-30 00:21:21.567335561 +0100 +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 45c4b1a..81273bc 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt @@ -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-5-r.4.1) ++set(SDK_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../CubismSdkForNative-5-r.5) set(CORE_PATH ${SDK_ROOT_PATH}/Core) set(FRAMEWORK_PATH ${SDK_ROOT_PATH}/Framework) set(THIRD_PARTY_PATH ${SDK_ROOT_PATH}/Samples/OpenGL/thirdParty) -@@ -35,7 +35,7 @@ set(GLFW_INSTALL OFF CACHE BOOL "" FORCE +@@ -35,7 +35,7 @@ set(GLFW_INSTALL OFF CACHE BOOL "" FORCE) set(BUILD_UTILS OFF CACHE BOOL "" FORCE) # Specify version of compiler. @@ -19,7 +20,7 @@ diff -pruN --exclude build ./demo_clean/CMakeLists.txt ./demo_dev/CMakeLists.txt set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -@@ -67,6 +67,9 @@ target_link_libraries(Framework Live2DCu +@@ -67,6 +67,9 @@ target_link_libraries(Framework Live2DCubismCore glew_s) # Find opengl libraries. find_package(OpenGL REQUIRED) @@ -42,9 +43,10 @@ diff -pruN --exclude build ./demo_clean/CMakeLists.txt ./demo_dev/CMakeLists.txt # Copy resource directory to build directory. add_custom_command( -diff -pruN --exclude build ./demo_clean/scripts/make_gcc ./demo_dev/scripts/make_gcc ---- ./demo_clean/scripts/make_gcc 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/scripts/make_gcc 2023-05-28 08:11:25.750067591 +0100 +diff --git a/scripts/make_gcc b/scripts/make_gcc +index 4441a91..71adb1a 100755 +--- a/scripts/make_gcc ++++ b/scripts/make_gcc @@ -5,42 +5,9 @@ set -ue SCRIPT_PATH=$(cd $(dirname $0) && pwd) CMAKE_PATH=$SCRIPT_PATH/.. @@ -90,9 +92,10 @@ diff -pruN --exclude build ./demo_clean/scripts/make_gcc ./demo_dev/scripts/make -cd "$BUILD_PATH" && make + -D CMAKE_BUILD_TYPE=Release +cd "$BUILD_PATH" && make -j4 -diff -pruN --exclude build ./demo_clean/src/LAppDelegate.cpp ./demo_dev/src/LAppDelegate.cpp ---- ./demo_clean/src/LAppDelegate.cpp 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/src/LAppDelegate.cpp 2025-05-30 00:26:43.606709298 +0100 +diff --git a/src/LAppDelegate.cpp b/src/LAppDelegate.cpp +index 242e3ca..2da992d 100644 +--- a/src/LAppDelegate.cpp ++++ b/src/LAppDelegate.cpp @@ -46,7 +46,8 @@ void LAppDelegate::ReleaseInstance() s_instance = NULL; } @@ -129,9 +132,10 @@ diff -pruN --exclude build ./demo_clean/src/LAppDelegate.cpp ./demo_dev/src/LApp // ウィンドウサイズ記憶 int width, height; glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &width, &height); -diff -pruN --exclude build ./demo_clean/src/LAppDelegate.hpp ./demo_dev/src/LAppDelegate.hpp ---- ./demo_clean/src/LAppDelegate.hpp 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/src/LAppDelegate.hpp 2025-05-30 00:27:33.073033913 +0100 +diff --git a/src/LAppDelegate.hpp b/src/LAppDelegate.hpp +index 89ea99b..50279fd 100644 +--- a/src/LAppDelegate.hpp ++++ b/src/LAppDelegate.hpp @@ -40,7 +40,8 @@ public: /** * @brief APPに必要なものを初期化する。 @@ -142,9 +146,10 @@ diff -pruN --exclude build ./demo_clean/src/LAppDelegate.hpp ./demo_dev/src/LApp /** * @brief 解放する。 -diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src/LAppLive2DManager.cpp ---- ./demo_clean/src/LAppLive2DManager.cpp 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/src/LAppLive2DManager.cpp 2025-05-30 00:44:31.339709983 +0100 +diff --git a/src/LAppLive2DManager.cpp b/src/LAppLive2DManager.cpp +index ac3d356..18973df 100644 +--- a/src/LAppLive2DManager.cpp ++++ b/src/LAppLive2DManager.cpp @@ -6,13 +6,7 @@ */ @@ -160,7 +165,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src #include #include #include -@@ -68,12 +62,11 @@ void LAppLive2DManager::ReleaseInstance( +@@ -69,12 +63,11 @@ void LAppLive2DManager::ReleaseInstance() LAppLive2DManager::LAppLive2DManager() : _viewMatrix(NULL) @@ -176,7 +181,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src } LAppLive2DManager::~LAppLive2DManager() -@@ -92,60 +85,6 @@ void LAppLive2DManager::ReleaseAllModel( +@@ -94,60 +87,6 @@ void LAppLive2DManager::ReleaseAllModel() _models.Clear(); } @@ -237,7 +242,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src LAppModel* LAppLive2DManager::GetModel(csmUint32 no) const { if (no < _models.GetSize()) -@@ -172,26 +111,6 @@ void LAppLive2DManager::OnTap(csmFloat32 +@@ -184,26 +123,6 @@ void LAppLive2DManager::OnTap(csmFloat32 x, csmFloat32 y) { LAppPal::PrintLogLn("[APP]tap point: {x:%.2f y:%.2f}", x, y); } @@ -264,7 +269,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src } void LAppLive2DManager::OnUpdate() const -@@ -215,12 +134,15 @@ void LAppLive2DManager::OnUpdate() const +@@ -230,12 +149,15 @@ void LAppLive2DManager::OnUpdate() const { // 横に長いモデルを縦長ウィンドウに表示する際モデルの横サイズでscaleを算出する model->GetModelMatrix()->SetWidth(2.0f); @@ -282,8 +287,8 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src // 必要があればここで乗算 if (_viewMatrix != NULL) -@@ -237,37 +159,15 @@ void LAppLive2DManager::OnUpdate() const - } +@@ -257,37 +179,15 @@ void LAppLive2DManager::OnUpdate() const + Csm::Rendering::CubismOffscreenManager_OpenGLES2::GetInstance()->ReleaseStaleRenderTextures(); } -void LAppLive2DManager::NextScene() @@ -325,7 +330,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src /* * モデル半透明表示を行うサンプルを提示する。 -@@ -288,8 +188,8 @@ void LAppLive2DManager::ChangeScene(Csm: +@@ -308,8 +208,8 @@ void LAppLive2DManager::ChangeScene(Csm::csmInt32 index) #if defined(USE_RENDER_TARGET) || defined(USE_MODEL_RENDER_TARGET) // モデル個別にαを付けるサンプルとして、もう1体モデルを作成し、少し位置をずらす @@ -336,7 +341,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src _models[1]->GetModelMatrix()->TranslateX(0.2f); #endif -@@ -317,3 +217,20 @@ void LAppLive2DManager::SetViewMatrix(Cu +@@ -337,3 +237,20 @@ void LAppLive2DManager::SetViewMatrix(CubismMatrix44* m) _viewMatrix->GetArray()[i] = m->GetArray()[i]; } } @@ -357,9 +362,10 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src + _translateX = translateX; + _translateY = translateY; +} -diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src/LAppLive2DManager.hpp ---- ./demo_clean/src/LAppLive2DManager.hpp 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/src/LAppLive2DManager.hpp 2025-05-30 00:29:35.257630136 +0100 +diff --git a/src/LAppLive2DManager.hpp b/src/LAppLive2DManager.hpp +index 2c9939c..1d9755c 100644 +--- a/src/LAppLive2DManager.hpp ++++ b/src/LAppLive2DManager.hpp @@ -6,12 +6,15 @@ */ #pragma once @@ -376,10 +382,11 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src /** * @brief サンプルアプリケーションにおいてCubismModelを管理するクラス
* モデル生成と破棄、タップイベントの処理、モデル切り替えを行う。 -@@ -36,24 +39,6 @@ public: +@@ -35,24 +38,6 @@ public: + */ static void ReleaseInstance(); - /** +- /** - * @brief Resources フォルダにあるモデルフォルダ名をセットする - * - */ @@ -397,11 +404,10 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src - */ - Csm::csmInt32 GetModelDirSize() const; - -- /** + /** * @brief 現在のシーンで保持しているモデルを返す * - * @param[in] no モデルリストのインデックス値 -@@ -90,16 +75,14 @@ public: +@@ -98,16 +83,14 @@ public: void OnUpdate() const; /** @@ -426,7 +432,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src /** * @brief モデル個数を得る -@@ -112,6 +95,24 @@ public: +@@ -120,6 +103,24 @@ public: */ void SetViewMatrix(Live2D::Cubism::Framework::CubismMatrix44* m); @@ -451,7 +457,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src private: /** * @brief コンストラクタ -@@ -125,7 +126,8 @@ private: +@@ -133,7 +134,8 @@ private: Csm::CubismMatrix44* _viewMatrix; ///< モデル描画に用いるView行列 Csm::csmVector _models; ///< モデルインスタンスのコンテナ @@ -462,12 +468,13 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src + float _translateX; + float _translateY; }; -diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppModel.cpp ---- ./demo_clean/src/LAppModel.cpp 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/src/LAppModel.cpp 2025-05-30 00:31:25.128030278 +0100 -@@ -21,26 +21,30 @@ - #include "LAppTextureManager.hpp" - #include "LAppDelegate.hpp" +diff --git a/src/LAppModel.cpp b/src/LAppModel.cpp +index 7b8e0ea..48a4128 100644 +--- a/src/LAppModel.cpp ++++ b/src/LAppModel.cpp +@@ -28,27 +28,31 @@ + #include "Motion/CubismPhysicsUpdater.hpp" + #include "Motion/CubismPoseUpdater.hpp" +#include "facial_landmark_detector.h" + @@ -480,6 +487,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod : LAppModel_Common() , _modelSetting(NULL) , _userTimeSeconds(0.0f) + , _motionUpdated(false) + , _detector(nullptr) + , _useOldParamId(useOldParamId) { @@ -503,7 +511,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod } LAppModel::~LAppModel() -@@ -114,33 +118,6 @@ void LAppModel::SetupModel(ICubismModelS +@@ -122,36 +126,6 @@ void LAppModel::SetupModel(ICubismModelSetting* setting) DeleteBuffer(buffer, path.GetRawString()); } @@ -532,12 +540,15 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod - - DeleteBuffer(buffer, path.GetRawString()); - } +- +- CubismExpressionUpdater* expression = CSM_NEW CubismExpressionUpdater(*_expressionManager); +- _updateScheduler.AddUpdatableList(expression); - } - //Physics if (strcmp(_modelSetting->GetPhysicsFileName(), "") != 0) { -@@ -179,7 +156,7 @@ void LAppModel::SetupModel(ICubismModelS +@@ -207,7 +181,7 @@ void LAppModel::SetupModel(ICubismModelSetting* setting) breathParameters.PushBack(CubismBreath::BreathParameterData(_idParamAngleY, 0.0f, 8.0f, 3.5345f, 0.5f)); breathParameters.PushBack(CubismBreath::BreathParameterData(_idParamAngleZ, 0.0f, 10.0f, 5.5345f, 0.5f)); breathParameters.PushBack(CubismBreath::BreathParameterData(_idParamBodyAngleX, 0.0f, 4.0f, 15.5345f, 0.5f)); @@ -545,8 +556,8 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod + breathParameters.PushBack(CubismBreath::BreathParameterData(CubismFramework::GetIdManager()->GetId(_(ParamBreath)), 0.5f, 0.5f, 3.2345f, 0.5f)); _breath->SetParameters(breathParameters); - } -@@ -203,21 +180,6 @@ void LAppModel::SetupModel(ICubismModelS + +@@ -234,45 +208,6 @@ void LAppModel::SetupModel(ICubismModelSetting* setting) } } @@ -557,8 +568,32 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod - { - _lipSyncIds.PushBack(_modelSetting->GetLipSyncParameterId(i)); - } +- +- CubismLipSyncUpdater* lipSync = CSM_NEW CubismLipSyncUpdater(_lipSyncIds, _wavFileHandler); +- _updateScheduler.AddUpdatableList(lipSync); +- } +- +- // Look +- { +- _look = CubismLook::Create(); +- +- csmVector lookParameters; +- +- lookParameters.PushBack(CubismLook::LookParameterData(_idParamAngleX, 30.0f)); +- lookParameters.PushBack(CubismLook::LookParameterData(_idParamAngleY, 0.0f, 30.0f)); +- lookParameters.PushBack(CubismLook::LookParameterData(_idParamAngleZ, 0.0f, 0.0f, -30.0f)); +- lookParameters.PushBack(CubismLook::LookParameterData(_idParamBodyAngleX, 10.0f)); +- lookParameters.PushBack(CubismLook::LookParameterData(_idParamEyeBallX, 1.0f)); +- lookParameters.PushBack(CubismLook::LookParameterData(_idParamEyeBallY, 0.0f, 1.0f)); +- +- _look->SetParameters(lookParameters); +- +- CubismLookUpdater* look = CSM_NEW CubismLookUpdater(*_look, *_dragManager); +- _updateScheduler.AddUpdatableList(look); - } - +- _updateScheduler.SortUpdatableList(); +- - if (_modelSetting == NULL || _modelMatrix == NULL) - { - LAppPal::PrintLogLn("Failed to SetupModel()."); @@ -568,16 +603,12 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod //Layout csmMap layout; _modelSetting->GetLayoutMap(layout); -@@ -322,62 +284,57 @@ void LAppModel::Update() +@@ -377,27 +312,70 @@ void LAppModel::Update() const csmFloat32 deltaTimeSeconds = LAppPal::GetDeltaTime(); _userTimeSeconds += deltaTimeSeconds; -- _dragManager->Update(deltaTimeSeconds); -- _dragX = _dragManager->GetX(); -- _dragY = _dragManager->GetY(); -- - // モーションによるパラメータ更新の有無 -- csmBool motionUpdated = false; +- _motionUpdated = false; - - //----------------------------------------------------------------- - _model->LoadParameters(); // 前回セーブされた状態をロード @@ -586,62 +617,24 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod { - // モーションの再生がない場合、待機モーションの中からランダムで再生する - StartRandomMotion(MotionGroupIdle, PriorityIdle); -- } -- else -- { -- motionUpdated = _motionManager->UpdateMotion(_model, deltaTimeSeconds); // モーションを更新 -- } -- _model->SaveParameters(); // 状態を保存 -- //----------------------------------------------------------------- + auto idMan = CubismFramework::GetIdManager(); + auto params = _detector->getParams(); - -- // 不透明度 -- _opacity = _model->GetModelOpacity(); -- -- // まばたき -- if (!motionUpdated) -- { -- if (_eyeBlink != NULL) ++ + // NOTE: Apparently, this LoadParameters/SaveParameters pair + // is needed for auto breath to work. + _model->LoadParameters(); // 前回セーブされた状態をロード + if (_motionManager->IsFinished() && params.randomMotion) - { -- // メインモーションの更新がないとき -- _eyeBlink->UpdateParameters(_model, deltaTimeSeconds); // 目パチ ++ { + // モーションの再生がない場合、待機モーションの中からランダムで再生する + StartRandomMotion(MotionGroupIdle, PriorityIdle); - } -- } -- -- if (_expressionManager != NULL) -- { -- _expressionManager->UpdateMotion(_model, deltaTimeSeconds); // 表情でパラメータ更新(相対変化) -- } -- -- //ドラッグによる変化 -- //ドラッグによる顔の向きの調整 -- _model->AddParameterValue(_idParamAngleX, _dragX * 30); // -30から30の値を加える -- _model->AddParameterValue(_idParamAngleY, _dragY * 30); -- _model->AddParameterValue(_idParamAngleZ, _dragX * _dragY * -30); -- -- //ドラッグによる体の向きの調整 -- _model->AddParameterValue(_idParamBodyAngleX, _dragX * 10); // -10から10の値を加える ++ } + else + { + _motionManager->UpdateMotion(_model, deltaTimeSeconds); // モーションを更新 + } + _model->SaveParameters(); // 状態を保存 - -- //ドラッグによる目の向きの調整 -- _model->AddParameterValue(_idParamEyeBallX, _dragX); // -1から1の値を加える -- _model->AddParameterValue(_idParamEyeBallY, _dragY); - -- // 呼吸など -- if (_breath != NULL) -- { -- _breath->UpdateParameters(_model, deltaTimeSeconds); ++ ++ + if (params.autoBlink && _eyeBlink) + { + _eyeBlink->UpdateParameters(_model, deltaTimeSeconds); @@ -674,32 +667,30 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod + _breath->UpdateParameters(_model, deltaTimeSeconds); + } } - - // 物理演算の設定 -@@ -386,22 +343,6 @@ void LAppModel::Update() - _physics->Evaluate(_model, deltaTimeSeconds); +- else ++ ++ // 物理演算の設定 ++ if (_physics != NULL) + { +- _motionUpdated = _motionManager->UpdateMotion(_model, deltaTimeSeconds); // モーションを更新 ++ _physics->Evaluate(_model, deltaTimeSeconds); } - -- // リップシンクの設定 -- if (_lipSync) -- { -- // リアルタイムでリップシンクを行う場合、システムから音量を取得して0〜1の範囲で値を入力します。 -- csmFloat32 value = 0.0f; -- -- // 状態更新/RMS値取得 -- _wavFileHandler.Update(deltaTimeSeconds); -- value = _wavFileHandler.GetRms(); -- -- for (csmUint32 i = 0; i < _lipSyncIds.GetSize(); ++i) -- { -- _model->AddParameterValue(_lipSyncIds[i], value, 0.8f); -- } -- } +- _model->SaveParameters(); // 状態を保存 +- //----------------------------------------------------------------- - - // ポーズの設定 - if (_pose != NULL) - { -@@ -464,7 +405,6 @@ CubismMotionQueueEntryHandle LAppModel:: +- // 不透明度 +- _opacity = _model->GetModelOpacity(); + +- _updateScheduler.OnLateUpdate(_model, deltaTimeSeconds); ++ // ポーズの設定 ++ if (_pose != NULL) ++ { ++ _pose->UpdateParameters(_model, deltaTimeSeconds); ++ } + + _model->Update(); + +@@ -455,7 +433,6 @@ CubismMotionQueueEntryHandle LAppModel::StartMotion(const csmChar* group, csmInt { csmString path = voice; path = _modelHomeDir + path; @@ -707,7 +698,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod } if (_debugMode) -@@ -616,3 +556,37 @@ Csm::Rendering::CubismOffscreenSurface_O +@@ -607,3 +584,37 @@ Csm::Rendering::CubismRenderTarget_OpenGLES2& LAppModel::GetRenderBuffer() { return _renderBuffer; } @@ -745,12 +736,13 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod + return csmString(ans.c_str()); +} + -diff -pruN --exclude build ./demo_clean/src/LAppModel.hpp ./demo_dev/src/LAppModel.hpp ---- ./demo_clean/src/LAppModel.hpp 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/src/LAppModel.hpp 2025-05-30 00:31:59.753598558 +0100 +diff --git a/src/LAppModel.hpp b/src/LAppModel.hpp +index 2637a54..3c0e83a 100644 +--- a/src/LAppModel.hpp ++++ b/src/LAppModel.hpp @@ -12,8 +12,8 @@ #include - #include + #include -#include "LAppWavFileHandler_Common.hpp" #include "LAppModel_Common.hpp" @@ -758,7 +750,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.hpp ./demo_dev/src/LAppMod /** * @brief ユーザーが実際に使用するモデルの実装クラス
-@@ -25,8 +25,11 @@ class LAppModel : public LAppModel_Commo +@@ -25,8 +25,11 @@ class LAppModel : public LAppModel_Common public: /** * @brief コンストラクタ @@ -773,7 +765,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.hpp ./demo_dev/src/LAppMod * @brief デストラクタ @@ -116,6 +119,13 @@ public: */ - Csm::Rendering::CubismOffscreenSurface_OpenGLES2& GetRenderBuffer(); + Csm::Rendering::CubismRenderTarget_OpenGLES2& GetRenderBuffer(); + /** + * @brief Set the pointer to the FacialLandmarkDetector instance @@ -803,23 +795,21 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.hpp ./demo_dev/src/LAppMod Csm::ICubismModelSetting* _modelSetting; ///< モデルセッティング情報 Csm::csmString _modelHomeDir; ///< モデルセッティングが置かれたディレクトリ Csm::csmFloat32 _userTimeSeconds; ///< デルタ時間の積算値[秒] -@@ -185,7 +206,10 @@ private: - const Csm::CubismId* _idParamEyeBallX; ///< パラメータID: ParamEyeBallX - const Csm::CubismId* _idParamEyeBallY; ///< パラメータID: ParamEyeBallXY +@@ -187,7 +208,7 @@ private: + + Csm::csmBool _motionUpdated; ///< モーション更新フラグ - LAppWavFileHandler_Common _wavFileHandler; ///< wavファイルハンドラ - - Csm::Rendering::CubismOffscreenSurface_OpenGLES2 _renderBuffer; ///< フレームバッファ以外の描画先 + Csm::Rendering::CubismRenderTarget_OpenGLES2 _renderBuffer; ///< フレームバッファ以外の描画先 + + FacialLandmarkDetector *_detector; }; -+ -+ -+ -diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.cpp ./demo_dev/src/LAppTextureManager.cpp ---- ./demo_clean/src/LAppTextureManager.cpp 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/src/LAppTextureManager.cpp 2025-05-30 00:33:38.759669165 +0100 -@@ -96,6 +96,46 @@ LAppTextureManager::TextureInfo* LAppTex +diff --git a/src/LAppTextureManager.cpp b/src/LAppTextureManager.cpp +index 97cec74..191bdc0 100644 +--- a/src/LAppTextureManager.cpp ++++ b/src/LAppTextureManager.cpp +@@ -96,6 +96,46 @@ LAppTextureManager::TextureInfo* LAppTextureManager::CreateTextureFromPngFile(st } @@ -866,9 +856,10 @@ diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.cpp ./demo_dev/sr void LAppTextureManager::ReleaseTextures() { for (Csm::csmUint32 i = 0; i < _texturesInfo.GetSize(); i++) -diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.hpp ./demo_dev/src/LAppTextureManager.hpp ---- ./demo_clean/src/LAppTextureManager.hpp 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/src/LAppTextureManager.hpp 2025-05-30 00:33:05.342204345 +0100 +diff --git a/src/LAppTextureManager.hpp b/src/LAppTextureManager.hpp +index a6713df..a42a112 100644 +--- a/src/LAppTextureManager.hpp ++++ b/src/LAppTextureManager.hpp @@ -41,6 +41,8 @@ public: */ TextureInfo* CreateTextureFromPngFile(std::string fileName); @@ -878,10 +869,11 @@ diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.hpp ./demo_dev/sr /** * @brief 画像の解放 * -diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView.cpp ---- ./demo_clean/src/LAppView.cpp 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/src/LAppView.cpp 2025-05-30 00:38:38.310466491 +0100 -@@ -81,9 +81,6 @@ void LAppView::Initialize(int width, int +diff --git a/src/LAppView.cpp b/src/LAppView.cpp +index 4e42040..ed4c4b9 100644 +--- a/src/LAppView.cpp ++++ b/src/LAppView.cpp +@@ -84,9 +84,6 @@ void LAppView::Initialize(int width, int height) void LAppView::Render() { _back->Render(); @@ -891,7 +883,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView LAppLive2DManager* Live2DManager = LAppLive2DManager::GetInstance(); -@@ -125,35 +122,17 @@ void LAppView::InitializeSprite() +@@ -128,36 +125,17 @@ void LAppView::InitializeSprite() glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &width, &height); LAppTextureManager* textureManager = LAppDelegate::GetInstance()->GetTextureManager(); @@ -905,8 +897,9 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView float x = width * 0.5f; float y = height * 0.5f; -- float fWidth = static_cast(backgroundTexture->width * 2.0f); - float fHeight = static_cast(height) * 0.95f; +- float ratio = fHeight / static_cast(backgroundTexture->height); +- float fWidth = static_cast(backgroundTexture->width) * ratio; + float fWidth = static_cast(width); + float fHeight = static_cast(height); _back = new LAppSprite(x, y, fWidth, fHeight, backgroundTexture->id, programId); @@ -932,7 +925,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView // 画面全体を覆うサイズ x = width * 0.5f; y = height * 0.5f; -@@ -192,18 +171,6 @@ void LAppView::OnTouchesEnded(float px, +@@ -196,18 +174,6 @@ void LAppView::OnTouchesEnded(float px, float py) const LAppPal::PrintLogLn("[APP]touchesEnded x:%.2f y:%.2f", x, y); } live2DManager->OnTap(x, y); @@ -951,9 +944,10 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView } } -diff -pruN --exclude build ./demo_clean/src/main.cpp ./demo_dev/src/main.cpp ---- ./demo_clean/src/main.cpp 2025-05-28 10:36:54.000000000 +0100 -+++ ./demo_dev/src/main.cpp 2025-05-30 00:34:06.180000583 +0100 +diff --git a/src/main.cpp b/src/main.cpp +index b65c1f0..8bb3d38 100644 +--- a/src/main.cpp ++++ b/src/main.cpp @@ -5,18 +5,160 @@ * that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html. */ diff --git a/example/generate_patch.sh b/example/generate_patch.sh index 164341f..99a892b 100755 --- a/example/generate_patch.sh +++ b/example/generate_patch.sh @@ -1,11 +1,7 @@ #!/bin/sh -mkdir -p demo_clean - if [ "$OSTYPE" = "msys" -o "$OSTYPE" = "cygwin" ]; then - cp -p -r CubismSdkForNative-5-r.4.1/Samples/OpenGL/Demo/proj.win.cmake/* ./demo_clean/ - diff -pruN --exclude build ./demo_clean ./demo_dev > ./demo_win.patch + git -C demo_dev diff orig > ./demo_win.patch else - cp -p -r CubismSdkForNative-5-r.4.1/Samples/OpenGL/Demo/proj.linux.cmake/* ./demo_clean/ - diff -pruN --exclude build ./demo_clean ./demo_dev > ./demo.patch + git -C demo_dev diff orig > ./demo.patch fi diff --git a/example/upgrade.sh b/example/upgrade.sh new file mode 100755 index 0000000..f282607 --- /dev/null +++ b/example/upgrade.sh @@ -0,0 +1,22 @@ +#!/bin/bash -e + +if [[ "$1" == "-h" || "$1" == "--help" ]]; then + echo "Example usage:" + echo "./upgrade.sh ./CubismSdkForNative-5-r.5" + exit 0 +fi + +os=linux +if [ "$OSTYPE" = "msys" -o "$OSTYPE" = "cygwin" ]; then + os=win +fi + +git -C demo_dev checkout orig +cp -r "$1"/Samples/OpenGL/Demo/proj."$os".cmake/* ./demo_dev/ +cd demo_dev +git add . +git commit -m "$(basename $1) $os" +git checkout master +git merge orig + +echo "Now resolve conflicts, build, and test..."