Skip to content

Commit 0b5951b

Browse files
Merge pull request #59 from Live2D/develop
Update to Cubism 5 SDK for Native R2
2 parents bf7d7ff + 5a5e492 commit 0b5951b

72 files changed

Lines changed: 2564 additions & 5752 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,60 @@ All notable changes to this project will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

7+
8+
## [5-r.2] - 2024-12-19
9+
10+
### Added
11+
12+
* Add copy constructor to `csmMap`.
13+
* Add functions to get `CombinedParameters` listed in `cdi3.json`.
14+
* Add the functionality to call a function when motion playback starts.
15+
* Add updates to the OpenGL rendering code for HarmonyOS compatibility.
16+
* Add Linux support for the Vulkan renderer.
17+
* Add an API to `CubismMotionJson` for verifying the consistency of `motion3.json`. by [@pillowtrucker](https://github.com/Live2D/CubismNativeFramework/pull/57)
18+
* Add dedicated resource destruction functions for some platforms
19+
20+
### Changed
21+
22+
* Change to permit to overwrite motion fade by the value specified in .model3.json on `CubismUserModel::LoadMotion()`.
23+
* Change the threshold for enabling anisotropic filtering in all renderers.
24+
* Change `CubismJson` to not use character masking.
25+
* Resources in Vulkan have been changed to support multi-buffering.
26+
* Change the `ACubismMotion::UpdateFadeWeight()` function to return an error code of `-1` when the argument is NULL. by [@Coloryr](https://github.com/Live2D/CubismNativeFramework/pull/56)
27+
* Change the access level of the private members in the `CubismModelSettingJson` class to protected.
28+
* Change the value of pi used in the calculation of `CubismBreath::UpdateParameters()` to `CubismMath.PI`.
29+
30+
### Deprecated
31+
32+
* Deprecate the following elements because a priority value is not actually used during expression motion playback:
33+
* `CubismExpressionMotionManager::_currentPriority`
34+
* `CubismExpressionMotionManager::_reservePriority`
35+
* `CubismExpressionMotionManager::StartMotionPriority()`
36+
* `CubismExpressionMotionManager::GetCurrentPriority()`
37+
* `CubismExpressionMotionManager::GetReservePriority()`
38+
* `CubismExpressionMotionManager::SetReservePriority()`
39+
40+
Please use the `CubismMotionQueueManager::StartMotion()` instead of `CubismExpressionMotionManager::StartMotionPriority()`.
41+
42+
### Fixed
43+
44+
* Fix an issue where already registered keys could be added on `csmMap.appendKey()`.
45+
* Fix JSON parser to work even when locale is set.
46+
* Fix memory leak in Vulkan.
47+
* Fix the Anisotropy processing of Vulkan to match the Sample.
48+
* Fix D3D11 anisotropic filtering to allow filtering with the specified settings.
49+
* Fix anisotropic filtering in D3D9.
50+
* Improved the rendering quality by setting the appropriate filter settings.
51+
* Anisotropic filtering is now properly processed.
52+
* Fix a bug that caused an error when playing CubismExpresionMotion with CubismMotionQueueManager::StartMotion().
53+
* Fix a potential problem with division by 0 when a pose fade time is set to 0 seconds.
54+
* Fix an issue where calling `+=` on `csmString` would throw an exception if the character count exceeded 64.
55+
56+
### Removed
57+
58+
* Remove the Cocos2d-x renderer.
59+
60+
761
## [5-r.1] - 2024-03-26
862

963
### Added
@@ -371,6 +425,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
371425
* Fix invalid expressions of `CubismCdiJson`.
372426

373427

428+
[5-r.2]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.1...5-r.2
374429
[5-r.1]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.1-beta.4...5-r.1
375430
[5-r.1-beta.4]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.1-beta.3...5-r.1-beta.4
376431
[5-r.1-beta.3]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.1-beta.2...5-r.1-beta.3

TRANSLATION.md

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,10 @@ Please see the table below for progress.
99
| Module | Path | Status |
1010
| ---: | :--- | :---: |
1111
| Framework Systems | ./src/ | Done |
12-
| Effect | ./src/Effect/ | - |
13-
| Id | ./src/Id/ | - |
14-
| Math | ./src/Math/ | - |
15-
| Model | ./src/Model/ | - |
12+
| Effect | ./src/Effect/ | Done |
13+
| Id | ./src/Id/ | Done |
14+
| Math | ./src/Math/ | Done |
15+
| Model | ./src/Model/ | Done |
1616
| Physics | ./src/Physics/ | - |
1717
| Utils | ./src/Utils/ | - |
1818
| Rendering | ./src/Rendering/ | - |
@@ -36,37 +36,37 @@ Please see the table below for progress.
3636

3737
| File | Completion Date |
3838
| :--- | :--- |
39-
| ./Effect/CubismBreath.hpp | - |
40-
| ./Effect/CubismEyeBlink.hpp | - |
41-
| ./Effect/CubismPose.hpp | - |
39+
| ./Effect/CubismBreath.hpp | 2024-10-08 |
40+
| ./Effect/CubismEyeBlink.hpp | 2024-10-08 |
41+
| ./Effect/CubismPose.hpp | 2024-10-08 |
4242

4343
## Id
4444

4545
| File | Completion Date |
4646
| :--- | :--- |
47-
| ./Id/CubismId.hpp | - |
48-
| ./Id/CubismIdManager.hpp | - |
47+
| ./Id/CubismId.hpp | 2024-10-08 |
48+
| ./Id/CubismIdManager.hpp | 2024-10-08 |
4949

5050
## Math
5151

5252
| File | Completion Date |
5353
| :--- | :--- |
54-
| ./Math/CubismMath.hpp | - |
55-
| ./Math/CubismMatrix44.hpp | - |
56-
| ./Math/CubismModelMatrix.hpp | - |
57-
| ./Math/CubismTargetPoint.hpp | - |
58-
| ./Math/CubismVector2.hpp | - |
59-
| ./Math/CubismViewMatrix.hpp | - |
54+
| ./Math/CubismMath.hpp | 2024-10-08 |
55+
| ./Math/CubismMatrix44.hpp | 2024-10-08 |
56+
| ./Math/CubismModelMatrix.hpp | 2024-10-08 |
57+
| ./Math/CubismTargetPoint.hpp | 2024-10-08 |
58+
| ./Math/CubismVector2.hpp | 2024-10-08 |
59+
| ./Math/CubismViewMatrix.hpp | 2024-10-08 |
6060

6161
## Model
6262

6363
| File | Completion Date |
6464
| :--- | :--- |
65-
| ./Model/CubismMoc.hpp | - |
66-
| ./Model/CubismModel.hpp | - |
67-
| ./Model/CubismModelUserData.hpp | - |
68-
| ./Model/CubismModelUserDataJson.hpp | - |
69-
| ./Model/CubismUserModel.hpp | - |
65+
| ./Model/CubismMoc.hpp | 2024-10-08 |
66+
| ./Model/CubismModel.hpp | 2024-10-08 |
67+
| ./Model/CubismModelUserData.hpp | 2024-10-08 |
68+
| ./Model/CubismModelUserDataJson.hpp | 2024-10-08 |
69+
| ./Model/CubismUserModel.hpp | 2024-10-08 |
7070

7171
## Physics
7272

src/CubismCdiJson.cpp

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const csmChar* Version = "Version";
1616
const csmChar* Parameters = "Parameters";
1717
const csmChar* ParameterGroups = "ParameterGroups";
1818
const csmChar* Parts = "Parts";
19+
const csmChar* CombinedParameters = "CombinedParameters";
1920
const csmChar* Id = "Id";
2021
const csmChar* GroupId = "GroupId";
2122
const csmChar* Name = "Name";
@@ -50,6 +51,12 @@ csmBool CubismCdiJson::IsExistParts() const
5051
return !node.IsNull() && !node.IsError();
5152
}
5253

54+
csmBool CubismCdiJson::IsExistCombinedParameters() const
55+
{
56+
Utils::Value& node = (_json->GetRoot()[CombinedParameters]);
57+
return !node.IsNull() && !node.IsError();
58+
}
59+
5360
// パラメータについて
5461
csmInt32 CubismCdiJson::GetParametersCount()
5562
{
@@ -111,4 +118,16 @@ const csmChar* CubismCdiJson::GetPartsName(csmInt32 index)
111118
return _json->GetRoot()[Parts][index][Name].GetRawString();
112119
}
113120

121+
// 結合パラメータについて
122+
csmInt32 CubismCdiJson::GetCombinedParametersCount()
123+
{
124+
if (!IsExistCombinedParameters()) return 0;
125+
return _json->GetRoot()[CombinedParameters].GetSize();
126+
}
127+
128+
const csmVector<Utils::Value*>* CubismCdiJson::GetCombinedParameters(csmInt32 index)
129+
{
130+
return _json->GetRoot()[CombinedParameters][index].GetVector();
131+
}
132+
114133
}}}

