Skip to content

Commit 5920508

Browse files
Merge pull request #15 from Live2D/develop
Update to Cubism 5 SDK for Java R5 beta1
2 parents 8b0c854 + 032fbb6 commit 5920508

67 files changed

Lines changed: 5770 additions & 1087 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.

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ trim_trailing_whitespace = true
1111
[*.java]
1212
indent_size = 4
1313

14+
[*.{frag,vert}]
15+
indent_size = 4
16+
1417
[*.gradle]
1518
indent_size = 4
1619

CHANGELOG.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ 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-beta.1] - 2026-01-29
9+
10+
### Added
11+
12+
* Add the `ICubismLoadFileFunction` interface to allow users to implement custom file loading logic.
13+
* Add support for Blend mode and Offscreen drawing.
14+
* Add `getMocVersionFromBuffer()`function.
15+
* Support for retrieving MOC version from unsupported new MOC3 files.
16+
17+
### Changed
18+
19+
* Change shader code to be used separately.
20+
* Rename `CubismOffscreenSurfaceAndroid` class to `CubismRenderTargetAndroid`.
21+
* Change the API called to retrieve the drawable render order from `getDrawableRenderOrder()` to `getRenderOrder()` in CubismCore.
22+
23+
### Removed
24+
25+
* Remove unused `CubismShaderPrograms` class following the shader separation refactor.
26+
27+
828
## [5-r.4.1] - 2025-07-17
929

1030
### Changed
@@ -272,6 +292,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
272292
* New released!
273293

274294

295+
[5-r.5-beta.1]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.4.1...5-r.5-beta.1
275296
[5-r.4.1]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.4...5-r.4.1
276297
[5-r.4]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.3...5-r.4
277298
[5-r.3]: https://github.com/Live2D/CubismJavaFramework/compare/5-r.2...5-r.3

README.ja.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ Live2D Cubism Editor で出力したモデルをアプリケーションで利
1717
本フレームワークを使用する前に、[ライセンス](LICENSE.md)をご確認ください。
1818

1919

20-
## Cubism 5新機能や過去バージョンとの互換性について
20+
## Cubism 5.3新機能や過去バージョンとの互換性について
2121

