Skip to content

Commit 145155d

Browse files
Merge pull request #67 from Live2D/develop
Update to Cubism 5 SDK for Native R5
2 parents f68f26a + c5cc765 commit 145155d

88 files changed

Lines changed: 3420 additions & 2135 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: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,66 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
66

77

8+
## [5-r.5] - 2026-04-02
9+
10+
### Added
11+
12+
* Add the `SetRenderViewport` method to `CubismRenderer_Metal` to set the viewport when drawing the model.
13+
* Add functionality to change motion calculation order.
14+
* Add `cubismlook` class that implements the target tracking feature.
15+
* The target tracking feature can now specify parameter IDs through the `Framework`.
16+
17+
### Changed
18+
19+
* Change Vulkan renderer to use `CubismDeviceInfo_Vulkan` instead of singletons for pipeline and offscreen manager.
20+
* Rename `InitializeConstantSettings` to `SetConstantSettings` in Vulkan renderer.
21+
* Change the access level of the private members in the `CubismMoc` and `CubismModel` classes to protected.
22+
* Change multiply and screen color functions to separate class with renamed methods.
23+
* Change shader generation from draw loop to Initialize() in OpenGL, D3D9, D3D11 and Metal.
24+
* Change to unify sampler settings across all graphics APIs, except for OpenGL ES on Android and iOS.
25+
26+
### Fixed
27+
28+
* Fix a validation error on Vulkan.
29+
* Fix unnecessary multiply color and screen color settings in mask drawing.
30+
* Fix a memory leak in `CubismRenderer_D3D11::ReleaseCommandBuffer()` where `_indexBuffers` and `_vertexBuffers` were not freed due to a copy-paste bug.
31+
* Fix a memory leak in `CubismRenderer_Vulkan::CreatePipelines()` where `PipelineResource` objects allocated for Add/Mult blend modes were overwritten and leaked.
32+
* Fix missing null checks after loading shader source files in OpenGL, D3D9 and D3D11 renderers.
33+
* Fix a resource leak in `CubismShader_D3D11::GenerateShaders()` where Copy and SetupMask shaders were loaded twice, causing the first set of COM objects to leak.
34+
* Fix redundant matrix transpose in D3D11 renderer.
35+
* Improve the viewport save and restore process on OpenGL.
36+
37+
### Removed
38+
39+
* Remove unnecessary shader processing in D3D11 and D3D9.
40+
* Remove deprecated functions from CubismModel:
41+
* `GetDrawableTextureIndices(csmInt32 drawableIndex)` (use `GetDrawableTextureIndex(csmInt32 drawableIndex)` instead)
42+
* `GetDrawableBlendMode(csmInt32 drawableIndex)` (use `GetDrawableBlendModeType(csmInt32 drawableIndex)` instead)
43+
* `SetOverwriteFlagForModelCullings(csmBool value)` (use `SetOverrideFlagForModelCullings(csmBool value)` instead)
44+
* `GetOverwriteFlagForModelCullings()` (use `GetOverwriteFlagForModelCullings()` instead)
45+
* `SetOverwriteFlagForDrawableCullings(csmUint32 drawableIndex, csmBool value)` (use `SetOverrideFlagForDrawableCullings(csmUint32 drawableIndex, csmBool value)` instead)
46+
* `GetOverwriteFlagForDrawableCullings(csmInt32 drawableIndex)` (use `GetOverrideFlagForDrawableCullings(csmInt32 drawableIndex)` instead)
47+
* Remove deprecated functions from CubismExpressionMotion:
48+
* `GetFadeWeight()` (use `CubismExpressionMotionManager.GetFadeWeight(csmInt32 index)` instead)
49+
* Remove deprecated fields from CubismExpressionMotion:
50+
* `_fadeWeight` (priority is not used in expression motion playback)
51+
* Remove deprecated functions from CubismExpressionMotionManager:
52+
* `GetCurrentPriority()` (priority is not used in expression motion playback)
53+
* `SetReservePriority(csmInt32 priority)` (priority is not used in expression motion playback)
54+
* `GetReservePriority()` (priority is not used in expression motion playback)
55+
* `StartMotionPriority(ACubismMotion* motion, csmBool autoDelete, csmInt32 priority)` (use `CubismMotionQueueManager::StartMotion(ACubismMotion* motion, csmBool autoDelete)` instead)
56+
* Remove deprecated fields from CubismExpressionMotionManager:
57+
* `_currentPriority` (priority is not used in expression motion playback)
58+
* `_reservePriority` (priority is not used in expression motion playback)
59+
* Remove deprecated functions from CubismMotion:
60+
* `IsLoop(csmBool loop)` (use `ACubismMotion.SetLoop(csmBool loop)` instead)
61+
* `IsLoop()` (use `ACubismMotion.GetLoop()` instead)
62+
* `IsLoopFadeIn(csmBool loopFadeIn)` (use `ACubismMotion.SetLoopFadeIn(csmBool loopFadeIn)` instead)
63+
* `IsLoopFadeIn()` (use `ACubismMotion.GetLoopFadeIn()` instead)
64+
* Remove deprecated functions from CubismMotionQueueManager:
65+
* `StartMotion(ACubismMotion* motion, csmBool autoDelete, csmFloat32 userTimeSeconds)` (use `StartMotion(ACubismMotion* motion, csmBool autoDelete)` instead)
66+
67+
868
## [5-r.5-beta.3.1] - 2026-02-19
969

