From bd458da1d15cd220a03a8e25ae2b313058ffad95 Mon Sep 17 00:00:00 2001 From: Adrian Lam <adrianiainlam@users.noreply.github.com> Date: Thu, 28 Mar 2024 18:32:56 +0000 Subject: [PATCH] Upgrade to Cubism 5 Release R1. Windows version. --- example/demo_win.patch | 1399 +++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 1201 insertions(+), 198 deletions(-) diff --git a/example/demo_win.patch b/example/demo_win.patch index 9a80fbe..3191080 100644 --- a/example/demo_win.patch +++ b/example/demo_win.patch @@ -1,12 +1,12 @@ diff -pruN --exclude build ./demo_clean/CMakeLists.txt ./demo_dev/CMakeLists.txt ---- ./demo_clean/CMakeLists.txt 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/CMakeLists.txt 2023-05-28 08:28:27.492813451 +0100 +--- ./demo_clean/CMakeLists.txt 2024-03-28 18:19:03.168248400 +0000 ++++ ./demo_dev/CMakeLists.txt 2024-03-28 18:23:33.549413300 +0000 @@ -9,7 +9,7 @@ option( # 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.7) ++set(SDK_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../CubismSdkForNative-5-r.1) set(CORE_PATH ${SDK_ROOT_PATH}/Core) set(FRAMEWORK_PATH ${SDK_ROOT_PATH}/Framework) set(THIRD_PARTY_PATH ${SDK_ROOT_PATH}/Samples/OpenGL/thirdParty) @@ -46,8 +46,8 @@ diff -pruN --exclude build ./demo_clean/CMakeLists.txt ./demo_dev/CMakeLists.txt target_compile_options(${APP_NAME} PRIVATE /MP) diff -pruN --exclude build ./demo_clean/src/CMakeLists.txt ./demo_dev/src/CMakeLists.txt ---- ./demo_clean/src/CMakeLists.txt 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/CMakeLists.txt 2023-05-28 08:28:27.492813451 +0100 +--- ./demo_clean/src/CMakeLists.txt 2024-03-28 18:19:03.998153300 +0000 ++++ ./demo_dev/src/CMakeLists.txt 2023-03-05 23:22:10.976777100 +0000 @@ -1,49 +1,22 @@ -if (CSM_MINIMUM_DEMO) - target_sources(${APP_NAME} @@ -112,8 +112,8 @@ diff -pruN --exclude build ./demo_clean/src/CMakeLists.txt ./demo_dev/src/CMakeL + ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp +) diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.cpp ./demo_dev/src/CubismUserModelExtend.cpp ---- ./demo_clean/src/CubismUserModelExtend.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/CubismUserModelExtend.cpp 2023-05-28 08:28:27.492813451 +0100 +--- ./demo_clean/src/CubismUserModelExtend.cpp 2024-03-28 18:19:03.868189000 +0000 ++++ ./demo_dev/src/CubismUserModelExtend.cpp 2023-03-05 23:22:10.780128700 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -134,7 +134,8 @@ diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.cpp ./demo_dev } -std::string CubismUserModelExtend::MakeAssetPath(const std::string& assetFileName) --{ ++void CubismUserModelExtend::LoadAssets(const Csm::csmChar* fileName) + { - return _currentModelDirectory + assetFileName; -} - @@ -142,10 +143,11 @@ diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.cpp ./demo_dev -{ - _currentModelDirectory = path; -} -- ++ csmSizeInt size; ++ const csmString path = csmString(_currentModelDirectory.c_str()) + fileName; + -void CubismUserModelExtend::LoadAsset(const std::string & fiileName, const std::function<void(Csm::csmByte*, Csm::csmSizeInt)>& afterLoadCallback) -+void CubismUserModelExtend::LoadAssets(const Csm::csmChar* fileName) - { +-{ - Csm::csmSizeInt bufferSize = 0; - Csm::csmByte* buffer = nullptr; - @@ -153,18 +155,16 @@ diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.cpp ./demo_dev - { - return; - } -- -- // ãããã¡ã®è¨å® -- buffer = LAppPal::LoadFileAsBytes(MakeAssetPath(fiileName).c_str(), &bufferSize); -+ csmSizeInt size; -+ const csmString path = csmString(_currentModelDirectory.c_str()) + fileName; - -- // ã³ã¼ã«ããã¯é¢æ°ã®å¼ã³åºã -- afterLoadCallback(buffer, bufferSize); + csmByte* buffer = CreateBuffer(path.GetRawString(), &size); + _modelJson = new CubismModelSettingJson(buffer, size); + DeleteBuffer(buffer, path.GetRawString()); +- // ãããã¡ã®è¨å® +- buffer = LAppPal::LoadFileAsBytes(MakeAssetPath(fiileName).c_str(), &bufferSize); +- +- // ã³ã¼ã«ããã¯é¢æ°ã®å¼ã³åºã +- afterLoadCallback(buffer, bufferSize); +- - // ãããã¡ã®è§£æ¾ - LAppPal::ReleaseBytes(buffer); + // ã¢ãã«ã®çæ @@ -172,7 +172,7 @@ diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.cpp ./demo_dev } void CubismUserModelExtend::SetupModel() -@@ -109,40 +92,75 @@ void CubismUserModelExtend::SetupModel() +@@ -109,44 +92,75 @@ void CubismUserModelExtend::SetupModel() _updating = true; _initialized = false; @@ -201,25 +201,28 @@ diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.cpp ./demo_dev - LoadAsset(_modelJson->GetExpressionFileName(expressionIndex), [=](Csm::csmByte* buffer, Csm::csmSizeInt bufferSize) { - auto expressionName = _modelJson->GetExpressionName(expressionIndex); - ACubismMotion* motion = LoadExpression(buffer, bufferSize, expressionName); -- if (_expressions[expressionName]) + const csmInt32 count = _modelJson->GetExpressionCount(); + for (csmInt32 i = 0; i < count; i++) + { + csmString name = _modelJson->GetExpressionName(i); + csmString path = _modelJson->GetExpressionFileName(i); + path = csmString(_currentModelDirectory.c_str()) + path; -+ + +- if (motion) + buffer = CreateBuffer(path.GetRawString(), &size); + ACubismMotion* motion = LoadExpression(buffer, size, name.GetRawString()); + + if (_expressions[name]) { -- ACubismMotion::Delete(_expressions[expressionName]); -- _expressions[expressionName] = nullptr; +- if (_expressions[expressionName]) +- { +- ACubismMotion::Delete(_expressions[expressionName]); +- _expressions[expressionName] = nullptr; +- } +- _expressions[expressionName] = motion; + ACubismMotion::Delete(_expressions[name]); + _expressions[name] = nullptr; } -- _expressions[expressionName] = motion; - }); + _expressions[name] = motion; + @@ -270,7 +273,89 @@ diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.cpp ./demo_dev // Layout csmMap<csmString, csmFloat32> layout; -@@ -345,16 +363,6 @@ void CubismUserModelExtend::ModelParamUp +@@ -196,29 +210,26 @@ void CubismUserModelExtend::PreloadMotio + // ã¢ã¼ã·ã§ã³ãã¼ã¿ã®èªã¿è¾¼ã¿ + CubismMotion* tmpMotion = static_cast<CubismMotion*>(LoadMotion(buffer, size, name.GetRawString())); + +- if (tmpMotion) ++ // ãã§ã¼ãã¤ã³ã®æéãåå¾ ++ csmFloat32 fadeTime = _modelJson->GetMotionFadeInTimeValue(group, i); ++ if (fadeTime >= 0.0f) + { +- // ãã§ã¼ãã¤ã³ã®æéãåå¾ +- csmFloat32 fadeTime = _modelJson->GetMotionFadeInTimeValue(group, i); +- if (fadeTime >= 0.0f) +- { +- tmpMotion->SetFadeInTime(fadeTime); +- } ++ tmpMotion->SetFadeInTime(fadeTime); ++ } + +- // ãã§ã¼ãã¢ã¦ãã®æéãåå¾ +- fadeTime = _modelJson->GetMotionFadeOutTimeValue(group, i); +- if (fadeTime >= 0.0f) +- { +- tmpMotion->SetFadeOutTime(fadeTime); +- } ++ // ãã§ã¼ãã¢ã¦ãã®æéãåå¾ ++ fadeTime = _modelJson->GetMotionFadeOutTimeValue(group, i); ++ if (fadeTime >= 0.0f) ++ { ++ tmpMotion->SetFadeOutTime(fadeTime); ++ } + +- if (_motions[name]) +- { +- // ã¤ã³ã¹ã¿ã³ã¹ãç ´æ£ +- ACubismMotion::Delete(_motions[name]); +- } +- _motions[name] = tmpMotion; ++ if (_motions[name]) ++ { ++ // ã¤ã³ã¹ã¿ã³ã¹ãç ´æ£ ++ ACubismMotion::Delete(_motions[name]); + } ++ _motions[name] = tmpMotion; + + DeleteBuffer(buffer, path.GetRawString()); + } +@@ -292,24 +303,21 @@ Csm::CubismMotionQueueEntryHandle Cubism + // ä¸çªå é ã®ã¢ã¼ã·ã§ã³ãèªã¿è¾¼ã + motion = static_cast<CubismMotion*>(LoadMotion(buffer, size, NULL, onFinishedMotionHandler)); + +- if (motion) ++ csmFloat32 fadeTime = _modelJson->GetMotionFadeInTimeValue(group, no); ++ if (fadeTime >= 0.0f) + { +- csmFloat32 fadeTime = _modelJson->GetMotionFadeInTimeValue(group, no); +- if (fadeTime >= 0.0f) +- { +- motion->SetFadeInTime(fadeTime); +- } +- +- fadeTime = _modelJson->GetMotionFadeOutTimeValue(group, no); +- if (fadeTime >= 0.0f) +- { +- motion->SetFadeOutTime(fadeTime); +- } ++ motion->SetFadeInTime(fadeTime); ++ } + +- // çµäºæã«ã¡ã¢ãªããåé¤ +- autoDelete = true; ++ fadeTime = _modelJson->GetMotionFadeOutTimeValue(group, no); ++ if (fadeTime >= 0.0f) ++ { ++ motion->SetFadeOutTime(fadeTime); + } + ++ // çµäºæã«ã¡ã¢ãªããåé¤ ++ autoDelete = true; ++ + DeleteBuffer(buffer, path.GetRawString()); + } + else +@@ -355,16 +363,6 @@ void CubismUserModelExtend::ModelParamUp _model->SaveParameters(); //----------------------------------------------------------------- @@ -287,7 +372,7 @@ diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.cpp ./demo_dev if (_expressionManager) { // 表æ ã§ãã©ã¡ã¼ã¿æ´æ°ï¼ç¸å¯¾å¤åï¼ -@@ -377,12 +385,6 @@ void CubismUserModelExtend::ModelParamUp +@@ -387,12 +385,6 @@ void CubismUserModelExtend::ModelParamUp _model->AddParameterValue(_idParamEyeBallX, _dragX); // -1ãã1ã®å¤ãå ãã _model->AddParameterValue(_idParamEyeBallY, _dragY); @@ -301,8 +386,8 @@ diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.cpp ./demo_dev if (_physics) { diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.hpp ./demo_dev/src/CubismUserModelExtend.hpp ---- ./demo_clean/src/CubismUserModelExtend.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/CubismUserModelExtend.hpp 2023-05-28 08:28:27.492813451 +0100 +--- ./demo_clean/src/CubismUserModelExtend.hpp 2024-03-28 18:19:03.926168700 +0000 ++++ ./demo_dev/src/CubismUserModelExtend.hpp 2023-03-05 23:22:10.986750400 +0000 @@ -27,17 +27,13 @@ class CubismUserModelExtend : { public: @@ -372,8 +457,8 @@ diff -pruN --exclude build ./demo_clean/src/CubismUserModelExtend.hpp ./demo_dev /** diff -pruN --exclude build ./demo_clean/src/LAppAllocator.cpp ./demo_dev/src/LAppAllocator.cpp ---- ./demo_clean/src/LAppAllocator.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppAllocator.cpp 2023-05-28 08:28:27.492813451 +0100 +--- ./demo_clean/src/LAppAllocator.cpp 2024-03-28 18:19:03.800631600 +0000 ++++ ./demo_dev/src/LAppAllocator.cpp 2023-03-05 23:22:10.847976000 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -390,8 +475,8 @@ diff -pruN --exclude build ./demo_clean/src/LAppAllocator.cpp ./demo_dev/src/LAp return malloc(size); } diff -pruN --exclude build ./demo_clean/src/LAppAllocator.hpp ./demo_dev/src/LAppAllocator.hpp ---- ./demo_clean/src/LAppAllocator.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppAllocator.hpp 2023-05-28 08:28:27.492813451 +0100 +--- ./demo_clean/src/LAppAllocator.hpp 2024-03-28 18:19:04.446046500 +0000 ++++ ./demo_dev/src/LAppAllocator.hpp 2023-03-05 23:22:10.953083600 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -399,8 +484,8 @@ diff -pruN --exclude build ./demo_clean/src/LAppAllocator.hpp ./demo_dev/src/LAp * * Use of this source code is governed by the Live2D Open Software license diff -pruN --exclude build ./demo_clean/src/LAppDefine.cpp ./demo_dev/src/LAppDefine.cpp ---- ./demo_clean/src/LAppDefine.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppDefine.cpp 2023-05-28 08:28:27.496813523 +0100 +--- ./demo_clean/src/LAppDefine.cpp 2024-03-28 18:19:04.269187200 +0000 ++++ ./demo_dev/src/LAppDefine.cpp 2023-03-05 23:22:10.995458800 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -416,9 +501,38 @@ diff -pruN --exclude build ./demo_clean/src/LAppDefine.cpp ./demo_dev/src/LAppDe const csmFloat32 ViewLogicalMaxLeft = -2.0f; const csmFloat32 ViewLogicalMaxRight = 2.0f; +@@ -38,6 +38,18 @@ namespace LAppDefine { + const csmChar* PowerImageName = "close.png"; + + // ã¢ãã«å®ç¾©------------------------------------------ ++ // ã¢ãã«ãé ç½®ãããã£ã¬ã¯ããªåã®é å ++ // ãã£ã¬ã¯ããªåã¨model3.jsonã®ååãä¸è´ããã¦ããã㨠++ const csmChar* ModelDir[] = { ++ "Haru", ++ "Hiyori", ++ "Mark", ++ "Natori", ++ "Rice", ++ "Mao" ++ }; ++ const csmInt32 ModelDirSize = sizeof(ModelDir) / sizeof(const csmChar*); ++ + // å¤é¨å®ç¾©ãã¡ã¤ã«(json)ã¨åããã + const csmChar* MotionGroupIdle = "Idle"; // ã¢ã¤ããªã³ã° + const csmChar* MotionGroupTapBody = "TapBody"; // ä½ãã¿ããããã¨ã +@@ -52,9 +64,6 @@ namespace LAppDefine { + const csmInt32 PriorityNormal = 2; + const csmInt32 PriorityForce = 3; + +- // MOC3ã®æ´åæ§æ¤è¨¼ãªãã·ã§ã³ +- const csmBool MocConsistencyValidationEnable = true; +- + // ãããã°ç¨ãã°ã®è¡¨ç¤ºãªãã·ã§ã³ + const csmBool DebugLogEnable = true; + const csmBool DebugTouchLogEnable = false; diff -pruN --exclude build ./demo_clean/src/LAppDefine.hpp ./demo_dev/src/LAppDefine.hpp ---- ./demo_clean/src/LAppDefine.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppDefine.hpp 2023-05-28 08:28:27.496813523 +0100 +--- ./demo_clean/src/LAppDefine.hpp 2024-03-28 18:19:03.690794600 +0000 ++++ ./demo_dev/src/LAppDefine.hpp 2023-03-05 23:22:10.947784100 +0000 @@ -1,9 +1,10 @@ -/** +/** @@ -431,9 +545,28 @@ diff -pruN --exclude build ./demo_clean/src/LAppDefine.hpp ./demo_dev/src/LAppDe #pragma once #include <CubismFramework.hpp> +@@ -36,6 +37,9 @@ namespace LAppDefine { + extern const csmChar* PowerImageName; ///< çµäºãã¿ã³ç»åãã¡ã¤ã« + + // ã¢ãã«å®ç¾©-------------------------------------------- ++ extern const csmChar* ModelDir[]; ///< ã¢ãã«ãé ç½®ãããã£ã¬ã¯ããªåã®é å. ãã£ã¬ã¯ããªåã¨model3.jsonã®ååãä¸è´ããã¦ãã. ++ extern const csmInt32 ModelDirSize; ///< ã¢ãã«ãã£ã¬ã¯ããªé åã®ãµã¤ãº ++ + // å¤é¨å®ç¾©ãã¡ã¤ã«(json)ã¨åããã + extern const csmChar* MotionGroupIdle; ///< ã¢ã¤ããªã³ã°æã«åçããã¢ã¼ã·ã§ã³ã®ãªã¹ã + extern const csmChar* MotionGroupTapBody; ///< ä½ãã¿ããããæã«åçããã¢ã¼ã·ã§ã³ã®ãªã¹ã +@@ -50,8 +54,6 @@ namespace LAppDefine { + extern const csmInt32 PriorityNormal; ///< ã¢ã¼ã·ã§ã³ã®åªå åº¦å®æ°: 2 + extern const csmInt32 PriorityForce; ///< ã¢ã¼ã·ã§ã³ã®åªå åº¦å®æ°: 3 + +- extern const csmBool MocConsistencyValidationEnable; ///< MOC3ã®æ´åæ§æ¤è¨¼æ©è½ã®æå¹ã»ç¡å¹ +- + // ãããã°ç¨ãã°ã®è¡¨ç¤º + extern const csmBool DebugLogEnable; ///< ãããã°ç¨ãã°è¡¨ç¤ºã®æå¹ã»ç¡å¹ + extern const csmBool DebugTouchLogEnable; ///< ã¿ããå¦çã®ãããã°ç¨ãã°è¡¨ç¤ºã®æå¹ã»ç¡å¹ diff -pruN --exclude build ./demo_clean/src/LAppDelegate.cpp ./demo_dev/src/LAppDelegate.cpp ---- ./demo_clean/src/LAppDelegate.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppDelegate.cpp 2023-05-28 08:28:27.496813523 +0100 +--- ./demo_clean/src/LAppDelegate.cpp 2024-03-28 18:19:03.753278100 +0000 ++++ ./demo_dev/src/LAppDelegate.cpp 2023-03-05 23:22:10.975780100 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -448,7 +581,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppDelegate.cpp ./demo_dev/src/LApp #include <GL/glew.h> #include <GLFW/glfw3.h> #include "LAppView.hpp" -@@ -43,7 +44,8 @@ void LAppDelegate::ReleaseInstance() +@@ -43,11 +44,12 @@ void LAppDelegate::ReleaseInstance() s_instance = NULL; } @@ -458,7 +591,19 @@ diff -pruN --exclude build ./demo_clean/src/LAppDelegate.cpp ./demo_dev/src/LApp { if (DebugLogEnable) { -@@ -61,7 +63,13 @@ bool LAppDelegate::Initialize() +- LAppPal::PrintLogLn("START"); ++ LAppPal::PrintLog("START"); + } + + // GLFWã®åæå +@@ -55,18 +57,24 @@ bool LAppDelegate::Initialize() + { + if (DebugLogEnable) + { +- LAppPal::PrintLogLn("Can't initilize GLFW"); ++ LAppPal::PrintLog("Can't initilize GLFW"); + } + return GL_FALSE; } // Windowã®çæ_ @@ -473,6 +618,21 @@ diff -pruN --exclude build ./demo_clean/src/LAppDelegate.cpp ./demo_dev/src/LApp if (_window == NULL) { if (DebugLogEnable) + { +- LAppPal::PrintLogLn("Can't create GLFW window."); ++ LAppPal::PrintLog("Can't create GLFW window."); + } + glfwTerminate(); + return GL_FALSE; +@@ -79,7 +87,7 @@ bool LAppDelegate::Initialize() + if (glewInit() != GLEW_OK) { + if (DebugLogEnable) + { +- LAppPal::PrintLogLn("Can't initilize glew."); ++ LAppPal::PrintLog("Can't initilize glew."); + } + glfwTerminate(); + return GL_FALSE; @@ -93,10 +101,6 @@ bool LAppDelegate::Initialize() glEnable(GL_BLEND); glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); @@ -662,8 +822,8 @@ diff -pruN --exclude build ./demo_clean/src/LAppDelegate.cpp ./demo_dev/src/LApp + return elems; } diff -pruN --exclude build ./demo_clean/src/LAppDelegate.hpp ./demo_dev/src/LAppDelegate.hpp ---- ./demo_clean/src/LAppDelegate.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppDelegate.hpp 2023-05-28 08:28:27.496813523 +0100 +--- ./demo_clean/src/LAppDelegate.hpp 2024-03-28 18:19:04.100879300 +0000 ++++ ./demo_dev/src/LAppDelegate.hpp 2023-03-05 23:22:10.789104800 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -802,15 +962,26 @@ diff -pruN --exclude build ./demo_clean/src/LAppDelegate.hpp ./demo_dev/src/LApp - -}; diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src/LAppLive2DManager.cpp ---- ./demo_clean/src/LAppLive2DManager.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppLive2DManager.cpp 2023-05-28 08:28:27.496813523 +0100 +--- ./demo_clean/src/LAppLive2DManager.cpp 2024-03-28 18:19:04.069617100 +0000 ++++ ./demo_dev/src/LAppLive2DManager.cpp 2023-03-05 23:22:10.967799000 +0000 @@ -1,4 +1,4 @@ -/** +/** * Copyright(c) Live2D Inc. All rights reserved. * * Use of this source code is governed by the Live2D Open Software license -@@ -15,6 +15,7 @@ +@@ -6,9 +6,7 @@ + */ + + #include "LAppLive2DManager.hpp" +-#include <stdio.h> +-#include <stdlib.h> +-#include <io.h> ++#include <string> + #include <GL/glew.h> + #include <GLFW/glfw3.h> + #include <Rendering/CubismRenderer.hpp> +@@ -17,6 +15,7 @@ #include "LAppDelegate.hpp" #include "LAppModel.hpp" #include "LAppView.hpp" @@ -818,7 +989,22 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src using namespace Csm; using namespace LAppDefine; -@@ -51,11 +52,11 @@ void LAppLive2DManager::ReleaseInstance( +@@ -27,13 +26,7 @@ namespace { + + void FinishedMotion(ACubismMotion* self) + { +- LAppPal::PrintLogLn("Motion Finished: %x", self); +- } +- +- int CompareCsmString(const void* a, const void* b) +- { +- return strcmp(reinterpret_cast<const Csm::csmString*>(a)->GetRawString(), +- reinterpret_cast<const Csm::csmString*>(b)->GetRawString()); ++ LAppPal::PrintLog("Motion Finished: %x", self); + } + } + +@@ -59,18 +52,16 @@ void LAppLive2DManager::ReleaseInstance( LAppLive2DManager::LAppLive2DManager() : _viewMatrix(NULL) @@ -828,15 +1014,75 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src + , _translateY(0.0f) { _viewMatrix = new CubismMatrix44(); +- SetUpModel(); - - ChangeScene(_sceneIndex); } LAppLive2DManager::~LAppLive2DManager() -@@ -99,26 +100,6 @@ void LAppLive2DManager::OnTap(csmFloat32 + { + ReleaseAllModel(); +- delete _viewMatrix; + } + + void LAppLive2DManager::ReleaseAllModel() +@@ -83,50 +74,6 @@ void LAppLive2DManager::ReleaseAllModel( + _models.Clear(); + } + +-void LAppLive2DManager::SetUpModel() +-{ +- // ResourcesPathã®ä¸ã«ãããã©ã«ãåãå ¨ã¦ã¯ãã¼ã«ããã¢ãã«ãåå¨ãããã©ã«ããå®ç¾©ããã +- // ãã©ã«ãã¯ãããååã®.model3.jsonãè¦ã¤ãããªãã£ãå ´åã¯ãªã¹ãã«å«ããªãã +- csmString crawlPath(ResourcesPath); +- crawlPath += "*.*"; +- +- struct _finddata_t fdata; +- intptr_t fh = _findfirst(crawlPath.GetRawString(), &fdata); +- if (fh == -1) return; +- +- _modelDir.Clear(); +- +- while (_findnext(fh, &fdata) == 0) +- { +- if ((fdata.attrib & _A_SUBDIR) && strcmp(fdata.name, "..") != 0) +- { +- // ãã©ã«ãã¨ååã®.model3.jsonããããæ¢ç´¢ãã +- csmString model3jsonPath(ResourcesPath); +- model3jsonPath += fdata.name; +- model3jsonPath.Append(1, '/'); +- model3jsonPath += fdata.name; +- model3jsonPath += ".model3.json"; +- +- struct _finddata_t fdata2; +- if (_findfirst(model3jsonPath.GetRawString(), &fdata2) != -1) +- { +- _modelDir.PushBack(csmString(fdata.name)); +- } +- } +- } +- qsort(_modelDir.GetPtr(), _modelDir.GetSize(), sizeof(csmString), CompareCsmString); +-} +- +-csmVector<csmString> LAppLive2DManager::GetModelDir() const +-{ +- return _modelDir; +-} +- +-csmInt32 LAppLive2DManager::GetModelDirSize() const +-{ +- return _modelDir.GetSize(); +-} +- + LAppModel* LAppLive2DManager::GetModel(csmUint32 no) const + { + if (no < _models.GetSize()) +@@ -151,27 +98,7 @@ void LAppLive2DManager::OnTap(csmFloat32 + { + if (DebugLogEnable) { - LAppPal::PrintLog("[APP]tap point: {x:%.2f y:%.2f}", x, y); - } +- LAppPal::PrintLogLn("[APP]tap point: {x:%.2f y:%.2f}", x, y); +- } - - for (csmUint32 i = 0; i < _models.GetSize(); i++) - { @@ -844,7 +1090,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src - { - if (DebugLogEnable) - { -- LAppPal::PrintLog("[APP]hit area: [%s]", HitAreaNameHead); +- LAppPal::PrintLogLn("[APP]hit area: [%s]", HitAreaNameHead); - } - _models[i]->SetRandomExpression(); - } @@ -852,15 +1098,15 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src - { - if (DebugLogEnable) - { -- LAppPal::PrintLog("[APP]hit area: [%s]", HitAreaNameBody); +- LAppPal::PrintLogLn("[APP]hit area: [%s]", HitAreaNameBody); - } - _models[i]->StartRandomMotion(MotionGroupTapBody, PriorityNormal, FinishedMotion); - } -- } ++ LAppPal::PrintLog("[APP]tap point: {x:%.2f y:%.2f}", x, y); + } } - void LAppLive2DManager::OnUpdate() const -@@ -126,10 +107,10 @@ void LAppLive2DManager::OnUpdate() const +@@ -180,15 +107,15 @@ void LAppLive2DManager::OnUpdate() const int width, height; glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &width, &height); @@ -872,7 +1118,13 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src LAppModel* model = GetModel(i); if (model->GetModel() == NULL) -@@ -142,12 +123,15 @@ void LAppLive2DManager::OnUpdate() const + { +- LAppPal::PrintLogLn("Failed to model->GetModel()."); ++ LAppPal::PrintLog("Failed to model->GetModel()."); + continue; + } + +@@ -196,12 +123,15 @@ void LAppLive2DManager::OnUpdate() const { // 横ã«é·ãã¢ãã«ã縦é·ã¦ã£ã³ãã¦ã«è¡¨ç¤ºããéã¢ãã«ã®æ¨ªãµã¤ãºã§scaleãç®åºãã model->GetModelMatrix()->SetWidth(2.0f); @@ -890,7 +1142,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src // å¿ è¦ãããã°ããã§ä¹ç® if (_viewMatrix != NULL) -@@ -155,41 +139,23 @@ void LAppLive2DManager::OnUpdate() const +@@ -209,45 +139,24 @@ void LAppLive2DManager::OnUpdate() const projection.MultiplyByMatrix(_viewMatrix); } @@ -906,43 +1158,49 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src } -void LAppLive2DManager::NextScene() --{ -- csmInt32 no = (_sceneIndex + 1) % ModelDirSize; ++void LAppLive2DManager::SetModel(std::string modelName, bool useOldParamId) + { +- csmInt32 no = (_sceneIndex + 1) % GetModelDirSize(); - ChangeScene(no); -} - -void LAppLive2DManager::ChangeScene(Csm::csmInt32 index) -+void LAppLive2DManager::SetModel(std::string modelName, bool useOldParamId) - { +-{ - _sceneIndex = index; - if (DebugLogEnable) - { -- LAppPal::PrintLog("[APP]model index: %d", _sceneIndex); +- LAppPal::PrintLogLn("[APP]model index: %d", _sceneIndex); - } - -- // ModelDir[]ã«ä¿æãããã£ã¬ã¯ããªåãã - // model3.jsonã®ãã¹ã決å®ãã. -- // ãã£ã¬ã¯ããªåã¨model3.jsonã®ååãä¸è´ããã¦ãããã¨. -- std::string model = ModelDir[index]; -- std::string modelPath = ResourcesPath + model + "/"; -- std::string modelJsonName = ModelDir[index]; +- // ãã£ã¬ã¯ããªåã¨model3.jsonã®ååãä¸è´ãã¦ãããã¨ãæ¡ä»¶ +- const csmString& model = _modelDir[index]; +- +- csmString modelPath(ResourcesPath); +- modelPath += model; +- modelPath.Append(1, '/'); +- +- csmString modelJsonName(model); + std::string modelPath = LAppDelegate::GetInstance()->GetRootDirectory() + ResourcesPath + modelName + "/"; + std::string modelJsonName = modelName; modelJsonName += ".model3.json"; ReleaseAllModel(); - _models.PushBack(new LAppModel()); +- _models[0]->LoadAssets(modelPath.GetRawString(), modelJsonName.GetRawString()); + _models.PushBack(new LAppModel(useOldParamId)); - _models[0]->LoadAssets(modelPath.c_str(), modelJsonName.c_str()); ++ _models[0]->LoadAssets(modelPath.c_str(), modelJsonName.c_str()); /* -@@ -211,16 +177,21 @@ void LAppLive2DManager::ChangeScene(Csm: + * ã¢ãã«åéæè¡¨ç¤ºãè¡ããµã³ãã«ãæç¤ºããã +@@ -268,16 +177,21 @@ void LAppLive2DManager::ChangeScene(Csm: #if defined(USE_RENDER_TARGET) || defined(USE_MODEL_RENDER_TARGET) // ã¢ãã«åå¥ã«Î±ãä»ãããµã³ãã«ã¨ãã¦ããã1ä½ã¢ãã«ã使ããå°ãä½ç½®ãããã - _models.PushBack(new LAppModel()); +- _models[1]->LoadAssets(modelPath.GetRawString(), modelJsonName.GetRawString()); + _models.PushBack(new LAppModel(useOldParamId)); - _models[1]->LoadAssets(modelPath.c_str(), modelJsonName.c_str()); ++ _models[1]->LoadAssets(modelPath.c_str(), modelJsonName.c_str()); _models[1]->GetModelMatrix()->TranslateX(0.2f); #endif @@ -962,7 +1220,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src } } -@@ -235,3 +206,20 @@ void LAppLive2DManager::SetViewMatrix(Cu +@@ -292,3 +206,20 @@ void LAppLive2DManager::SetViewMatrix(Cu _viewMatrix->GetArray()[i] = m->GetArray()[i]; } } @@ -984,8 +1242,8 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.cpp ./demo_dev/src + _translateY = translateY; +} diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src/LAppLive2DManager.hpp ---- ./demo_clean/src/LAppLive2DManager.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppLive2DManager.hpp 2023-05-28 08:28:27.496813523 +0100 +--- ./demo_clean/src/LAppLive2DManager.hpp 2024-03-28 18:19:04.607350600 +0000 ++++ ./demo_dev/src/LAppLive2DManager.hpp 2023-03-05 23:22:10.829032000 +0000 @@ -1,18 +1,20 @@ -/** +/** @@ -1009,7 +1267,32 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src /** * @brief ãµã³ãã«ã¢ããªã±ã¼ã·ã§ã³ã«ããã¦CubismModelã管çããã¯ã©ã¹<br> * ã¢ãã«çæã¨ç ´æ£ãã¿ããã¤ãã³ãã®å¦çãã¢ãã«åãæ¿ããè¡ãã -@@ -73,16 +75,14 @@ public: +@@ -37,24 +39,6 @@ public: + static void ReleaseInstance(); + + /** +- * @brief Resources ãã©ã«ãã«ããã¢ãã«ãã©ã«ãåãã»ãããã +- * +- */ +- void SetUpModel(); +- +- /** +- * @brief Resources ãã©ã«ãã«ããã¢ãã«ãã©ã«ãåãåå¾ãã +- * +- */ +- Csm::csmVector<Csm::csmString> GetModelDir() const; +- +- /** +- * @brief Resources ãã©ã«ãã«ããã¢ãã«ãã©ã«ãã®ãµã¤ãºãåå¾ãã +- * +- */ +- Csm::csmInt32 GetModelDirSize() const; +- +- /** + * @brief ç¾å¨ã®ã·ã¼ã³ã§ä¿æãã¦ããã¢ãã«ãè¿ã + * + * @param[in] no ã¢ãã«ãªã¹ãã®ã¤ã³ããã¯ã¹å¤ +@@ -91,16 +75,14 @@ public: void OnUpdate() const; /** @@ -1034,7 +1317,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src /** * @brief ã¢ãã«åæ°ãå¾ã -@@ -95,6 +95,24 @@ public: +@@ -113,6 +95,24 @@ public: */ void SetViewMatrix(Live2D::Cubism::Framework::CubismMatrix44* m); @@ -1059,19 +1342,24 @@ diff -pruN --exclude build ./demo_clean/src/LAppLive2DManager.hpp ./demo_dev/src private: /** * @brief ã³ã³ã¹ãã©ã¯ã¿ -@@ -108,5 +126,8 @@ private: +@@ -124,9 +124,10 @@ private: + */ + virtual ~LAppLive2DManager(); - Csm::CubismMatrix44* _viewMatrix; ///< ã¢ãã«æç»ã«ç¨ããViewè¡å - Csm::csmVector<LAppModel*> _models; ///< ã¢ãã«ã¤ã³ã¹ã¿ã³ã¹ã®ã³ã³ãã -- Csm::csmInt32 _sceneIndex; ///< 表示ããã·ã¼ã³ã®ã¤ã³ããã¯ã¹å¤ -+ +- Csm::CubismMatrix44* _viewMatrix; ///< ã¢ãã«æç»ã«ç¨ããViewè¡å +- Csm::csmVector<LAppModel*> _models; ///< ã¢ãã«ã¤ã³ã¹ã¿ã³ã¹ã®ã³ã³ãã +- Csm::csmInt32 _sceneIndex; ///< 表示ããã·ã¼ã³ã®ã¤ã³ããã¯ã¹å¤ ++ Csm::CubismMatrix44* _viewMatrix; ///< ã¢ãã«æç»ã«ç¨ããViewè¡å ++ Csm::csmVector<LAppModel*> _models; ///< ã¢ãã«ã¤ã³ã¹ã¿ã³ã¹ã®ã³ã³ãã + +- Csm::csmVector<Csm::csmString> _modelDir; ///< ã¢ãã«ãã£ã¬ã¯ããªåã®ã³ã³ãã + float _projScaleFactor; + float _translateX; + float _translateY; }; diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppModel.cpp ---- ./demo_clean/src/LAppModel.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppModel.cpp 2023-05-28 08:34:09.047010843 +0100 +--- ./demo_clean/src/LAppModel.cpp 2024-03-28 18:19:04.524642700 +0000 ++++ ./demo_dev/src/LAppModel.cpp 2024-03-28 18:26:32.604595000 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -1087,7 +1375,23 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod using namespace Live2D::Cubism::Framework; using namespace Live2D::Cubism::Framework::DefaultParameterId; using namespace LAppDefine; -@@ -45,10 +47,12 @@ namespace { +@@ -30,7 +32,7 @@ namespace { + { + if (DebugLogEnable) + { +- LAppPal::PrintLogLn("[APP]create buffer: %s ", path); ++ LAppPal::PrintLog("[APP]create buffer: %s ", path); + } + return LAppPal::LoadFileAsBytes(path, size); + } +@@ -39,33 +41,30 @@ namespace { + { + if (DebugLogEnable) + { +- LAppPal::PrintLogLn("[APP]delete buffer: %s", path); ++ LAppPal::PrintLog("[APP]delete buffer: %s", path); + } + LAppPal::ReleaseBytes(buffer); } } @@ -1099,9 +1403,13 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod + , _detector(nullptr) + , _useOldParamId(useOldParamId) { - if (MocConsistencyValidationEnable) +- if (MocConsistencyValidationEnable) +- { +- _mocConsistency = true; +- } +- + if (DebugLogEnable) { -@@ -60,12 +64,12 @@ LAppModel::LAppModel() _debugMode = true; } @@ -1120,20 +1428,45 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod } LAppModel::~LAppModel() -@@ -101,12 +105,6 @@ void LAppModel::LoadAssets(const csmChar +@@ -89,7 +88,7 @@ void LAppModel::LoadAssets(const csmChar + + if (_debugMode) + { +- LAppPal::PrintLogLn("[APP]load model setting: %s", fileName); ++ LAppPal::PrintLog("[APP]load model setting: %s", fileName); + } + + csmSizeInt size; +@@ -101,17 +100,12 @@ void LAppModel::LoadAssets(const csmChar SetupModel(setting); - if (_model == NULL) - { -- LAppPal::PrintLog("Failed to LoadAssets()."); +- LAppPal::PrintLogLn("Failed to LoadAssets()."); - return; - } - CreateRenderer(); SetupTextures(); -@@ -138,30 +136,6 @@ void LAppModel::SetupModel(ICubismModelS + } + ++ + void LAppModel::SetupModel(ICubismModelSetting* setting) + { + _updating = true; +@@ -130,41 +124,14 @@ void LAppModel::SetupModel(ICubismModelS + + if (_debugMode) + { +- LAppPal::PrintLogLn("[APP]create model: %s", setting->GetModelFileName()); ++ LAppPal::PrintLog("[APP]create model: %s", setting->GetModelFileName()); + } + + buffer = CreateBuffer(path.GetRawString(), &size); +- LoadModel(buffer, size, _mocConsistency); ++ LoadModel(buffer, size); DeleteBuffer(buffer, path.GetRawString()); } @@ -1150,12 +1483,15 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod - buffer = CreateBuffer(path.GetRawString(), &size); - ACubismMotion* motion = LoadExpression(buffer, size, name.GetRawString()); - -- if (_expressions[name] != NULL) +- if (motion) - { -- ACubismMotion::Delete(_expressions[name]); -- _expressions[name] = NULL; +- if (_expressions[name] != NULL) +- { +- ACubismMotion::Delete(_expressions[name]); +- _expressions[name] = NULL; +- } +- _expressions[name] = motion; - } -- _expressions[name] = motion; - - DeleteBuffer(buffer, path.GetRawString()); - } @@ -1164,7 +1500,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod //Physics if (strcmp(_modelSetting->GetPhysicsFileName(), "") != 0) { -@@ -200,7 +174,7 @@ void LAppModel::SetupModel(ICubismModelS +@@ -203,7 +170,7 @@ void LAppModel::SetupModel(ICubismModelS 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)); @@ -1173,7 +1509,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod _breath->SetParameters(breathParameters); } -@@ -224,21 +198,6 @@ void LAppModel::SetupModel(ICubismModelS +@@ -227,21 +194,6 @@ void LAppModel::SetupModel(ICubismModelS } } @@ -1188,14 +1524,65 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod - - if (_modelSetting == NULL || _modelMatrix == NULL) - { -- LAppPal::PrintLog("Failed to SetupModel()."); +- LAppPal::PrintLogLn("Failed to SetupModel()."); - return; - } - //Layout csmMap<csmString, csmFloat32> layout; _modelSetting->GetLayoutMap(layout); -@@ -351,62 +310,57 @@ void LAppModel::Update() +@@ -274,7 +226,7 @@ void LAppModel::PreloadMotionGroup(const + + if (_debugMode) + { +- LAppPal::PrintLogLn("[APP]load motion: %s => [%s_%d] ", path.GetRawString(), group, i); ++ LAppPal::PrintLog("[APP]load motion: %s => [%s_%d] ", path.GetRawString(), group, i); + } + + csmByte* buffer; +@@ -282,27 +234,24 @@ void LAppModel::PreloadMotionGroup(const + buffer = CreateBuffer(path.GetRawString(), &size); + CubismMotion* tmpMotion = static_cast<CubismMotion*>(LoadMotion(buffer, size, name.GetRawString())); + +- if (tmpMotion) ++ csmFloat32 fadeTime = _modelSetting->GetMotionFadeInTimeValue(group, i); ++ if (fadeTime >= 0.0f) + { +- csmFloat32 fadeTime = _modelSetting->GetMotionFadeInTimeValue(group, i); +- if (fadeTime >= 0.0f) +- { +- tmpMotion->SetFadeInTime(fadeTime); +- } ++ tmpMotion->SetFadeInTime(fadeTime); ++ } + +- fadeTime = _modelSetting->GetMotionFadeOutTimeValue(group, i); +- if (fadeTime >= 0.0f) +- { +- tmpMotion->SetFadeOutTime(fadeTime); +- } +- tmpMotion->SetEffectIds(_eyeBlinkIds, _lipSyncIds); ++ fadeTime = _modelSetting->GetMotionFadeOutTimeValue(group, i); ++ if (fadeTime >= 0.0f) ++ { ++ tmpMotion->SetFadeOutTime(fadeTime); ++ } ++ tmpMotion->SetEffectIds(_eyeBlinkIds, _lipSyncIds); + +- if (_motions[name] != NULL) +- { +- ACubismMotion::Delete(_motions[name]); +- } +- _motions[name] = tmpMotion; ++ if (_motions[name] != NULL) ++ { ++ ACubismMotion::Delete(_motions[name]); + } ++ _motions[name] = tmpMotion; + + DeleteBuffer(buffer, path.GetRawString()); + } +@@ -357,62 +306,57 @@ void LAppModel::Update() const csmFloat32 deltaTimeSeconds = LAppPal::GetDeltaTime(); _userTimeSeconds += deltaTimeSeconds; @@ -1220,12 +1607,12 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod - } - _model->SaveParameters(); // ç¶æ ãä¿å - //----------------------------------------------------------------- +- +- // ä¸éæåº¦ +- _opacity = _model->GetModelOpacity(); + auto idMan = CubismFramework::GetIdManager(); + auto params = _detector->getParams(); -- // ä¸éæåº¦ -- _opacity = _model->GetModelOpacity(); -- - // ã¾ã°ãã - if (!motionUpdated) - { @@ -1303,7 +1690,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod } // ç©çæ¼ç®ã®è¨å® -@@ -415,22 +369,6 @@ void LAppModel::Update() +@@ -421,22 +365,6 @@ void LAppModel::Update() _physics->Evaluate(_model, deltaTimeSeconds); } @@ -1326,7 +1713,50 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod // ãã¼ãºã®è¨å® if (_pose != NULL) { -@@ -499,7 +437,6 @@ CubismMotionQueueEntryHandle LAppModel:: +@@ -457,7 +385,7 @@ CubismMotionQueueEntryHandle LAppModel:: + { + if (_debugMode) + { +- LAppPal::PrintLogLn("[APP]can't start motion."); ++ LAppPal::PrintLog("[APP]can't start motion."); + } + return InvalidMotionQueueEntryHandleValue; + } +@@ -478,23 +406,19 @@ CubismMotionQueueEntryHandle LAppModel:: + csmSizeInt size; + buffer = CreateBuffer(path.GetRawString(), &size); + motion = static_cast<CubismMotion*>(LoadMotion(buffer, size, NULL, onFinishedMotionHandler)); +- +- if (motion) ++ csmFloat32 fadeTime = _modelSetting->GetMotionFadeInTimeValue(group, no); ++ if (fadeTime >= 0.0f) + { +- csmFloat32 fadeTime = _modelSetting->GetMotionFadeInTimeValue(group, no); +- if (fadeTime >= 0.0f) +- { +- motion->SetFadeInTime(fadeTime); +- } ++ motion->SetFadeInTime(fadeTime); ++ } + +- fadeTime = _modelSetting->GetMotionFadeOutTimeValue(group, no); +- if (fadeTime >= 0.0f) +- { +- motion->SetFadeOutTime(fadeTime); +- } +- motion->SetEffectIds(_eyeBlinkIds, _lipSyncIds); +- autoDelete = true; // çµäºæã«ã¡ã¢ãªããåé¤ ++ fadeTime = _modelSetting->GetMotionFadeOutTimeValue(group, no); ++ if (fadeTime >= 0.0f) ++ { ++ motion->SetFadeOutTime(fadeTime); + } ++ motion->SetEffectIds(_eyeBlinkIds, _lipSyncIds); ++ autoDelete = true; // çµäºæã«ã¡ã¢ãªããåé¤ + + DeleteBuffer(buffer, path.GetRawString()); + } +@@ -509,12 +433,11 @@ CubismMotionQueueEntryHandle LAppModel:: { csmString path = voice; path = _modelHomeDir + path; @@ -1334,21 +1764,57 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod } if (_debugMode) -@@ -678,3 +615,37 @@ csmBool LAppModel::HasMocConsistencyFrom + { +- LAppPal::PrintLogLn("[APP]start motion: [%s_%d]", group, no); ++ LAppPal::PrintLog("[APP]start motion: [%s_%d]", group, no); + } + return _motionManager->StartMotionPriority(motion, autoDelete, priority); + } +@@ -579,7 +502,7 @@ void LAppModel::SetExpression(const csmC + ACubismMotion* motion = _expressions[expressionID]; + if (_debugMode) + { +- LAppPal::PrintLogLn("[APP]expression: [%s]", expressionID); ++ LAppPal::PrintLog("[APP]expression: [%s]", expressionID); + } + + if (motion != NULL) +@@ -588,7 +511,7 @@ void LAppModel::SetExpression(const csmC + } + else + { +- if (_debugMode) LAppPal::PrintLogLn("[APP]expression[%s] is null ", expressionID); ++ if (_debugMode) LAppPal::PrintLog("[APP]expression[%s] is null ", expressionID); + } + } - return consistency; +@@ -662,29 +585,36 @@ Csm::Rendering::CubismOffscreenSurface_O + return _renderBuffer; } -+ + +-csmBool LAppModel::HasMocConsistencyFromFile(const csmChar* mocFileName) +void LAppModel::SetFacialLandmarkDetector(FacialLandmarkDetector *detector) -+{ + { +- CSM_ASSERT(strcmp(mocFileName, "")); +- +- csmByte* buffer; +- csmSizeInt size; +- +- csmString path = mocFileName; +- path = _modelHomeDir + path; +- +- buffer = CreateBuffer(path.GetRawString(), &size); + _detector = detector; +} -+ + +- csmBool consistency = CubismMoc::HasMocConsistencyFromUnrevivedMoc(buffer, size); +- if (!consistency) +Csm::csmString LAppModel::_(std::string s) +{ + std::string ans; + if (_useOldParamId) -+ { + { +- CubismLogInfo("Inconsistent MOC3."); + if (s == "ParamTere") + { + ans = "PARAM_CHEEK"; @@ -1364,17 +1830,22 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.cpp ./demo_dev/src/LAppMod + ans += std::toupper(s[i]); + } + } -+ } -+ else -+ { + } + else + { +- CubismLogInfo("Consistent MOC3."); + ans = s; -+ } + } +- +- DeleteBuffer(buffer); +- +- return consistency; + return csmString(ans.c_str()); -+} + } + diff -pruN --exclude build ./demo_clean/src/LAppModel.hpp ./demo_dev/src/LAppModel.hpp ---- ./demo_clean/src/LAppModel.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppModel.hpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/LAppModel.hpp 2024-03-28 18:19:04.414826700 +0000 ++++ ./demo_dev/src/LAppModel.hpp 2024-03-28 18:25:30.566916900 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -1403,21 +1874,23 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.hpp ./demo_dev/src/LAppMod /** * @brief ãã¹ãã©ã¯ã¿ -@@ -122,6 +125,13 @@ public: - */ - Csm::csmBool HasMocConsistencyFromFile(const Csm::csmChar* mocFileName); +@@ -115,12 +118,11 @@ public: + Csm::Rendering::CubismOffscreenSurface_OpenGLES2& GetRenderBuffer(); -+ /** + /** +- * @brief .moc3ãã¡ã¤ã«ã®æ´åæ§ããã§ãã¯ãã + * @brief Set the pointer to the FacialLandmarkDetector instance -+ * + * +- * @param[in] mocName MOC3ãã¡ã¤ã«å +- * @return MOC3ã«æ´åæ§ãããã°'true'ãããã§ãªããã°'false'ã + * @param[in] detector : Pointer to FacialLandmarkDetector instance -+ */ + */ +- Csm::csmBool HasMocConsistencyFromFile(const Csm::csmChar* mocFileName); + void SetFacialLandmarkDetector(FacialLandmarkDetector *detector); -+ + protected: /** - * @brief ã¢ãã«ãæç»ããå¦çãã¢ãã«ãæç»ãã空éã®View-Projectionè¡åãæ¸¡ãã -@@ -175,6 +185,17 @@ private: +@@ -175,6 +177,17 @@ private: */ void ReleaseExpressions(); @@ -1435,21 +1908,22 @@ diff -pruN --exclude build ./demo_clean/src/LAppModel.hpp ./demo_dev/src/LAppMod Csm::ICubismModelSetting* _modelSetting; ///< ã¢ãã«ã»ããã£ã³ã°æ å ± Csm::csmString _modelHomeDir; ///< ã¢ãã«ã»ããã£ã³ã°ãç½®ããããã£ã¬ã¯ã㪠Csm::csmFloat32 _userTimeSeconds; ///< ãã«ã¿æéã®ç©ç®å¤[ç§] -@@ -191,9 +212,9 @@ private: +@@ -191,7 +204,10 @@ private: const Csm::CubismId* _idParamEyeBallX; ///< ãã©ã¡ã¼ã¿ID: ParamEyeBallX const Csm::CubismId* _idParamEyeBallY; ///< ãã©ã¡ã¼ã¿ID: ParamEyeBallXY - LAppWavFileHandler _wavFileHandler; ///< wavãã¡ã¤ã«ãã³ãã© -+ Csm::Rendering::CubismOffscreenFrame_OpenGLES2 _renderBuffer; ///< ãã¬ã¼ã ãããã¡ä»¥å¤ã®æç»å ++ Csm::Rendering::CubismOffscreenSurface_OpenGLES2 _renderBuffer; ///< ãã¬ã¼ã ãããã¡ä»¥å¤ã®æç»å -- Csm::Rendering::CubismOffscreenFrame_OpenGLES2 _renderBuffer; ///< ãã¬ã¼ã ãããã¡ä»¥å¤ã®æç»å +- Csm::Rendering::CubismOffscreenSurface_OpenGLES2 _renderBuffer; ///< ãã¬ã¼ã ãããã¡ä»¥å¤ã®æç»å + FacialLandmarkDetector *_detector; }; - - ++ ++ ++ diff -pruN --exclude build ./demo_clean/src/LAppPal.cpp ./demo_dev/src/LAppPal.cpp ---- ./demo_clean/src/LAppPal.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppPal.cpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/LAppPal.cpp 2024-03-28 18:19:04.037915500 +0000 ++++ ./demo_dev/src/LAppPal.cpp 2023-03-05 23:22:10.834981800 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -1467,27 +1941,49 @@ diff -pruN --exclude build ./demo_clean/src/LAppPal.cpp ./demo_dev/src/LAppPal.c #include <stdarg.h> #include <sys/stat.h> #include <iostream> -@@ -35,6 +37,7 @@ csmByte* LAppPal::LoadFileAsBytes(const +@@ -35,37 +37,18 @@ csmByte* LAppPal::LoadFileAsBytes(const if (stat(path, &statBuf) == 0) { size = statBuf.st_size; +- +- if (size == 0) +- { +- if (DebugLogEnable) +- { +- PrintLogLn("Stat succeeded but file size is zero. path:%s", path); +- } +- return NULL; +- } +- } +- else +- { +- if (DebugLogEnable) +- { +- PrintLogLn("Stat failed. errno:%d path:%s", errno, path); +- } +- return NULL; + PrintLog(path); } std::fstream file; -@@ -43,10 +46,7 @@ csmByte* LAppPal::LoadFileAsBytes(const ++ char* buf = new char[size]; ++ file.open(path, std::ios::in | std::ios::binary); if (!file.is_open()) { - if (DebugLogEnable) - { -- PrintLog("file open error"); +- PrintLogLn("File open failed. path:%s", path); - } + throw std::runtime_error("Failed to open file " + filePath); return NULL; } +- +- char* buf = new char[size]; file.read(buf, size); -@@ -78,13 +78,8 @@ void LAppPal::PrintLog(const csmChar* fo + file.close(); + +@@ -95,28 +78,8 @@ void LAppPal::PrintLog(const csmChar* fo va_list args; csmChar buf[256]; va_start(args, format); @@ -1496,15 +1992,40 @@ diff -pruN --exclude build ./demo_clean/src/LAppPal.cpp ./demo_dev/src/LAppPal.c -// ã¡ã¢ãªãªã¼ã¯ãã§ãã¯æã¯å¤§éã®æ¨æºåºåãã¯ããéãã®ã§printfãå©ç¨ãã - std::printf(buf); -#else -+ vsnprintf(buf, sizeof(buf), format, args); // æ¨æºåºåã§ã¬ã³ããªã³ã° - std::cerr << buf << std::endl; +- std::cout << buf; +-#endif +- va_end(args); +-} +- +-void LAppPal::PrintLogLn(const Csm::csmChar* format, ...) +-{ +- va_list args; +- csmChar buf[256]; +- va_start(args, format); +- vsnprintf_s(buf, sizeof(buf), format, args); // æ¨æºåºåã§ã¬ã³ããªã³ã° +-#ifdef CSM_DEBUG_MEMORY_LEAKING +- // ã¡ã¢ãªãªã¼ã¯ãã§ãã¯æã¯å¤§éã®æ¨æºåºåãã¯ããéãã®ã§printfãå©ç¨ãã +- std::printf("%s\n", buf); +-#else +- std::cout << buf << std::endl; -#endif ++ vsnprintf(buf, sizeof(buf), format, args); // æ¨æºåºåã§ã¬ã³ããªã³ã° ++ std::cerr << buf << std::endl; va_end(args); } +@@ -124,8 +87,3 @@ void LAppPal::PrintMessage(const csmChar + { + PrintLog("%s", message); + } +- +-void LAppPal::PrintMessageLn(const csmChar* message) +-{ +- PrintLogLn("%s", message); +-} diff -pruN --exclude build ./demo_clean/src/LAppPal.hpp ./demo_dev/src/LAppPal.hpp ---- ./demo_clean/src/LAppPal.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppPal.hpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/LAppPal.hpp 2024-03-28 18:19:03.957378000 +0000 ++++ ./demo_dev/src/LAppPal.hpp 2023-03-05 23:22:10.939820800 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -1519,20 +2040,67 @@ diff -pruN --exclude build ./demo_clean/src/LAppPal.hpp ./demo_dev/src/LAppPal.h #include <string> /** +@@ -62,17 +63,6 @@ public: + static void PrintLog(const Csm::csmChar* format, ...); + + /** +- * @brief ãã°ãåºåãæå¾ã«æ¹è¡ãã +- * +- * ãã°ãåºåãæå¾ã«æ¹è¡ãã +- * +- * @param[in] format æ¸å¼ä»æåå +- * @param[in] ... (å¯å¤é·å¼æ°)æåå +- * +- */ +- static void PrintLogLn(const Csm::csmChar* format, ...); +- +- /** + * @brief ã¡ãã»ã¼ã¸ãåºåãã + * + * ã¡ãã»ã¼ã¸ãåºåãã +@@ -82,16 +72,6 @@ public: + */ + static void PrintMessage(const Csm::csmChar* message); + +- /** +- * @brief ã¡ãã»ã¼ã¸ãåºåãæå¾ã«æ¹è¡ãã +- * +- * ã¡ãã»ã¼ã¸ãåºåãæå¾ã«æ¹è¡ãã +- * +- * @param[in] message æåå +- * +- */ +- static void PrintMessageLn(const Csm::csmChar* message); +- + private: + static double s_currentFrame; + static double s_lastFrame; diff -pruN --exclude build ./demo_clean/src/LAppSprite.cpp ./demo_dev/src/LAppSprite.cpp ---- ./demo_clean/src/LAppSprite.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppSprite.cpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/LAppSprite.cpp 2024-03-28 18:19:04.304960000 +0000 ++++ ./demo_dev/src/LAppSprite.cpp 2023-03-05 23:22:10.900085700 +0000 @@ -1,4 +1,4 @@ -/** +/** * Copyright(c) Live2D Inc. All rights reserved. * * Use of this source code is governed by the Live2D Open Software license -@@ -39,9 +39,9 @@ void LAppSprite::Render() const - int maxWidth, maxHeight; - glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &maxWidth, &maxHeight); +@@ -6,6 +6,7 @@ + */ -- if (maxWidth == 0 || maxHeight == 0) + #include "LAppSprite.hpp" ++#include "LAppDelegate.hpp" + + LAppSprite::LAppSprite(float x, float y, float width, float height, GLuint textureId, GLuint programId) + : _rect() +@@ -34,10 +35,13 @@ LAppSprite::~LAppSprite() + + void LAppSprite::Render() const + { ++ // ç»é¢ãµã¤ãºãåå¾ãã ++ int maxWidth, maxHeight; ++ glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &maxWidth, &maxHeight); + +- if (_maxWidth == 0 || _maxHeight == 0) + if(maxWidth==0 || maxHeight==0) { - return; // ãã®éã¯æç»ã§ãã @@ -1540,7 +2108,22 @@ diff -pruN --exclude build ./demo_clean/src/LAppSprite.cpp ./demo_dev/src/LAppSp } const GLfloat uvVertex[] = -@@ -74,7 +74,6 @@ void LAppSprite::Render() const +@@ -58,10 +62,10 @@ void LAppSprite::Render() const + // é ç¹ãã¼ã¿ + float positionVertex[] = + { +- (_rect.right - _maxWidth * 0.5f) / (_maxWidth * 0.5f), (_rect.up - _maxHeight * 0.5f) / (_maxHeight * 0.5f), +- (_rect.left - _maxWidth * 0.5f) / (_maxWidth * 0.5f), (_rect.up - _maxHeight * 0.5f) / (_maxHeight * 0.5f), +- (_rect.left - _maxWidth * 0.5f) / (_maxWidth * 0.5f), (_rect.down - _maxHeight * 0.5f) / (_maxHeight * 0.5f), +- (_rect.right - _maxWidth * 0.5f) / (_maxWidth * 0.5f), (_rect.down - _maxHeight * 0.5f) / (_maxHeight * 0.5f) ++ (_rect.right - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.up - maxHeight * 0.5f) / (maxHeight * 0.5f), ++ (_rect.left - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.up - maxHeight * 0.5f) / (maxHeight * 0.5f), ++ (_rect.left - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.down - maxHeight * 0.5f) / (maxHeight * 0.5f), ++ (_rect.right - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.down - maxHeight * 0.5f) / (maxHeight * 0.5f) + }; + + // attribute屿§ãç»é² +@@ -70,7 +74,6 @@ void LAppSprite::Render() const glUniform4f(_colorLocation, _spriteColor[0], _spriteColor[1], _spriteColor[2], _spriteColor[3]); @@ -1548,11 +2131,15 @@ diff -pruN --exclude build ./demo_clean/src/LAppSprite.cpp ./demo_dev/src/LAppSp // ã¢ãã«ã®æç» glBindTexture(GL_TEXTURE_2D, _textureId); glDrawArrays(GL_TRIANGLE_FAN, 0, 4); -@@ -86,9 +85,9 @@ void LAppSprite::RenderImmidiate(GLuint - int maxWidth, maxHeight; - glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &maxWidth, &maxHeight); +@@ -78,9 +81,13 @@ void LAppSprite::Render() const -- if (maxWidth == 0 || maxHeight == 0) + void LAppSprite::RenderImmidiate(GLuint textureId, const GLfloat uvVertex[8]) const + { +- if (_maxWidth == 0 || _maxHeight == 0) ++ // ç»é¢ãµã¤ãºãåå¾ãã ++ int maxWidth, maxHeight; ++ glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &maxWidth, &maxHeight); ++ + if(maxWidth==0 || maxHeight==0) { - return; // ãã®éã¯æç»ã§ãã @@ -1560,11 +2147,30 @@ diff -pruN --exclude build ./demo_clean/src/LAppSprite.cpp ./demo_dev/src/LAppSp } // attribute屿§ãæå¹ã«ãã -@@ -124,11 +123,10 @@ bool LAppSprite::IsHit(float pointX, flo - int maxWidth, maxHeight; - glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &maxWidth, &maxHeight); - -- if (maxWidth == 0 || maxHeight == 0) +@@ -93,10 +100,10 @@ void LAppSprite::RenderImmidiate(GLuint + // é ç¹ãã¼ã¿ + float positionVertex[] = + { +- (_rect.right - _maxWidth * 0.5f) / (_maxWidth * 0.5f), (_rect.up - _maxHeight * 0.5f) / (_maxHeight * 0.5f), +- (_rect.left - _maxWidth * 0.5f) / (_maxWidth * 0.5f), (_rect.up - _maxHeight * 0.5f) / (_maxHeight * 0.5f), +- (_rect.left - _maxWidth * 0.5f) / (_maxWidth * 0.5f), (_rect.down - _maxHeight * 0.5f) / (_maxHeight * 0.5f), +- (_rect.right - _maxWidth * 0.5f) / (_maxWidth * 0.5f), (_rect.down - _maxHeight * 0.5f) / (_maxHeight * 0.5f) ++ (_rect.right - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.up - maxHeight * 0.5f) / (maxHeight * 0.5f), ++ (_rect.left - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.up - maxHeight * 0.5f) / (maxHeight * 0.5f), ++ (_rect.left - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.down - maxHeight * 0.5f) / (maxHeight * 0.5f), ++ (_rect.right - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.down - maxHeight * 0.5f) / (maxHeight * 0.5f) + }; + + // attribute屿§ãç»é² +@@ -112,13 +119,16 @@ void LAppSprite::RenderImmidiate(GLuint + + bool LAppSprite::IsHit(float pointX, float pointY) const + { +- if (_maxWidth == 0 || _maxHeight == 0) ++ // ç»é¢ãµã¤ãºãåå¾ãã ++ int maxWidth, maxHeight; ++ glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &maxWidth, &maxHeight); ++ + if(maxWidth==0 || maxHeight==0) { - return false; // ãã®éã¯æç»ã§ãã @@ -1572,11 +2178,24 @@ diff -pruN --exclude build ./demo_clean/src/LAppSprite.cpp ./demo_dev/src/LAppSp } - //Y座æ¨ã¯å¤æããå¿ è¦ãã - float y = maxHeight - pointY; +- float y = _maxHeight - pointY; ++ float y = maxHeight - pointY; + return (pointX >= _rect.left && pointX <= _rect.right && y <= _rect.up && y >= _rect.down); + } +@@ -138,9 +148,3 @@ void LAppSprite::ResetRect(float x, floa + _rect.up = (y + height * 0.5f); + _rect.down = (y - height * 0.5f); + } +- +-void LAppSprite::SetWindowSize(int width, int height) +-{ +- _maxWidth = width; +- _maxHeight = height; +-} diff -pruN --exclude build ./demo_clean/src/LAppSprite.hpp ./demo_dev/src/LAppSprite.hpp ---- ./demo_clean/src/LAppSprite.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppSprite.hpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/LAppSprite.hpp 2024-03-28 18:19:03.831886500 +0000 ++++ ./demo_dev/src/LAppSprite.hpp 2023-03-05 23:22:10.876156000 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -1592,9 +2211,18 @@ diff -pruN --exclude build ./demo_clean/src/LAppSprite.hpp ./demo_dev/src/LAppSp * */ void RenderImmidiate(GLuint textureId, const GLfloat uvVertex[8]) const; -@@ -95,8 +95,8 @@ public: +@@ -94,24 +94,14 @@ public: + */ void ResetRect(float x, float y, float width, float height); +- /** +- * @brief ã¦ã¤ã³ãã¦ãµã¤ãºè¨å® +- * +- * @param[in] width æ¨ªå¹ +- * @param[in] height é«ã +- */ +- void SetWindowSize(int width, int height); +- private: - GLuint _textureId; ///< ãã¯ã¹ãã£ID - Rect _rect; ///< ç©å½¢ @@ -1603,9 +2231,16 @@ diff -pruN --exclude build ./demo_clean/src/LAppSprite.hpp ./demo_dev/src/LAppSp int _positionLocation; ///< ä½ç½®ã¢ããªãã¥ã¼ã int _uvLocation; ///< UVã¢ããªãã¥ã¼ã int _textureLocation; ///< ãã¯ã¹ãã£ã¢ããªãã¥ã¼ã + int _colorLocation; ///< ã«ã©ã¼ã¢ããªãã¥ã¼ã + + float _spriteColor[4]; ///< 表示ã«ã©ã¼ +- int _maxWidth; ///< ã¦ã¤ã³ãã¦å¹ +- int _maxHeight; ///< ã¦ã¤ã³ãã¦é«ã + }; + diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.cpp ./demo_dev/src/LAppTextureManager.cpp ---- ./demo_clean/src/LAppTextureManager.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppTextureManager.cpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/LAppTextureManager.cpp 2024-03-28 18:19:04.226438800 +0000 ++++ ./demo_dev/src/LAppTextureManager.cpp 2023-03-05 23:22:10.765166600 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -1675,8 +2310,8 @@ diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.cpp ./demo_dev/sr { 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 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppTextureManager.hpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/LAppTextureManager.hpp 2024-03-28 18:19:04.351863200 +0000 ++++ ./demo_dev/src/LAppTextureManager.hpp 2023-03-05 23:22:10.822016600 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -1706,8 +2341,8 @@ diff -pruN --exclude build ./demo_clean/src/LAppTextureManager.hpp ./demo_dev/sr private: diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView.cpp ---- ./demo_clean/src/LAppView.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppView.cpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/LAppView.cpp 2024-03-28 18:19:03.722026200 +0000 ++++ ./demo_dev/src/LAppView.cpp 2024-03-28 18:26:14.230329000 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -1748,7 +2383,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView @@ -47,12 +44,10 @@ LAppView::~LAppView() { - _renderBuffer.DestroyOffscreenFrame(); + _renderBuffer.DestroyOffscreenSurface(); delete _renderSprite; + delete _viewMatrix; @@ -1769,34 +2404,45 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView if (width > height) { float screenW = fabsf(right - left); -@@ -104,8 +99,6 @@ void LAppView::Initialize() +@@ -103,16 +98,7 @@ void LAppView::Initialize() + void LAppView::Render() { +- // ç»é¢ãµã¤ãºãåå¾ãã +- int maxWidth, maxHeight; +- glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &maxWidth, &maxHeight); +- _back->SetWindowSize(maxWidth, maxHeight); +- _gear->SetWindowSize(maxWidth, maxHeight); +- _power->SetWindowSize(maxWidth, maxHeight); +- _back->Render(); - _gear->Render(); - _power->Render(); LAppLive2DManager* Live2DManager = LAppLive2DManager::GetInstance(); -@@ -125,7 +118,7 @@ void LAppView::Render() +@@ -132,16 +118,15 @@ void LAppView::Render() 1.0f, 0.0f, }; - for (csmUint32 i = 0; i < Live2DManager->GetModelNum(); i++) + for(csmUint32 i=0; i<Live2DManager->GetModelNum(); i++) { - LAppModel* model = Live2DManager->GetModel(i); - float alpha = i < 1 ? 1.0f : model->GetOpacity(); // çæ¹ã®ã¿ä¸éæåº¦ãåå¾ã§ããããã«ãã -@@ -133,7 +126,7 @@ void LAppView::Render() +- LAppModel* model = Live2DManager->GetModel(i); +- float alpha = i < 1 ? 1.0f : model->GetOpacity(); // çæ¹ã®ã¿ä¸éæåº¦ãåå¾ã§ããããã«ãã ++ float alpha = GetSpriteAlpha(i); // ãµã³ãã«ã¨ãã¦Î±ã«é©å½ãªå·®ãã¤ãã + _renderSprite->SetColor(1.0f, 1.0f, 1.0f, alpha); ++ LAppModel *model = Live2DManager->GetModel(i); if (model) { +- _renderSprite->SetWindowSize(maxWidth, maxHeight); - _renderSprite->RenderImmidiate( model->GetRenderBuffer().GetColorBuffer(), uvVertex); + _renderSprite->RenderImmidiate(model->GetRenderBuffer().GetColorBuffer(), uvVertex); } } } -@@ -147,85 +140,22 @@ void LAppView::InitializeSprite() +@@ -155,85 +140,22 @@ void LAppView::InitializeSprite() glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &width, &height); LAppTextureManager* textureManager = LAppDelegate::GetInstance()->GetTextureManager(); @@ -1851,7 +2497,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView - float viewY = this->TransformViewY(_touchManager->GetY()); - - _touchManager->TouchesMoved(px, py); - +- - LAppLive2DManager* Live2DManager = LAppLive2DManager::GetInstance(); - Live2DManager->OnDrag(viewX, viewY); -} @@ -1868,10 +2514,10 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView - float y = _deviceToScreen->TransformY(_touchManager->GetY()); // è«ç座æ¨å¤æãã座æ¨ãåå¾ã - if (DebugTouchLogEnable) - { -- LAppPal::PrintLog("[APP]touchesEnded x:%.2f y:%.2f", x, y); +- LAppPal::PrintLogLn("[APP]touchesEnded x:%.2f y:%.2f", x, y); - } - live2DManager->OnTap(x, y); -- + - // æ¯è»ã«ã¿ããããã - if (_gear->IsHit(px, py)) - { @@ -1887,7 +2533,7 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView } float LAppView::TransformViewX(float deviceX) const -@@ -250,7 +180,7 @@ float LAppView::TransformScreenY(float d +@@ -258,7 +180,7 @@ float LAppView::TransformScreenY(float d return _deviceToScreen->TransformY(deviceY); } @@ -1895,8 +2541,8 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView +void LAppView::PreModelDraw(LAppModel &refModel) { // å¥ã®ã¬ã³ããªã³ã°ã¿ã¼ã²ããã¸åãã¦æç»ããå ´åã®ä½¿ç¨ãããã¬ã¼ã ãããã¡ - Csm::Rendering::CubismOffscreenFrame_OpenGLES2* useTarget = NULL; -@@ -263,12 +193,13 @@ void LAppView::PreModelDraw(LAppModel& r + Csm::Rendering::CubismOffscreenSurface_OpenGLES2* useTarget = NULL; +@@ -271,12 +193,13 @@ void LAppView::PreModelDraw(LAppModel& r if (!useTarget->IsValid()) {// æç»ã¿ã¼ã²ããå 鍿ªä½æã®å ´åã¯ããã§ä½æ @@ -1909,12 +2555,12 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView + if(bufWidth!=0 && bufHeight!=0) { // ã¢ãã«æç»ãã£ã³ãã¹ -- useTarget->CreateOffscreenFrame(static_cast<csmUint32>(width), static_cast<csmUint32>(height)); -+ useTarget->CreateOffscreenFrame(static_cast<csmUint32>(bufWidth), static_cast<csmUint32>(bufHeight)); +- useTarget->CreateOffscreenSurface(static_cast<csmUint32>(width), static_cast<csmUint32>(height)); ++ useTarget->CreateOffscreenSurface(static_cast<csmUint32>(bufWidth), static_cast<csmUint32>(bufHeight)); } } -@@ -278,7 +209,7 @@ void LAppView::PreModelDraw(LAppModel& r +@@ -286,7 +209,7 @@ void LAppView::PreModelDraw(LAppModel& r } } @@ -1922,8 +2568,21 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView +void LAppView::PostModelDraw(LAppModel &refModel) { // å¥ã®ã¬ã³ããªã³ã°ã¿ã¼ã²ããã¸åãã¦æç»ããå ´åã®ä½¿ç¨ãããã¬ã¼ã ãããã¡ - Csm::Rendering::CubismOffscreenFrame_OpenGLES2* useTarget = NULL; -@@ -368,32 +299,4 @@ void LAppView::ResizeSprite() + Csm::Rendering::CubismOffscreenSurface_OpenGLES2* useTarget = NULL; +@@ -312,12 +235,6 @@ void LAppView::PostModelDraw(LAppModel& + }; + + _renderSprite->SetColor(1.0f, 1.0f, 1.0f, GetSpriteAlpha(0)); +- +- // ç»é¢ãµã¤ãºãåå¾ãã +- int maxWidth, maxHeight; +- glfwGetWindowSize(LAppDelegate::GetInstance()->GetWindow(), &maxWidth, &maxHeight); +- _renderSprite->SetWindowSize(maxWidth, maxHeight); +- + _renderSprite->RenderImmidiate(useTarget->GetColorBuffer(), uvVertex); + } + } +@@ -382,32 +299,4 @@ void LAppView::ResizeSprite() _back->ResetRect(x, y, fWidth, fHeight); } } @@ -1957,8 +2616,8 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.cpp ./demo_dev/src/LAppView - } } diff -pruN --exclude build ./demo_clean/src/LAppView.hpp ./demo_dev/src/LAppView.hpp ---- ./demo_clean/src/LAppView.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/LAppView.hpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/LAppView.hpp 2024-03-28 18:19:03.659043800 +0000 ++++ ./demo_dev/src/LAppView.hpp 2024-03-28 18:25:01.124283600 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -2041,12 +2700,324 @@ diff -pruN --exclude build ./demo_clean/src/LAppView.hpp ./demo_dev/src/LAppView // ã¬ã³ããªã³ã°å ãå¥ã¿ã¼ã²ããã«ããæ¹å¼ã®å ´åã«ä½¿ç¨ - LAppSprite* _renderSprite; ///< ã¢ã¼ãã«ãã£ã¦ã¯_renderBufferã®ãã¯ã¹ãã£ãæç» + LAppSprite* _renderSprite; ///< ã¢ã¼ãã«ãã£ã¦ã¯_renderBufferã®ãã¯ã¹ãã£ãæç» - Csm::Rendering::CubismOffscreenFrame_OpenGLES2 _renderBuffer; ///< ã¢ã¼ãã«ãã£ã¦ã¯Cubismã¢ãã«çµæããã£ã¡ã«ã¬ã³ããªã³ã° + Csm::Rendering::CubismOffscreenSurface_OpenGLES2 _renderBuffer; ///< ã¢ã¼ãã«ãã£ã¦ã¯Cubismã¢ãã«çµæããã£ã¡ã«ã¬ã³ããªã³ã° SelectTarget _renderTarget; ///< ã¬ã³ããªã³ã°å ã®é¸æè¢ float _clearColor[4]; ///< ã¬ã³ããªã³ã°ã¿ã¼ã²ããã®ã¯ãªã¢ã«ã©ã¼ +diff -pruN --exclude build ./demo_clean/src/LAppWavFileHandler.cpp ./demo_dev/src/LAppWavFileHandler.cpp +--- ./demo_clean/src/LAppWavFileHandler.cpp 2024-03-28 18:19:04.555847400 +0000 ++++ ./demo_dev/src/LAppWavFileHandler.cpp 2023-03-05 23:22:10.921862800 +0000 +@@ -11,8 +11,7 @@ + #include "LAppPal.hpp" + + LAppWavFileHandler::LAppWavFileHandler() +- : _rawData(NULL) +- , _pcmData(NULL) ++ : _pcmData(NULL) + , _userTimeSeconds(0.0f) + , _lastRms(0.0f) + , _sampleOffset(0) +@@ -21,11 +20,6 @@ LAppWavFileHandler::LAppWavFileHandler() + + LAppWavFileHandler::~LAppWavFileHandler() + { +- if (_rawData != NULL) +- { +- CSM_FREE(_rawData); +- } +- + if (_pcmData != NULL) + { + ReleasePcmData(); +@@ -91,115 +85,11 @@ Csm::csmFloat32 LAppWavFileHandler::GetR + return _lastRms; + } + +-const LAppWavFileHandler::WavFileInfo& LAppWavFileHandler::GetWavFileInfo() const +-{ +- return _wavFileInfo; +-} +- +-const Csm::csmByte* LAppWavFileHandler::GetRawData() const +-{ +- return _rawData; +-} +- +-Csm::csmUint64 LAppWavFileHandler::GetRawDataSize() const +-{ +- return _rawDataSize; +-} +- +-Csm::csmVector<Csm::csmFloat32> LAppWavFileHandler::GetPcmData() const +-{ +- Csm::csmVector<Csm::csmFloat32> buffer; +- +- for (Csm::csmUint32 sampleCount = 0; sampleCount < _wavFileInfo._samplesPerChannel; sampleCount++) +- { +- for (Csm::csmUint32 channelCount = 0; channelCount < _wavFileInfo._numberOfChannels; channelCount++) +- { +- buffer.PushBack(_pcmData[channelCount][sampleCount]); +- } +- } +- +- return buffer; +-} +- +-void LAppWavFileHandler::GetPcmDataChannel(Csm::csmFloat32* dst, Csm::csmUint32 useChannel) const +-{ +- for (Csm::csmUint32 sampleCount = 0; sampleCount < _wavFileInfo._samplesPerChannel; sampleCount++) +- { +- dst[sampleCount] = _pcmData[useChannel][sampleCount]; +- } +-} +- +-Csm::csmFloat32 LAppWavFileHandler::NormalizePcmSample(Csm::csmUint32 bitsPerSample, Csm::csmByte* data, Csm::csmUint32 dataSize) +-{ +- Csm::csmInt32 pcm32; +- +- // 32ãããå¹ ã«æ¡å¼µãã¦ãã-1ï½1ã®ç¯å²ã«ä¸¸ãã +- switch (bitsPerSample) +- { +- case 8: +- if (1 <= dataSize) +- { +- const Csm::csmUint8 ret = data[0]; +- pcm32 = static_cast<Csm::csmInt32>(ret) - 128; +- pcm32 <<= 24; +- } +- else +- { +- pcm32 = 0; +- } +- break; +- case 16: +- if (2 <= dataSize) +- { +- const Csm::csmUint16 ret = (data[1] << 8) | data[0]; +- pcm32 = ret << 16; +- } +- else +- { +- pcm32 = 0; +- } +- break; +- case 24: +- if (3 <= dataSize) +- { +- const Csm::csmUint32 ret = (data[2] << 16) | (data[1] << 8) | data[0]; +- pcm32 = ret << 8; +- } +- else +- { +- pcm32 = 0; +- } +- break; +- case 32: +- if (4 <= dataSize) +- { +- const Csm::csmUint32 ret = (data[3] << 24) | (data[2] << 16) | (data[1] << 8) | data[0]; +- pcm32 = ret << 0; +- } +- else +- { +- pcm32 = 0; +- } +- break; +- default: +- // 対å¿ãã¦ããªããããå¹ +- pcm32 = 0; +- break; +- } +- +- return static_cast<Csm::csmFloat32>(pcm32) / INT32_MAX; +-} +- + Csm::csmBool LAppWavFileHandler::LoadWavFile(const Csm::csmString& filePath) + { + Csm::csmBool ret; + + // æ¢ã«wavãã¡ã¤ã«ãã¼ãæ¸ã¿ãªãã°é åéæ¾ +- if (_rawData != NULL) +- { +- CSM_FREE(_rawData); +- _rawDataSize = 0; +- } + if (_pcmData != NULL) + { + ReleasePcmData(); +@@ -251,10 +141,10 @@ Csm::csmBool LAppWavFileHandler::LoadWav + _wavFileInfo._numberOfChannels = _byteReader.Get16LittleEndian(); + // ãµã³ããªã³ã°ã¬ã¼ã + _wavFileInfo._samplingRate = _byteReader.Get32LittleEndian(); +- // å¹³åãã¼ã¿é度 +- _wavFileInfo._avgBytesPerSec = _byteReader.Get32LittleEndian(); +- // ãããã¯ãµã¤ãº +- _wavFileInfo._blockAlign = _byteReader.Get16LittleEndian(); ++ // ãã¼ã¿é度[byte/sec]ï¼èªã¿é£ã°ãï¼ ++ _byteReader.Get32LittleEndian(); ++ // ãããã¯ãµã¤ãºï¼èªã¿é£ã°ãï¼ ++ _byteReader.Get16LittleEndian(); + // éååãããæ° + _wavFileInfo._bitsPerSample = _byteReader.Get16LittleEndian(); + // fmtãã£ã³ã¯ã®æ¡å¼µé¨åã®èªã¿é£ã°ã +@@ -280,25 +170,16 @@ Csm::csmBool LAppWavFileHandler::LoadWav + _wavFileInfo._samplesPerChannel = (dataChunkSize * 8) / (_wavFileInfo._bitsPerSample * _wavFileInfo._numberOfChannels); + } + // é åç¢ºä¿ +- _rawDataSize = static_cast<Csm::csmUint64>(_wavFileInfo._blockAlign) * static_cast<Csm::csmUint64>(_wavFileInfo._samplesPerChannel); +- _rawData = static_cast<Csm::csmByte*>(CSM_MALLOC(sizeof(Csm::csmByte) * _rawDataSize)); + _pcmData = static_cast<Csm::csmFloat32**>(CSM_MALLOC(sizeof(Csm::csmFloat32*) * _wavFileInfo._numberOfChannels)); + for (Csm::csmUint32 channelCount = 0; channelCount < _wavFileInfo._numberOfChannels; channelCount++) + { + _pcmData[channelCount] = static_cast<Csm::csmFloat32*>(CSM_MALLOC(sizeof(Csm::csmFloat32) * _wavFileInfo._samplesPerChannel)); + } + // 波形ãã¼ã¿åå¾ +- Csm::csmUint64 rawPos = 0; + for (Csm::csmUint32 sampleCount = 0; sampleCount < _wavFileInfo._samplesPerChannel; sampleCount++) + { + for (Csm::csmUint32 channelCount = 0; channelCount < _wavFileInfo._numberOfChannels; channelCount++) + { +- // æ£è¦åå +- for (Csm::csmUint32 byteCount = 0; byteCount < _wavFileInfo._bitsPerSample / 8; byteCount++) +- { +- _rawData[rawPos++] = _byteReader._fileByte[_byteReader._readOffset + byteCount]; +- } +- // æ£è¦åå¾ + _pcmData[channelCount][sampleCount] = GetPcmSample(); + } + } +diff -pruN --exclude build ./demo_clean/src/LAppWavFileHandler.hpp ./demo_dev/src/LAppWavFileHandler.hpp +--- ./demo_clean/src/LAppWavFileHandler.hpp 2024-03-28 18:19:04.132172700 +0000 ++++ ./demo_dev/src/LAppWavFileHandler.hpp 2023-03-05 23:22:10.871136700 +0000 +@@ -8,7 +8,7 @@ + #pragma once + + #include <CubismFramework.hpp> +-#include <Type/csmVector.hpp> ++#include <Utils/CubismString.hpp> + + /** + * @brief wavãã¡ã¤ã«ãã³ãã© +@@ -18,28 +18,6 @@ class LAppWavFileHandler + { + public: + /** +- * @brief èªã¿è¾¼ãã wavfileã®æ å ± +- */ +- struct WavFileInfo +- { +- /** +- * @brief ã³ã³ã¹ãã©ã¯ã¿ +- */ +- WavFileInfo() : _fileName(""), _numberOfChannels(0), +- _bitsPerSample(0), _samplingRate(0), _samplesPerChannel(0), +- _avgBytesPerSec(0), _blockAlign(0) +- { } +- +- Csm::csmString _fileName; ///< ãã¡ã¤ã«å +- Csm::csmUint32 _numberOfChannels; ///< ãã£ã³ãã«æ° +- Csm::csmUint32 _bitsPerSample; ///< ãµã³ãã«ããããããæ° +- Csm::csmUint32 _samplingRate; ///< ãµã³ããªã³ã°ã¬ã¼ã +- Csm::csmUint32 _samplesPerChannel; ///< 1ãã£ã³ãã«ãããç·ãµã³ãã«æ° +- Csm::csmUint32 _avgBytesPerSec; ///< å¹³åãã¼ã¿é度 +- Csm::csmUint32 _blockAlign; ///< ãããã¯ãµã¤ãº +- } _wavFileInfo; +- +- /** + * @brief ã³ã³ã¹ãã©ã¯ã¿ + */ + LAppWavFileHandler(); +@@ -72,53 +50,6 @@ public: + */ + Csm::csmFloat32 GetRms() const; + +- /** +- * @brief ãã¡ã¤ã«æ å ±ãåå¾ +- * +- * @retval ãã¡ã¤ã«æ å ± +- */ +- const WavFileInfo& GetWavFileInfo() const; +- +- /** +- * @brief æ£è¦ååã®ãã¼ã¿ãåå¾ +- * +- * @retval æ£è¦ååã®ãã¼ã¿ +- */ +- const Csm::csmByte* GetRawData() const; +- +- /** +- * @brief æ£è¦ååã®ãã¼ã¿ã®å¤§ãããåå¾ +- * +- * @retval æ£è¦ååã®ãã¼ã¿ã®å¤§ãã +- */ +- Csm::csmUint64 GetRawDataSize() const; +- +- /** +- * @brief æ£è¦åãã¼ã¿ãåå¾ãã +- * +- * @retval æ£è¦åãã¼ã¿ +- */ +- Csm::csmVector<Csm::csmFloat32> GetPcmData() const; +- +- /** +- * @brief 弿°ã§æå®ãããã£ã³ãã«ã®æ£è¦åãã¼ã¿ãåå¾ãã +- * +- * @param[in] dst æ ¼ç´å +- * @param[in] useChannel 使ç¨ãããã£ã³ãã« +- */ +- void GetPcmDataChannel(Csm::csmFloat32* dst, Csm::csmUint32 useChannel) const; +- +- /** +- * @brief -1ï½1ã®ç¯å²ã®1ãµã³ãã«åå¾ +- * +- * @param[in] bitsPerSample ãããæ·±åº¦ +- * @param[in] data æ£è¦åããããã¼ã¿ +- * @param[in] dataSize æ£è¦åããããã¼ã¿ã®å¤§ãã +- * +- * @retval csmFloat32 æ£è¦åããããµã³ãã« +- */ +- static Csm::csmFloat32 NormalizePcmSample(Csm::csmUint32 bitsPerSample, Csm::csmByte* data, Csm::csmUint32 dataSize); +- + private: + /** + * @brief wavãã¡ã¤ã«ã®ãã¼ã +@@ -141,6 +72,25 @@ private: + Csm::csmFloat32 GetPcmSample(); + + /** ++ * @brief èªã¿è¾¼ãã wavfileã®æ å ± ++ */ ++ struct WavFileInfo ++ { ++ /** ++ * @brief ã³ã³ã¹ãã©ã¯ã¿ ++ */ ++ WavFileInfo() : _fileName(""), _numberOfChannels(0), ++ _bitsPerSample(0), _samplingRate(0), _samplesPerChannel(0) ++ { } ++ ++ Csm::csmString _fileName; ///< ãã¡ã¤ã«å ++ Csm::csmUint32 _numberOfChannels; ///< ãã£ã³ãã«æ° ++ Csm::csmUint32 _bitsPerSample; ///< ãµã³ãã«ããããããæ° ++ Csm::csmUint32 _samplingRate; ///< ãµã³ããªã³ã°ã¬ã¼ã ++ Csm::csmUint32 _samplesPerChannel; ///< 1ãã£ã³ãã«ãããç·ãµã³ãã«æ° ++ } _wavFileInfo; ++ ++ /** + * @brief ãã¤ããªã¼ã + */ + struct ByteReader { +@@ -225,8 +175,6 @@ private: + Csm::csmUint32 _readOffset; ///< ãã¡ã¤ã«åç §ä½ç½® + } _byteReader; + +- Csm::csmByte* _rawData; ///< æ£è¦åãããåã®ãã¤ãå +- Csm::csmUint64 _rawDataSize; ///< æ£è¦åãããåã®ãã¤ãåã®å¤§ãã + Csm::csmFloat32** _pcmData; ///< -1ãã1ã®ç¯å²ã§è¡¨ç¾ãããé³å£°ãã¼ã¿é å + Csm::csmUint32 _sampleOffset; ///< ãµã³ãã«åç §ä½ç½® + Csm::csmFloat32 _lastRms; ///< æå¾ã«è¨æ¸¬ããRMSå¤ diff -pruN --exclude build ./demo_clean/src/MouseActionManager.cpp ./demo_dev/src/MouseActionManager.cpp ---- ./demo_clean/src/MouseActionManager.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/MouseActionManager.cpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/MouseActionManager.cpp 2024-03-28 18:19:04.195179800 +0000 ++++ ./demo_dev/src/MouseActionManager.cpp 2023-03-05 23:22:10.841970900 +0000 @@ -1,9 +1,9 @@ -/** - * Copyright(c) Live2D Inc. All rights reserved. @@ -2108,8 +3079,8 @@ diff -pruN --exclude build ./demo_clean/src/MouseActionManager.cpp ./demo_dev/sr } diff -pruN --exclude build ./demo_clean/src/MouseActionManager.hpp ./demo_dev/src/MouseActionManager.hpp ---- ./demo_clean/src/MouseActionManager.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/MouseActionManager.hpp 2023-05-28 08:28:27.500813596 +0100 +--- ./demo_clean/src/MouseActionManager.hpp 2024-03-28 18:19:04.336247400 +0000 ++++ ./demo_dev/src/MouseActionManager.hpp 2023-03-05 23:22:10.961094400 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -2117,8 +3088,8 @@ diff -pruN --exclude build ./demo_clean/src/MouseActionManager.hpp ./demo_dev/sr * * Use of this source code is governed by the Live2D Open Software license diff -pruN --exclude build ./demo_clean/src/TouchManager.cpp ./demo_dev/src/TouchManager.cpp ---- ./demo_clean/src/TouchManager.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/TouchManager.cpp 2023-05-28 08:28:27.504813669 +0100 +--- ./demo_clean/src/TouchManager.cpp 2024-03-28 18:19:04.493378700 +0000 ++++ ./demo_dev/src/TouchManager.cpp 2023-03-05 23:22:10.861957900 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -2126,8 +3097,8 @@ diff -pruN --exclude build ./demo_clean/src/TouchManager.cpp ./demo_dev/src/Touc * * Use of this source code is governed by the Live2D Open Software license diff -pruN --exclude build ./demo_clean/src/TouchManager.hpp ./demo_dev/src/TouchManager.hpp ---- ./demo_clean/src/TouchManager.hpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/TouchManager.hpp 2023-05-28 08:28:27.504813669 +0100 +--- ./demo_clean/src/TouchManager.hpp 2024-03-28 18:19:03.612203500 +0000 ++++ ./demo_dev/src/TouchManager.hpp 2023-03-05 23:22:10.884102300 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -2135,8 +3106,8 @@ diff -pruN --exclude build ./demo_clean/src/TouchManager.hpp ./demo_dev/src/Touc * * Use of this source code is governed by the Live2D Open Software license diff -pruN --exclude build ./demo_clean/src/main.cpp ./demo_dev/src/main.cpp ---- ./demo_clean/src/main.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/main.cpp 2023-05-28 08:28:27.504813669 +0100 +--- ./demo_clean/src/main.cpp 2024-03-28 18:19:03.894879200 +0000 ++++ ./demo_dev/src/main.cpp 2023-03-05 23:22:10.772150300 +0000 @@ -1,22 +1,166 @@ -/** +/** @@ -2312,8 +3283,8 @@ diff -pruN --exclude build ./demo_clean/src/main.cpp ./demo_dev/src/main.cpp } - diff -pruN --exclude build ./demo_clean/src/mainMinimum.cpp ./demo_dev/src/mainMinimum.cpp ---- ./demo_clean/src/mainMinimum.cpp 2023-05-18 09:58:50.000000000 +0100 -+++ ./demo_dev/src/mainMinimum.cpp 2023-05-28 08:28:27.504813669 +0100 +--- ./demo_clean/src/mainMinimum.cpp 2024-03-28 18:19:04.383534500 +0000 ++++ ./demo_dev/src/mainMinimum.cpp 2023-03-05 23:22:10.854990900 +0000 @@ -1,4 +1,4 @@ -/** +/** @@ -2369,7 +3340,7 @@ diff -pruN --exclude build ./demo_clean/src/mainMinimum.cpp ./demo_dev/src/mainM static GLFWwindow* _window; ///< ã¦ã£ã³ãã¦ãªãã¸ã§ã¯ã -@@ -90,6 +85,59 @@ static void InitializeCubism() +@@ -90,18 +85,71 @@ static void InitializeCubism() } /** @@ -2429,6 +3400,38 @@ diff -pruN --exclude build ./demo_clean/src/mainMinimum.cpp ./demo_dev/src/mainM * @brief ã·ã¹ãã ã®åæå * * åºç¤ã·ã¹ãã ã®åæåå¦çãè¡ã + */ + static bool InitializeSystem() + { +- LAppPal::PrintLogLn("START"); ++ LAppPal::PrintLog("START"); + + // GLFWã®åæå + if (glfwInit() == GL_FALSE) + { +- LAppPal::PrintLogLn("Can't initilize GLFW"); ++ LAppPal::PrintLog("Can't initilize GLFW"); + + return GL_FALSE; + } +@@ -110,7 +158,7 @@ static bool InitializeSystem() + _window = glfwCreateWindow(LAppDefine::RenderTargetWidth, LAppDefine::RenderTargetHeight, "SIMPLE_SAMPLE", NULL, NULL); + if (_window == NULL) + { +- LAppPal::PrintLogLn("Can't create GLFW window."); ++ LAppPal::PrintLog("Can't create GLFW window."); + + glfwTerminate(); + return GL_FALSE; +@@ -121,7 +169,7 @@ static bool InitializeSystem() + glfwSwapInterval(1); + + if (glewInit() != GLEW_OK) { +- LAppPal::PrintLogLn("Can't initilize glew."); ++ LAppPal::PrintLog("Can't initilize glew."); + + glfwTerminate(); + return GL_FALSE; @@ -149,6 +197,8 @@ static bool InitializeSystem() // ãã©ãã°å ¥å管çã¯ã©ã¹ã®åæå MouseActionManager::GetInstance()->Initialize(windowWidth, windowHeight); -- 2.7.4