src/CubismCdiJson.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,21 @@ class CubismCdiJson : public CubismJsonHolder
126126
*/
127127
const csmChar* GetPartsName(csmInt32 index);
128128

129+
/**
130+
* Returns the number of combined parameters.
131+
*
132+
* @return Number of combined parameters
133+
*/
134+
csmInt32 GetCombinedParametersCount();
135+
136+
/**
137+
* Returns the pair list of the combined parameters.
138+
*
139+
* @param index Index to the desired combined parameter
140+
*
141+
* @return Pair list of the combined parameter
142+
*/
143+
const csmVector<Utils::Value*>* GetCombinedParameters(csmInt32 index);
129144

130145
private:
131146
/**
@@ -148,6 +163,13 @@ class CubismCdiJson : public CubismJsonHolder
148163
* @return true if parts exist; otherwise false.
149164
*/
150165
csmBool IsExistParts() const;
166+
167+
/**
168+
* Returns whether the combined parameters exist in the Display Information File.
169+
*
170+
* @return true if combined parameters exist; otherwise false.
171+
*/
172+
csmBool IsExistCombinedParameters() const;
151173
};
152174

153175
}}}

src/CubismJsonHolder.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ namespace Live2D { namespace Cubism { namespace Framework {
3636
*
3737
* @return true if valid; otherwise false
3838
*/
39-
csmBool IsValid()
39+
csmBool IsValid() const
4040
{
4141
return _json;
4242
}

src/CubismModelSettingJson.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ class CubismModelSettingJson : public ICubismModelSetting, public CubismJsonHold
256256
*/
257257
CubismIdHandle GetLipSyncParameterId(csmInt32 index);
258258

259-
private:
259+
protected:
260260

261261
enum FrequentNode
262262
{

src/Effect/CubismBreath.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
#include "CubismBreath.hpp"
99
#include <math.h>
10+
#include "Math/CubismMath.hpp"
1011

1112
namespace Live2D { namespace Cubism { namespace Framework {
1213

@@ -41,7 +42,7 @@ void CubismBreath::UpdateParameters(CubismModel* model, csmFloat32 deltaTimeSeco
4142
{
4243
_currentTime += deltaTimeSeconds;
4344

44-
const csmFloat32 t = _currentTime * 2.0f * 3.14159f;
45+
const csmFloat32 t = _currentTime * 2.0f * CubismMath::Pi;
4546

4647
for (csmUint32 i = 0; i < _breathParameters.GetSize(); ++i)
4748
{

src/Effect/CubismBreath.hpp

Lines changed: 30 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,18 @@
1414
namespace Live2D { namespace Cubism { namespace Framework {
1515

1616
/**
17-
* @brief 呼吸機能
18-
*
19-
* 呼吸機能を提供する。
17+
* Handles the breathing effect
2018
*/
2119
class CubismBreath
2220
{
2321
public:
2422
/**
25-
* @brief 呼吸のパラメータ情報
26-
*
27-
* 呼吸のパラメータ情報。
23+
* Data attached to the parameters of breathing
2824
*/
2925
struct BreathParameterData
3026
{
3127
/**
32-
* @brief コンストラクタ
33-
*
34-
* コンストラクタ。
28+
* Constructor
3529
*/
3630
BreathParameterData()
3731
: ParameterId(NULL)
@@ -42,15 +36,16 @@ class CubismBreath
4236
{ }
4337

4438
/**
45-
* @brief コンストラクタ
39+
* Constructor<br>
40+
* Sets the data.
4641
*
47-
* コンストラクタ。
42+
* @param parameterId ID of the breath parameter to attach
43+
* @param offset offset of the sine wave
44+
* @param peak peak value of the sine wave
45+
* @param cycle cycle of the sine wave
46+
* @param weight weight of the parameter
4847
*
49-
* @param[in] parameterId 呼吸をひもづけるパラメータID
50-
* @param[in] offset 呼吸を正弦波としたときの、波のオフセット
51-
* @param[in] peak 呼吸を正弦波としたときの、波の高さ
52-
* @param[in] cycle 呼吸を正弦波としたときの、波の周期
53-
* @param[in] weight パラメータへの重み
48+
* @note The cyclic motion of breathing is set entirely by sine waves.
5449
*/
5550
BreathParameterData(CubismIdHandle parameterId, csmFloat32 offset, csmFloat32 peak, csmFloat32 cycle, csmFloat32 weight)
5651
: ParameterId(parameterId)
@@ -60,77 +55,61 @@ class CubismBreath
6055
, Weight(weight)
6156
{ }
6257

63-
CubismIdHandle ParameterId; ///< 呼吸をひもづけるパラメータID
64-
csmFloat32 Offset; ///< 呼吸を正弦波としたときの、波のオフセット
65-
csmFloat32 Peak; ///< 呼吸を正弦波としたときの、波の高さ
66-
csmFloat32 Cycle; ///< 呼吸を正弦波としたときの、波の周期
67-
csmFloat32 Weight; ///< パラメータへの重み
58+
CubismIdHandle ParameterId; ///< ID of the breath parameter to attach
59+
csmFloat32 Offset; ///< Offset of the sine wave
60+
csmFloat32 Peak; ///< Peak value of the sine wave
61+
csmFloat32 Cycle; ///< Cycle of the sine wave
62+
csmFloat32 Weight; ///< Weight of the parameter
6863
};
6964

7065
/**
71-
* @brief インスタンスの作成
66+
* Makes an instance of CubismBreath.
7267
*
73-
* インスタンスを作成する。
68+
* @return Maked instance of CubismBreath
7469
*/
7570
static CubismBreath* Create();
7671

7772

7873
/**
79-
* @brief インスタンスの破棄
74+
* Destroys an instance of CubismBreath.
8075
*
81-
* インスタンスを破棄する。
82-
*
83-
* @param[in] instance 対象のCubismBreath
76+
* @param instance Instance of CubismBreath to destroy
8477
*/
8578
static void Delete(CubismBreath* instance);
8679

8780
/**
88-
* @brief 呼吸のパラメータのひもづけ
89-
*
90-
* 呼吸のパラメータをひもづける。
81+
* Attaches the parameters of breathing.
9182
*
92-
* @param[in] breathParameters 呼吸をひもづけたいパラメータのリスト
83+
* @param breathParameters Collection of breathing parameters to attach
9384
*/
9485
void SetParameters(const csmVector<BreathParameterData>& breathParameters);
9586

9687

9788
/**
98-
* @brief 呼吸にひもづいているパラメータの取得
99-
*
100-
* 呼吸にひもづいているパラメータを取得する。
89+
* Returns parameters attached to breathing.
10190
*
102-
* @return 呼吸にひもづいているパラメータのリスト
91+
* @return Attached collection of breathing parameters
10392
*/
10493
const csmVector<BreathParameterData>& GetParameters() const;
10594

10695

10796
/**
108-
* @brief モデルのパラメータの更新
97+
* Updates the parameters of the model.
10998
*
110-
* モデルのパラメータを更新する。
99+
* @param model Model to update
100+
* @param deltaTimeSeconds Current time in seconds
111101
*
112-
* @param[in] model 対象のモデル
113-
* @param[in] deltaTimeSeconds デルタ時間[秒]
102+
* @note Execute after making an instance with #Create() and binding parameters with #setParameters().
114103
*/
115104
void UpdateParameters(CubismModel* model, csmFloat32 deltaTimeSeconds);
116105

117106
private:
118-
/**
119-
* @brief コンストラクタ
120-
*
121-
* コンストラクタ。
122-
*/
123107
CubismBreath();
124108

125-
/**
126-
* @brief デストラクタ
127-
*
128-
* デストラクタ。
129-
*/
130109
virtual ~CubismBreath();
131110

132-
csmVector<BreathParameterData> _breathParameters; ///< 呼吸にひもづいているパラメータのリスト
133-
csmFloat32 _currentTime; ///< 積算時間[秒]
111+
csmVector<BreathParameterData> _breathParameters;
112+
csmFloat32 _currentTime;
134113
};
135114

136115
}}}

0 commit comments

Comments
 (0)