1070
### Added
@@ -546,6 +606,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
546606
* Fix invalid expressions of `CubismCdiJson`.
547607

548608

609+
[5-r.5]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.5-beta.3.1...5-r.5
549610
[5-r.5-beta.3.1]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.5-beta.3...5-r.5-beta.3.1
550611
[5-r.5-beta.3]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.5-beta.2...5-r.5-beta.3
551612
[5-r.5-beta.2]: https://github.com/Live2D/CubismNativeFramework/compare/5-r.5-beta.1...5-r.5-beta.2

src/Effect/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ target_sources(${LIB_NAME}
44
${CMAKE_CURRENT_SOURCE_DIR}/CubismBreath.hpp
55
${CMAKE_CURRENT_SOURCE_DIR}/CubismEyeBlink.cpp
66
${CMAKE_CURRENT_SOURCE_DIR}/CubismEyeBlink.hpp
7+
${CMAKE_CURRENT_SOURCE_DIR}/CubismLook.cpp
8+
${CMAKE_CURRENT_SOURCE_DIR}/CubismLook.hpp
79
${CMAKE_CURRENT_SOURCE_DIR}/CubismPose.cpp
810
${CMAKE_CURRENT_SOURCE_DIR}/CubismPose.hpp
911
)

src/Effect/CubismLook.cpp

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
/**
2+
* Copyright(c) Live2D Inc. All rights reserved.
3+
*
4+
* Use of this source code is governed by the Live2D Open Software license
5+
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6+
*/
7+
8+
#include "CubismLook.hpp"
9+
10+
namespace Live2D { namespace Cubism { namespace Framework {
11+
12+
CubismLook* CubismLook::Create()
13+
{
14+
return CSM_NEW CubismLook();
15+
}
16+
17+
void CubismLook::Delete(CubismLook* instance)
18+
{
19+
CSM_DELETE_SELF(CubismLook, instance);
20+
}
21+
22+
void CubismLook::SetParameters(const csmVector<LookParameterData>& lookParameters)
23+
{
24+
_lookParameters = lookParameters;
25+
}
26+
27+
const csmVector<CubismLook::LookParameterData>& CubismLook::GetParameters() const
28+
{
29+
return _lookParameters;
30+
}
31+
32+
void CubismLook::UpdateParameters(CubismModel* model, const csmFloat32 dragX, const csmFloat32 dragY) const
33+
{
34+
const csmFloat32 dragXY = dragX * dragY;
35+
36+
for (csmUint32 i = 0; i < _lookParameters.GetSize(); ++i)
37+
{
38+
const LookParameterData& data = _lookParameters[i];
39+
40+
model->AddParameterValue(data.ParameterId, data.FactorX * dragX + data.FactorY * dragY + data.FactorXY * dragXY);
41+
}
42+
}
43+
44+
}}}