22-
本 SDK はCubism 5に対応した製品です
23-
Cubism 5 Editorに搭載された新機能のSDK対応については [こちら](https://docs.live2d.com/cubism-sdk-manual/cubism-5-new-functions/)をご確認ください。
24-
過去バージョンのCubism SDKとの互換性については [こちら](https://docs.live2d.com/cubism-sdk-manual/compatibility-with-cubism-5/)をご確認ください。
22+
本 SDK はCubism 5.3に対応した製品です
23+
Cubism 5.3 Editorに搭載された新機能のSDK対応については [こちら](https://docs.live2d.com/cubism-sdk-manual/cubism-5-3-new-functions/)をご確認ください。
24+
過去バージョンのCubism SDKとの互換性については [こちら](https://docs.live2d.com/cubism-sdk-manual/compatibility-with-cubism-5-3/)をご確認ください。
2525

2626

2727
## コンポーネント

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ This framework can be compiled with **Java SE 7** or higher.
1717
Please check the [license](LICENSE.md) before using the framework.
1818

1919

20-
## Compatibility with Cubism 5 new features and previous Cubism SDK versions
20+
## Compatibility with Cubism 5.3 new features and previous Cubism SDK versions
2121

22-
This SDK is compatible with Cubism 5.
23-
For SDK compatibility with new features in Cubism 5 Editor, please refer to [here](https://docs.live2d.com/en/cubism-sdk-manual/cubism-5-new-functions/).
24-
For compatibility with previous versions of Cubism SDK, please refer to [here](https://docs.live2d.com/en/cubism-sdk-manual/compatibility-with-cubism-5/).
22+
This SDK is compatible with Cubism 5.3.
23+
For SDK compatibility with new features in Cubism 5.3 Editor, please refer to [here](https://docs.live2d.com/en/cubism-sdk-manual/cubism-5-3-new-functions/).
24+
For compatibility with previous versions of Cubism SDK, please refer to [here](https://docs.live2d.com/en/cubism-sdk-manual/compatibility-with-cubism-5-3/).
2525

2626

2727
## Components

framework/build.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,10 @@ dependencies {
3838
compileOnly(fileTree(dir: '../../Core/android', include: ['Live2DCubismCore.aar']))
3939

4040
testImplementation 'junit:junit:4.13.2'
41+
42+
androidTestImplementation(fileTree(dir: '../../Core/android', include: ['Live2DCubismCore.aar']))
43+
44+
androidTestImplementation 'androidx.test:runner:1.5.2'
45+
androidTestImplementation 'androidx.test:rules:1.5.0'
46+
androidTestImplementation 'androidx.test.ext:junit:1.1.5'
4147
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
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+
#version 100
9+
10+
precision highp float;
11+
12+
varying vec2 v_texCoord; //v2f.texcoord
13+
uniform sampler2D s_texture0; //_MainTex
14+
uniform vec4 u_baseColor; //v2f.color
15+
uniform vec4 u_multiplyColor;
16+
uniform vec4 u_screenColor;
17+
18+
void main()
19+
{
20+
vec4 texColor = texture2D(s_texture0, v_texCoord);
21+
texColor.rgb = texColor.rgb * u_multiplyColor.rgb;
22+
texColor.rgb = texColor.rgb + u_screenColor.rgb - (texColor.rgb * u_screenColor.rgb);
23+
vec4 color = texColor * u_baseColor;
24+
gl_FragColor = vec4(color.rgb * color.a, color.a);
25+
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
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+
#if !defined CSM_ALPHA_BLEND_MODE
9+
#error not define symbol: CSM_ALPHA_BLEND_MODE.
10+
11+
#else
12+
vec4 OverlapRgba(vec3 color, vec3 colorSource, vec3 colorDestination, vec3 parameter)
13+
{
14+
vec3 rgb = color * parameter.x + colorSource * parameter.y + colorDestination * parameter.z;
15+
float alpha = parameter.x + parameter.y + parameter.z;
16+
return vec4(rgb, alpha);
17+
}
18+
19+
#if CSM_ALPHA_BLEND_MODE == 0 // OVER
20+
vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)
21+
{
22+
vec3 parameter = vec3(colorSource.a * colorDestination.a, colorSource.a * (1.0 - colorDestination.a), colorDestination.a * (1.0 - colorSource.a));
23+
return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);
24+
}
25+
26+
#elif CSM_ALPHA_BLEND_MODE == 1 // ATOP
27+
vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)
28+
{
29+
vec3 parameter = vec3(colorSource.a * colorDestination.a, 0, colorDestination.a * (1.0 - colorSource.a));
30+
return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);
31+
}
32+
33+
#elif CSM_ALPHA_BLEND_MODE == 2 // OUT
34+
vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)
35+
{
36+
vec3 parameter = vec3(0.0, 0.0, colorDestination.a * (1.0 - colorSource.a));
37+
return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);
38+
}
39+
40+
#elif CSM_ALPHA_BLEND_MODE == 3 // CONJOINT OVER
41+
vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)
42+
{
43+
vec3 parameter = vec3(min(colorSource.a, colorDestination.a), max(colorSource.a - colorDestination.a, 0.0), max(colorDestination.a - colorSource.a, 0.0));
44+
return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);
45+
}
46+
47+
#elif CSM_ALPHA_BLEND_MODE == 4 // DISJOINT OVER
48+
vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination)
49+
{
50+
vec3 parameter = vec3(max(colorSource.a + colorDestination.a - 1.0, 0.0), min(colorSource.a, 1.0 - colorDestination.a), min(colorDestination.a, 1.0 - colorSource.a));
51+
return OverlapRgba(color, colorSource.rgb, colorDestination.rgb, parameter);
52+
}
53+
54+
#else
55+
#error not supported blend function
56+
57+
#endif
58+
#endif
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
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+
#version 100
9+
10+
precision highp float;
11+
12+
varying vec2 v_texCoord; //v2f.texcoord
13+
varying vec2 v_blendCoord;
14+
uniform sampler2D s_texture0; //_MainTex
15+
uniform sampler2D s_blendTexture;
16+
uniform vec4 u_baseColor; //v2f.color
17+
uniform vec4 u_multiplyColor;
18+
uniform vec4 u_screenColor;
19+
20+
vec4 ConvertPremultipliedToStraight(vec4 source);
21+
vec3 ColorBlend(vec3 colorSource, vec3 colorDestination);
22+
vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination);
23+
24+
void main()
25+
{
26+
vec4 texColor = texture2D(s_texture0, v_texCoord);
27+
texColor.rgb = texColor.rgb * u_multiplyColor.rgb;
28+
texColor.rgb = texColor.rgb + u_screenColor.rgb - (texColor.rgb * u_screenColor.rgb);
29+
vec4 colorSource = texColor * u_baseColor;
30+
vec4 colorDestination = ConvertPremultipliedToStraight(texture2D(s_blendTexture, v_blendCoord));
31+
gl_FragColor = AlphaBlend(ColorBlend(colorSource.rgb, colorDestination.rgb), colorSource, colorDestination);
32+
}
33+
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
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+
#version 100
9+
#extension GL_NV_shader_framebuffer_fetch : enable
10+
11+
precision highp float;
12+
13+
varying vec2 v_texCoord; //v2f.texcoord
14+
varying vec2 v_blendCoord;
15+
uniform sampler2D s_texture0; //_MainTex
16+
uniform sampler2D s_blendTexture;
17+
uniform vec4 u_baseColor; //v2f.color
18+
uniform vec4 u_multiplyColor;
19+
uniform vec4 u_screenColor;
20+
21+
vec4 ConvertPremultipliedToStraight(vec4 source);
22+
vec3 ColorBlend(vec3 colorSource, vec3 colorDestination);
23+
vec4 AlphaBlend(vec3 color, vec4 colorSource, vec4 colorDestination);
24+
25+
void main()
26+
{
27+
vec4 texColor = texture2D(s_texture0, v_texCoord);
28+
texColor.rgb = texColor.rgb * u_multiplyColor.rgb;
29+
texColor.rgb = texColor.rgb + u_screenColor.rgb - (texColor.rgb * u_screenColor.rgb);
30+
vec4 colorSource = texColor * u_baseColor;
31+
vec4 colorDestination = ConvertPremultipliedToStraight(texture2D(s_blendTexture, v_blendCoord));
32+
gl_FragColor = AlphaBlend(ColorBlend(colorSource.rgb, colorDestination.rgb), colorSource, colorDestination);
33+
}
34+

0 commit comments

Comments
 (0)