src/Effect/CubismLook.hpp

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
/**
2+
* Copyright(c) Live2D Inc. All rights reserved.
3+
*
4+
* Use of this source code is governed by the Live2D Open Software license
5+
* that can be found at https://www.live2d.com/eula/live2d-open-software-license-agreement_en.html.
6+
*/
7+
8+
#pragma once
9+
10+
#include <climits>
11+
#include "CubismFramework.hpp"
12+
#include "Model/CubismModel.hpp"
13+
14+
namespace Live2D { namespace Cubism { namespace Framework {
15+
16+
/**
17+
* Parameter Following Feature by Target.<br>
18+
* Provides parameter following functionality for drag input.
19+
*/
20+
class CubismLook
21+
{
22+
public:
23+
/**
24+
* Data attached to the parameters of look.
25+
*/
26+
struct LookParameterData
27+
{
28+
/**
29+
* Constructor
30+
*/
31+
LookParameterData()
32+
: ParameterId(nullptr)
33+
, FactorX(0.0f)
34+
, FactorY(0.0f)
35+
, FactorXY(0.0f)
36+
{
37+
}
38+
39+
/**
40+
* Constructor<br>
41+
* Sets the data.
42+
*
43+
* @param parameterId ID of the breath parameter to attach.
44+
* @param factorX Coefficient for drag input along the X-axis.
45+
* @param factorY Coefficient for drag input along the Y-axis.
46+
* @param factorXY Coefficient for the combined X-Y (cross) drag input.
47+
*/
48+
LookParameterData(CubismIdHandle parameterId, const csmFloat32 factorX = 0.0f, const csmFloat32 factorY = 0.0f, const csmFloat32 factorXY = 0.0f)
49+
: ParameterId(parameterId)
50+
, FactorX(factorX)
51+
, FactorY(factorY)
52+
, FactorXY(factorXY)
53+
{
54+
}
55+
56+
CubismIdHandle ParameterId;
57+
csmFloat32 FactorX;
58+
csmFloat32 FactorY;
59+
csmFloat32 FactorXY;
60+
};
61+
62+
/**
63+
* Makes an instance of CubismLook.
64+
*
65+
* @return Maked instance of CubismLook
66+
*/
67+
static CubismLook* Create();
68+
69+
/**
70+
* Destroys an instance of CubismLook.
71+
*
72+
* @param instance Instance of CubismLook to destroy
73+
*/
74+
static void Delete(CubismLook* instance);
75+
76+
/**
77+
* Attaches the parameters of look.
78+
*
79+
* @param lookParameters Collection of look parameters to attach
80+
*/
81+
void SetParameters(const csmVector<LookParameterData>& lookParameters);
82+
83+
/**
84+
* Returns parameters attached to look.
85+
*
86+
* @return Attached collection of look parameters
87+
*/
88+
const csmVector<LookParameterData>& GetParameters() const;
89+
90+
/**
91+
* Updates the parameters of the model.
92+
*
93+
* @param model Model to update
94+
* @param dragX X coordinate of the target
95+
* @param dragY Y coordinate of the target
96+
*
97+
* @note Execute after making an instance with #Create() and binding parameters with #setParameters().
98+
*/
99+
void UpdateParameters(CubismModel* model, const csmFloat32 dragX, const csmFloat32 dragY) const;
100+
101+
private:
102+
CubismLook() = default;
103+
~CubismLook() = default;
104+
105+
csmVector<LookParameterData> _lookParameters;
106+
};
107+
108+
}}}

src/Model/CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ target_sources(${LIB_NAME}
44
${CMAKE_CURRENT_SOURCE_DIR}/CubismMoc.hpp
55
${CMAKE_CURRENT_SOURCE_DIR}/CubismModel.cpp
66
${CMAKE_CURRENT_SOURCE_DIR}/CubismModel.hpp
7+
${CMAKE_CURRENT_SOURCE_DIR}/CubismModelMultiplyAndScreenColor.cpp
8+
${CMAKE_CURRENT_SOURCE_DIR}/CubismModelMultiplyAndScreenColor.hpp
79
${CMAKE_CURRENT_SOURCE_DIR}/CubismModelUserData.cpp
810
${CMAKE_CURRENT_SOURCE_DIR}/CubismModelUserData.hpp
911
${CMAKE_CURRENT_SOURCE_DIR}/CubismModelUserDataJson.cpp

src/Model/CubismMoc.hpp

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,17 @@ class CubismMoc
9595
*/
9696
static csmBool HasMocConsistencyFromUnrevivedMoc(const csmByte* mocBytes, csmSizeInt size);
9797

98-
private:
98+
/**
99+
* Delete copy constructor.
100+
*/
101+
CubismMoc(const CubismMoc&) = delete;
102+
103+
/**
104+
* Delete copy assignment operator.
105+
*/
106+
CubismMoc& operator=(const CubismMoc&) = delete;
107+
108+
protected:
99109
CubismMoc(Core::csmMoc* moc);
100110

101111
virtual ~CubismMoc();

0 commit comments

Comments
 (0)