├── .gitignore ├── .gitmodules ├── AndroidWallPaper ├── .gitignore ├── Resources │ ├── Hiyori │ │ ├── Hiyori.2048 │ │ │ ├── texture_00.png │ │ │ └── texture_01.png │ │ ├── Hiyori.moc3 │ │ ├── Hiyori.model3.json │ │ ├── Hiyori.physics3.json │ │ ├── Hiyori.pose3.json │ │ ├── Hiyori.userdata3.json │ │ └── motions │ │ │ ├── Hiyori_m01.motion3.json │ │ │ ├── Hiyori_m02.motion3.json │ │ │ ├── Hiyori_m03.motion3.json │ │ │ ├── Hiyori_m04.motion3.json │ │ │ ├── Hiyori_m05.motion3.json │ │ │ ├── Hiyori_m06.motion3.json │ │ │ ├── Hiyori_m07.motion3.json │ │ │ ├── Hiyori_m08.motion3.json │ │ │ ├── Hiyori_m09.motion3.json │ │ │ └── Hiyori_m10.motion3.json │ └── back.png ├── app │ ├── CMakeLists.txt │ ├── build.gradle │ ├── proguard-rules.pro │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ ├── cpp │ │ ├── CMakeLists.txt │ │ ├── JniBridgeC.cpp │ │ ├── JniBridgeC.hpp │ │ ├── LWallpaperAllocator.cpp │ │ ├── LWallpaperAllocator.hpp │ │ ├── LWallpaperDefine.cpp │ │ ├── LWallpaperDefine.hpp │ │ ├── LWallpaperDelegate.cpp │ │ ├── LWallpaperDelegate.hpp │ │ ├── LWallpaperLive2DManager.cpp │ │ ├── LWallpaperLive2DManager.hpp │ │ ├── LWallpaperModel.cpp │ │ ├── LWallpaperModel.hpp │ │ ├── LWallpaperPal.cpp │ │ ├── LWallpaperPal.hpp │ │ ├── LWallpaperSprite.cpp │ │ ├── LWallpaperSprite.hpp │ │ ├── LWallpaperTextureManager.cpp │ │ ├── LWallpaperTextureManager.hpp │ │ ├── LWallpaperView.cpp │ │ ├── LWallpaperView.hpp │ │ ├── TouchManager.cpp │ │ └── TouchManager.hpp │ │ ├── java │ │ ├── com │ │ │ └── live2d │ │ │ │ └── demo │ │ │ │ ├── JniBridgeJava.java │ │ │ │ ├── Live2DGLRenderer.java │ │ │ │ ├── Live2DReceiver.java │ │ │ │ └── LiveWallpaperService.java │ │ └── net │ │ │ └── rbgrn │ │ │ └── android │ │ │ └── glwallpaperservice │ │ │ ├── Apache_License_2.0_license.txt │ │ │ ├── GLWallpaperService-CHANGELOG.md │ │ │ ├── GLWallpaperService.java │ │ │ └── NOTICE.txt │ │ └── res │ │ ├── drawable-hdpi │ │ └── icon.png │ │ ├── drawable-ldpi │ │ └── icon.png │ │ ├── drawable-mdpi │ │ └── icon.png │ │ ├── drawable-v24 │ │ └── ic_launcher_foreground.xml │ │ ├── drawable │ │ └── ic_launcher_background.xml │ │ ├── layout │ │ └── activity_main.xml │ │ ├── mipmap-anydpi-v26 │ │ ├── ic_launcher.xml │ │ └── ic_launcher_round.xml │ │ ├── mipmap-hdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-mdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── mipmap-xxxhdpi │ │ ├── ic_launcher.png │ │ └── ic_launcher_round.png │ │ ├── values │ │ ├── colors.xml │ │ ├── strings.xml │ │ └── styles.xml │ │ └── xml │ │ └── wallpaper.xml ├── build.gradle ├── gradle.properties ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat └── settings.gradle ├── Core ├── CHANGELOG.md ├── LICENSE.md ├── README.md └── RedistributableFiles.txt ├── LICENSE.md ├── NOTICE.md ├── README.md └── thirdParty └── stb ├── README.md └── stb_image.h /.gitignore: -------------------------------------------------------------------------------- 1 | # Core directory files 2 | /Core/**/*.a 3 | /Core/**/*.bundle 4 | /Core/**/*.dll 5 | /Core/**/*.dylib 6 | /Core/**/*.lib 7 | /Core/**/*.so 8 | 9 | # Sample third party files 10 | /Samples/**/thirdParty/* 11 | !/Samples/OpenGL/thirdParty/stb/* 12 | # build directories 13 | /AndroidWallPaper/build/ 14 | # Other files 15 | /build/ 16 | .vs/ 17 | .vscode/ 18 | .idea/ 19 | *.iml 20 | .DS_Store 21 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "FrameWork"] 2 | path = FrameWork 3 | url = https://github.com/Live2D/CubismNativeFramework 4 | -------------------------------------------------------------------------------- /AndroidWallPaper/.gitignore: -------------------------------------------------------------------------------- 1 | .gradle/ 2 | .cxx/ 3 | build/ 4 | local.properties -------------------------------------------------------------------------------- /AndroidWallPaper/Resources/Hiyori/Hiyori.2048/texture_00.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/Resources/Hiyori/Hiyori.2048/texture_00.png -------------------------------------------------------------------------------- /AndroidWallPaper/Resources/Hiyori/Hiyori.2048/texture_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/Resources/Hiyori/Hiyori.2048/texture_01.png -------------------------------------------------------------------------------- /AndroidWallPaper/Resources/Hiyori/Hiyori.moc3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/Resources/Hiyori/Hiyori.moc3 -------------------------------------------------------------------------------- /AndroidWallPaper/Resources/Hiyori/Hiyori.model3.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": 3, 3 | "FileReferences": { 4 | "Moc": "Hiyori.moc3", 5 | "Textures": [ 6 | "Hiyori.2048/texture_00.png", 7 | "Hiyori.2048/texture_01.png" 8 | ], 9 | "Physics": "Hiyori.physics3.json", 10 | "Pose": "Hiyori.pose3.json", 11 | "UserData": "Hiyori.userdata3.json", 12 | "Motions": { 13 | "Idle": [ 14 | { 15 | "File": "motions/Hiyori_m01.motion3.json", 16 | "FadeInTime": 0.5, 17 | "FadeOutTime": 0.5 18 | }, 19 | { 20 | "File": "motions/Hiyori_m02.motion3.json", 21 | "FadeInTime": 0.5, 22 | "FadeOutTime": 0.5 23 | }, 24 | { 25 | "File": "motions/Hiyori_m03.motion3.json", 26 | "FadeInTime": 0.5, 27 | "FadeOutTime": 0.5 28 | }, 29 | { 30 | "File": "motions/Hiyori_m05.motion3.json", 31 | "FadeInTime": 0.5, 32 | "FadeOutTime": 0.5 33 | }, 34 | { 35 | "File": "motions/Hiyori_m06.motion3.json", 36 | "FadeInTime": 0.5, 37 | "FadeOutTime": 0.5 38 | }, 39 | { 40 | "File": "motions/Hiyori_m07.motion3.json", 41 | "FadeInTime": 0.5, 42 | "FadeOutTime": 0.5 43 | }, 44 | { 45 | "File": "motions/Hiyori_m08.motion3.json", 46 | "FadeInTime": 0.5, 47 | "FadeOutTime": 0.5 48 | }, 49 | { 50 | "File": "motions/Hiyori_m09.motion3.json", 51 | "FadeInTime": 0.5, 52 | "FadeOutTime": 0.5 53 | }, 54 | { 55 | "File": "motions/Hiyori_m10.motion3.json", 56 | "FadeInTime": 0.5, 57 | "FadeOutTime": 0.5 58 | } 59 | ], 60 | "TapBody": [ 61 | { 62 | "File": "motions/Hiyori_m04.motion3.json", 63 | "FadeInTime": 0.5, 64 | "FadeOutTime": 0.5 65 | } 66 | ] 67 | } 68 | }, 69 | "Groups": [ 70 | { 71 | "Target": "Parameter", 72 | "Name": "LipSync", 73 | "Ids": [ 74 | "ParamMouthOpenY" 75 | ] 76 | }, 77 | { 78 | "Target": "Parameter", 79 | "Name": "EyeBlink", 80 | "Ids": [ 81 | "ParamEyeLOpen", 82 | "ParamEyeROpen" 83 | ] 84 | } 85 | ], 86 | "HitAreas": [ 87 | { 88 | "Id": "HitArea", 89 | "Name": "Body" 90 | } 91 | ] 92 | } -------------------------------------------------------------------------------- /AndroidWallPaper/Resources/Hiyori/Hiyori.pose3.json: -------------------------------------------------------------------------------- 1 | { 2 | "Type": "Live2D Pose", 3 | "FadeInTime": 0.5, 4 | "Groups": [ 5 | [ 6 | { 7 | "Id": "PartArmA", 8 | "Link": [] 9 | }, 10 | { 11 | "Id": "PartArmB", 12 | "Link": [] 13 | } 14 | ] 15 | ] 16 | } -------------------------------------------------------------------------------- /AndroidWallPaper/Resources/Hiyori/Hiyori.userdata3.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": 3, 3 | "Meta": { 4 | "UserDataCount": 7, 5 | "TotalUserDataSize": 35 6 | }, 7 | "UserData": [ 8 | { 9 | "Target": "ArtMesh", 10 | "Id": "ArtMesh93", 11 | "Value": "ribon" 12 | }, 13 | { 14 | "Target": "ArtMesh", 15 | "Id": "ArtMesh94", 16 | "Value": "ribon" 17 | }, 18 | { 19 | "Target": "ArtMesh", 20 | "Id": "ArtMesh95", 21 | "Value": "ribon" 22 | }, 23 | { 24 | "Target": "ArtMesh", 25 | "Id": "ArtMesh57", 26 | "Value": "ribon" 27 | }, 28 | { 29 | "Target": "ArtMesh", 30 | "Id": "ArtMesh58", 31 | "Value": "ribon" 32 | }, 33 | { 34 | "Target": "ArtMesh", 35 | "Id": "ArtMesh59", 36 | "Value": "ribon" 37 | }, 38 | { 39 | "Target": "ArtMesh", 40 | "Id": "ArtMesh60", 41 | "Value": "ribon" 42 | } 43 | ] 44 | } -------------------------------------------------------------------------------- /AndroidWallPaper/Resources/Hiyori/motions/Hiyori_m04.motion3.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": 3, 3 | "Meta": { 4 | "Duration": 4.467, 5 | "Fps": 30.0, 6 | "Loop": true, 7 | "AreBeziersRestricted": false, 8 | "CurveCount": 31, 9 | "TotalSegmentCount": 106, 10 | "TotalPointCount": 287, 11 | "UserDataCount": 0, 12 | "TotalUserDataSize": 0 13 | }, 14 | "Curves": [ 15 | { 16 | "Target": "Parameter", 17 | "Id": "ParamAngleX", 18 | "Segments": [ 19 | 0, 20 | 1, 21 | 1, 22 | 0.211, 23 | 1, 24 | 0.422, 25 | 0, 26 | 0.633, 27 | 0, 28 | 1, 29 | 0.911, 30 | 0, 31 | 1.189, 32 | 5, 33 | 1.467, 34 | 5, 35 | 1, 36 | 1.689, 37 | 5, 38 | 1.911, 39 | -16, 40 | 2.133, 41 | -16, 42 | 1, 43 | 2.356, 44 | -16, 45 | 2.578, 46 | 13.871, 47 | 2.8, 48 | 13.871, 49 | 1, 50 | 2.956, 51 | 13.871, 52 | 3.111, 53 | 0, 54 | 3.267, 55 | 0, 56 | 0, 57 | 4.467, 58 | 0 59 | ] 60 | }, 61 | { 62 | "Target": "Parameter", 63 | "Id": "ParamAngleY", 64 | "Segments": [ 65 | 0, 66 | 0, 67 | 1, 68 | 0.211, 69 | 0, 70 | 0.422, 71 | 0, 72 | 0.633, 73 | 0, 74 | 1, 75 | 0.911, 76 | 0, 77 | 1.189, 78 | -25, 79 | 1.467, 80 | -25, 81 | 1, 82 | 1.689, 83 | -25, 84 | 1.911, 85 | -15.225, 86 | 2.133, 87 | -11, 88 | 1, 89 | 2.356, 90 | -6.775, 91 | 2.578, 92 | -5.127, 93 | 2.8, 94 | -2.5, 95 | 1, 96 | 2.956, 97 | -0.661, 98 | 3.111, 99 | 0, 100 | 3.267, 101 | 0, 102 | 0, 103 | 4.467, 104 | 0 105 | ] 106 | }, 107 | { 108 | "Target": "Parameter", 109 | "Id": "ParamAngleZ", 110 | "Segments": [ 111 | 0, 112 | 0, 113 | 1, 114 | 0.222, 115 | 0, 116 | 0.444, 117 | 0, 118 | 0.667, 119 | 0, 120 | 1, 121 | 0.756, 122 | 0, 123 | 0.844, 124 | -4, 125 | 0.933, 126 | -4, 127 | 1, 128 | 1.122, 129 | -4, 130 | 1.311, 131 | 18, 132 | 1.5, 133 | 18, 134 | 1, 135 | 1.722, 136 | 18, 137 | 1.944, 138 | -14, 139 | 2.167, 140 | -14, 141 | 1, 142 | 2.567, 143 | -14, 144 | 2.967, 145 | -14, 146 | 3.367, 147 | -14, 148 | 1, 149 | 3.511, 150 | -14, 151 | 3.656, 152 | -12, 153 | 3.8, 154 | -12, 155 | 0, 156 | 4.467, 157 | -12 158 | ] 159 | }, 160 | { 161 | "Target": "Parameter", 162 | "Id": "ParamCheek", 163 | "Segments": [ 164 | 0, 165 | 1, 166 | 0, 167 | 4.467, 168 | 1 169 | ] 170 | }, 171 | { 172 | "Target": "Parameter", 173 | "Id": "ParamEyeLOpen", 174 | "Segments": [ 175 | 0, 176 | 1.2, 177 | 1, 178 | 0.389, 179 | 1.2, 180 | 0.778, 181 | 1.148, 182 | 1.167, 183 | 1, 184 | 1, 185 | 1.211, 186 | 0.983, 187 | 1.256, 188 | 0, 189 | 1.3, 190 | 0, 191 | 1, 192 | 1.322, 193 | 0, 194 | 1.344, 195 | 0, 196 | 1.367, 197 | 0, 198 | 1, 199 | 1.422, 200 | 0, 201 | 1.478, 202 | 1, 203 | 1.533, 204 | 1, 205 | 1, 206 | 1.944, 207 | 1, 208 | 2.356, 209 | 1, 210 | 2.767, 211 | 1, 212 | 1, 213 | 2.811, 214 | 1, 215 | 2.856, 216 | 0, 217 | 2.9, 218 | 0, 219 | 1, 220 | 2.922, 221 | 0, 222 | 2.944, 223 | 0, 224 | 2.967, 225 | 0, 226 | 1, 227 | 3.022, 228 | 0, 229 | 3.078, 230 | 1, 231 | 3.133, 232 | 1, 233 | 0, 234 | 4.467, 235 | 1 236 | ] 237 | }, 238 | { 239 | "Target": "Parameter", 240 | "Id": "ParamEyeLSmile", 241 | "Segments": [ 242 | 0, 243 | 0, 244 | 0, 245 | 4.467, 246 | 0 247 | ] 248 | }, 249 | { 250 | "Target": "Parameter", 251 | "Id": "ParamEyeROpen", 252 | "Segments": [ 253 | 0, 254 | 1.2, 255 | 1, 256 | 0.389, 257 | 1.2, 258 | 0.778, 259 | 1.148, 260 | 1.167, 261 | 1, 262 | 1, 263 | 1.211, 264 | 0.983, 265 | 1.256, 266 | 0, 267 | 1.3, 268 | 0, 269 | 1, 270 | 1.322, 271 | 0, 272 | 1.344, 273 | 0, 274 | 1.367, 275 | 0, 276 | 1, 277 | 1.422, 278 | 0, 279 | 1.478, 280 | 1, 281 | 1.533, 282 | 1, 283 | 1, 284 | 1.944, 285 | 1, 286 | 2.356, 287 | 1, 288 | 2.767, 289 | 1, 290 | 1, 291 | 2.811, 292 | 1, 293 | 2.856, 294 | 0, 295 | 2.9, 296 | 0, 297 | 1, 298 | 2.922, 299 | 0, 300 | 2.944, 301 | 0, 302 | 2.967, 303 | 0, 304 | 1, 305 | 3.022, 306 | 0, 307 | 3.078, 308 | 1, 309 | 3.133, 310 | 1, 311 | 0, 312 | 4.467, 313 | 1 314 | ] 315 | }, 316 | { 317 | "Target": "Parameter", 318 | "Id": "ParamEyeRSmile", 319 | "Segments": [ 320 | 0, 321 | 0, 322 | 0, 323 | 4.467, 324 | 0 325 | ] 326 | }, 327 | { 328 | "Target": "Parameter", 329 | "Id": "ParamEyeBallX", 330 | "Segments": [ 331 | 0, 332 | 0, 333 | 1, 334 | 0.211, 335 | 0, 336 | 0.422, 337 | 0, 338 | 0.633, 339 | 0, 340 | 1, 341 | 0.911, 342 | 0, 343 | 1.189, 344 | -0.44, 345 | 1.467, 346 | -0.44, 347 | 1, 348 | 1.689, 349 | -0.44, 350 | 1.911, 351 | 0.79, 352 | 2.133, 353 | 0.79, 354 | 1, 355 | 2.511, 356 | 0.79, 357 | 2.889, 358 | 0, 359 | 3.267, 360 | 0, 361 | 0, 362 | 4.467, 363 | 0 364 | ] 365 | }, 366 | { 367 | "Target": "Parameter", 368 | "Id": "ParamEyeBallY", 369 | "Segments": [ 370 | 0, 371 | 0, 372 | 1, 373 | 0.211, 374 | 0, 375 | 0.422, 376 | 0, 377 | 0.633, 378 | 0, 379 | 1, 380 | 0.911, 381 | 0, 382 | 1.189, 383 | -1, 384 | 1.467, 385 | -1, 386 | 1, 387 | 1.689, 388 | -1, 389 | 1.911, 390 | -1, 391 | 2.133, 392 | -1, 393 | 1, 394 | 2.511, 395 | -1, 396 | 2.889, 397 | 0, 398 | 3.267, 399 | 0, 400 | 0, 401 | 4.467, 402 | 0 403 | ] 404 | }, 405 | { 406 | "Target": "Parameter", 407 | "Id": "ParamBrowLY", 408 | "Segments": [ 409 | 0, 410 | 1, 411 | 1, 412 | 0.544, 413 | 1, 414 | 1.089, 415 | 1, 416 | 1.633, 417 | 1, 418 | 1, 419 | 1.856, 420 | 1, 421 | 2.078, 422 | 0, 423 | 2.3, 424 | 0, 425 | 1, 426 | 2.5, 427 | 0, 428 | 2.7, 429 | 1, 430 | 2.9, 431 | 1, 432 | 0, 433 | 4.467, 434 | 1 435 | ] 436 | }, 437 | { 438 | "Target": "Parameter", 439 | "Id": "ParamBrowRY", 440 | "Segments": [ 441 | 0, 442 | 1, 443 | 1, 444 | 0.544, 445 | 1, 446 | 1.089, 447 | 1, 448 | 1.633, 449 | 1, 450 | 1, 451 | 1.856, 452 | 1, 453 | 2.078, 454 | 0, 455 | 2.3, 456 | 0, 457 | 1, 458 | 2.5, 459 | 0, 460 | 2.7, 461 | 1, 462 | 2.9, 463 | 1, 464 | 0, 465 | 4.467, 466 | 1 467 | ] 468 | }, 469 | { 470 | "Target": "Parameter", 471 | "Id": "ParamBrowLX", 472 | "Segments": [ 473 | 0, 474 | 0, 475 | 0, 476 | 4.467, 477 | 0 478 | ] 479 | }, 480 | { 481 | "Target": "Parameter", 482 | "Id": "ParamBrowRX", 483 | "Segments": [ 484 | 0, 485 | 0, 486 | 0, 487 | 4.467, 488 | 0 489 | ] 490 | }, 491 | { 492 | "Target": "Parameter", 493 | "Id": "ParamBrowLAngle", 494 | "Segments": [ 495 | 0, 496 | 0, 497 | 0, 498 | 4.467, 499 | 0 500 | ] 501 | }, 502 | { 503 | "Target": "Parameter", 504 | "Id": "ParamBrowRAngle", 505 | "Segments": [ 506 | 0, 507 | 0, 508 | 0, 509 | 4.467, 510 | 0 511 | ] 512 | }, 513 | { 514 | "Target": "Parameter", 515 | "Id": "ParamBrowLForm", 516 | "Segments": [ 517 | 0, 518 | -1, 519 | 0, 520 | 4.467, 521 | -1 522 | ] 523 | }, 524 | { 525 | "Target": "Parameter", 526 | "Id": "ParamBrowRForm", 527 | "Segments": [ 528 | 0, 529 | -1, 530 | 0, 531 | 4.467, 532 | -1 533 | ] 534 | }, 535 | { 536 | "Target": "Parameter", 537 | "Id": "ParamMouthForm", 538 | "Segments": [ 539 | 0, 540 | -2, 541 | 0, 542 | 4.467, 543 | -2 544 | ] 545 | }, 546 | { 547 | "Target": "Parameter", 548 | "Id": "ParamMouthOpenY", 549 | "Segments": [ 550 | 0, 551 | 0, 552 | 0, 553 | 4.467, 554 | 0 555 | ] 556 | }, 557 | { 558 | "Target": "Parameter", 559 | "Id": "ParamBodyAngleX", 560 | "Segments": [ 561 | 0, 562 | 0, 563 | 1, 564 | 0.244, 565 | 0, 566 | 0.489, 567 | 0, 568 | 0.733, 569 | 0, 570 | 1, 571 | 0.933, 572 | 0, 573 | 1.133, 574 | -7, 575 | 1.333, 576 | -7, 577 | 1, 578 | 1.644, 579 | -7, 580 | 1.956, 581 | 0, 582 | 2.267, 583 | 0, 584 | 0, 585 | 4.467, 586 | 0 587 | ] 588 | }, 589 | { 590 | "Target": "Parameter", 591 | "Id": "ParamBodyAngleY", 592 | "Segments": [ 593 | 0, 594 | 0, 595 | 1, 596 | 0.244, 597 | 0, 598 | 0.489, 599 | 0, 600 | 0.733, 601 | 0, 602 | 0, 603 | 4.467, 604 | 0 605 | ] 606 | }, 607 | { 608 | "Target": "Parameter", 609 | "Id": "ParamBodyAngleZ", 610 | "Segments": [ 611 | 0, 612 | 2, 613 | 1, 614 | 0.233, 615 | 2, 616 | 0.467, 617 | 0, 618 | 0.7, 619 | 0, 620 | 1, 621 | 0.733, 622 | 0, 623 | 0.767, 624 | 0, 625 | 0.8, 626 | 0, 627 | 1, 628 | 1, 629 | 0, 630 | 1.2, 631 | -4, 632 | 1.4, 633 | -4, 634 | 1, 635 | 1.711, 636 | -4, 637 | 2.022, 638 | 5, 639 | 2.333, 640 | 5, 641 | 1, 642 | 2.567, 643 | 5, 644 | 2.8, 645 | 3.64, 646 | 3.033, 647 | 0, 648 | 1, 649 | 3.133, 650 | -1.56, 651 | 3.233, 652 | -3, 653 | 3.333, 654 | -3, 655 | 1, 656 | 3.467, 657 | -3, 658 | 3.6, 659 | -2, 660 | 3.733, 661 | -2, 662 | 0, 663 | 4.467, 664 | -2 665 | ] 666 | }, 667 | { 668 | "Target": "Parameter", 669 | "Id": "ParamBreath", 670 | "Segments": [ 671 | 0, 672 | 0, 673 | 1, 674 | 0.189, 675 | 0, 676 | 0.378, 677 | 1, 678 | 0.567, 679 | 1, 680 | 1, 681 | 0.711, 682 | 1, 683 | 0.856, 684 | 0, 685 | 1, 686 | 0, 687 | 1, 688 | 1.222, 689 | 0, 690 | 1.444, 691 | 1, 692 | 1.667, 693 | 1, 694 | 1, 695 | 1.889, 696 | 1, 697 | 2.111, 698 | 0, 699 | 2.333, 700 | 0, 701 | 1, 702 | 2.544, 703 | 0, 704 | 2.756, 705 | 1, 706 | 2.967, 707 | 1, 708 | 1, 709 | 3.167, 710 | 1, 711 | 3.367, 712 | 0, 713 | 3.567, 714 | 0, 715 | 0, 716 | 4.467, 717 | 0 718 | ] 719 | }, 720 | { 721 | "Target": "Parameter", 722 | "Id": "ParamShoulder", 723 | "Segments": [ 724 | 0, 725 | 0.1, 726 | 1, 727 | 0.467, 728 | 0.1, 729 | 0.933, 730 | 1, 731 | 1.4, 732 | 1, 733 | 1, 734 | 1.844, 735 | 1, 736 | 2.289, 737 | 1, 738 | 2.733, 739 | 1, 740 | 1, 741 | 2.967, 742 | 1, 743 | 3.2, 744 | -1, 745 | 3.433, 746 | -1, 747 | 0, 748 | 4.467, 749 | -1 750 | ] 751 | }, 752 | { 753 | "Target": "Parameter", 754 | "Id": "ParamLeg", 755 | "Segments": [ 756 | 0, 757 | 1, 758 | 0, 759 | 4.467, 760 | 1 761 | ] 762 | }, 763 | { 764 | "Target": "Parameter", 765 | "Id": "ParamArmLA", 766 | "Segments": [ 767 | 0, 768 | -10, 769 | 0, 770 | 4.467, 771 | -10 772 | ] 773 | }, 774 | { 775 | "Target": "Parameter", 776 | "Id": "ParamArmRA", 777 | "Segments": [ 778 | 0, 779 | -10, 780 | 0, 781 | 4.467, 782 | -10 783 | ] 784 | }, 785 | { 786 | "Target": "Parameter", 787 | "Id": "ParamHairAhoge", 788 | "Segments": [ 789 | 0, 790 | 0, 791 | 1, 792 | 0.3, 793 | 0, 794 | 0.6, 795 | 0, 796 | 0.9, 797 | -0.012, 798 | 1, 799 | 1.067, 800 | -0.019, 801 | 1.233, 802 | -6.827, 803 | 1.4, 804 | -6.827, 805 | 1, 806 | 1.511, 807 | -6.827, 808 | 1.622, 809 | 7.958, 810 | 1.733, 811 | 7.958, 812 | 1, 813 | 1.944, 814 | 7.958, 815 | 2.156, 816 | -7.565, 817 | 2.367, 818 | -7.565, 819 | 1, 820 | 2.5, 821 | -7.565, 822 | 2.633, 823 | 9.434, 824 | 2.767, 825 | 9.434, 826 | 1, 827 | 2.978, 828 | 9.434, 829 | 3.189, 830 | -8.871, 831 | 3.4, 832 | -8.871, 833 | 1, 834 | 3.5, 835 | -8.871, 836 | 3.6, 837 | 7.588, 838 | 3.7, 839 | 7.588, 840 | 1, 841 | 3.789, 842 | 7.588, 843 | 3.878, 844 | -3.904, 845 | 3.967, 846 | -3.904, 847 | 1, 848 | 4.011, 849 | -3.904, 850 | 4.056, 851 | -0.032, 852 | 4.1, 853 | -0.032, 854 | 0, 855 | 4.467, 856 | -0.032 857 | ] 858 | }, 859 | { 860 | "Target": "PartOpacity", 861 | "Id": "PartArmA", 862 | "Segments": [ 863 | 0, 864 | 0.997, 865 | 0, 866 | 4.467, 867 | 0.997 868 | ] 869 | }, 870 | { 871 | "Target": "PartOpacity", 872 | "Id": "PartArmB", 873 | "Segments": [ 874 | 0, 875 | 0.001, 876 | 0, 877 | 4.467, 878 | 0.001 879 | ] 880 | } 881 | ] 882 | } -------------------------------------------------------------------------------- /AndroidWallPaper/Resources/Hiyori/motions/Hiyori_m07.motion3.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": 3, 3 | "Meta": { 4 | "Duration": 1.933, 5 | "Fps": 30.0, 6 | "Loop": true, 7 | "AreBeziersRestricted": false, 8 | "CurveCount": 32, 9 | "TotalSegmentCount": 121, 10 | "TotalPointCount": 331, 11 | "UserDataCount": 0, 12 | "TotalUserDataSize": 0 13 | }, 14 | "Curves": [ 15 | { 16 | "Target": "Parameter", 17 | "Id": "ParamAngleX", 18 | "Segments": [ 19 | 0, 20 | 0, 21 | 1, 22 | 0.111, 23 | 0, 24 | 0.222, 25 | 0, 26 | 0.333, 27 | 0, 28 | 0, 29 | 1.933, 30 | 0 31 | ] 32 | }, 33 | { 34 | "Target": "Parameter", 35 | "Id": "ParamAngleY", 36 | "Segments": [ 37 | 0, 38 | 0, 39 | 1, 40 | 0.111, 41 | 0, 42 | 0.222, 43 | 0, 44 | 0.333, 45 | 0, 46 | 0, 47 | 1.933, 48 | 0 49 | ] 50 | }, 51 | { 52 | "Target": "Parameter", 53 | "Id": "ParamAngleZ", 54 | "Segments": [ 55 | 0, 56 | 0, 57 | 1, 58 | 0.111, 59 | 0, 60 | 0.222, 61 | 0, 62 | 0.333, 63 | 0, 64 | 1, 65 | 0.444, 66 | 0, 67 | 0.556, 68 | 8, 69 | 0.667, 70 | 8, 71 | 0, 72 | 1.933, 73 | 8 74 | ] 75 | }, 76 | { 77 | "Target": "Parameter", 78 | "Id": "ParamCheek", 79 | "Segments": [ 80 | 0, 81 | 0, 82 | 1, 83 | 0.111, 84 | 0, 85 | 0.222, 86 | 0, 87 | 0.333, 88 | 0, 89 | 0, 90 | 1.933, 91 | 0 92 | ] 93 | }, 94 | { 95 | "Target": "Parameter", 96 | "Id": "ParamEyeLOpen", 97 | "Segments": [ 98 | 0, 99 | 1, 100 | 1, 101 | 0.111, 102 | 1, 103 | 0.222, 104 | 1, 105 | 0.333, 106 | 1, 107 | 1, 108 | 0.378, 109 | 1, 110 | 0.422, 111 | 0, 112 | 0.467, 113 | 0, 114 | 1, 115 | 0.522, 116 | 0, 117 | 0.578, 118 | 1.2, 119 | 0.633, 120 | 1.2, 121 | 1, 122 | 0.744, 123 | 1.2, 124 | 0.856, 125 | 1.2, 126 | 0.967, 127 | 1.2, 128 | 1, 129 | 0.989, 130 | 1.2, 131 | 1.011, 132 | 0, 133 | 1.033, 134 | 0, 135 | 1, 136 | 1.067, 137 | 0, 138 | 1.1, 139 | 1.2, 140 | 1.133, 141 | 1.2, 142 | 1, 143 | 1.167, 144 | 1.2, 145 | 1.2, 146 | 1.2, 147 | 1.233, 148 | 1.2, 149 | 1, 150 | 1.267, 151 | 1.2, 152 | 1.3, 153 | 0, 154 | 1.333, 155 | 0, 156 | 1, 157 | 1.356, 158 | 0, 159 | 1.378, 160 | 1.2, 161 | 1.4, 162 | 1.2, 163 | 0, 164 | 1.933, 165 | 1.2 166 | ] 167 | }, 168 | { 169 | "Target": "Parameter", 170 | "Id": "ParamEyeLSmile", 171 | "Segments": [ 172 | 0, 173 | 0, 174 | 1, 175 | 0.111, 176 | 0, 177 | 0.222, 178 | 0, 179 | 0.333, 180 | 0, 181 | 0, 182 | 1.933, 183 | 0 184 | ] 185 | }, 186 | { 187 | "Target": "Parameter", 188 | "Id": "ParamEyeROpen", 189 | "Segments": [ 190 | 0, 191 | 1, 192 | 1, 193 | 0.111, 194 | 1, 195 | 0.222, 196 | 1, 197 | 0.333, 198 | 1, 199 | 1, 200 | 0.378, 201 | 1, 202 | 0.422, 203 | 0, 204 | 0.467, 205 | 0, 206 | 1, 207 | 0.522, 208 | 0, 209 | 0.578, 210 | 1.2, 211 | 0.633, 212 | 1.2, 213 | 1, 214 | 0.744, 215 | 1.2, 216 | 0.856, 217 | 1.2, 218 | 0.967, 219 | 1.2, 220 | 1, 221 | 0.989, 222 | 1.2, 223 | 1.011, 224 | 0, 225 | 1.033, 226 | 0, 227 | 1, 228 | 1.067, 229 | 0, 230 | 1.1, 231 | 1.2, 232 | 1.133, 233 | 1.2, 234 | 1, 235 | 1.167, 236 | 1.2, 237 | 1.2, 238 | 1.2, 239 | 1.233, 240 | 1.2, 241 | 1, 242 | 1.267, 243 | 1.2, 244 | 1.3, 245 | 0, 246 | 1.333, 247 | 0, 248 | 1, 249 | 1.356, 250 | 0, 251 | 1.378, 252 | 1.2, 253 | 1.4, 254 | 1.2, 255 | 0, 256 | 1.933, 257 | 1.2 258 | ] 259 | }, 260 | { 261 | "Target": "Parameter", 262 | "Id": "ParamEyeRSmile", 263 | "Segments": [ 264 | 0, 265 | 0, 266 | 1, 267 | 0.111, 268 | 0, 269 | 0.222, 270 | 0, 271 | 0.333, 272 | 0, 273 | 1, 274 | 0.356, 275 | 0, 276 | 0.378, 277 | 0, 278 | 0.4, 279 | 0, 280 | 1, 281 | 0.489, 282 | 0, 283 | 0.578, 284 | 0, 285 | 0.667, 286 | 0, 287 | 0, 288 | 1.933, 289 | 0 290 | ] 291 | }, 292 | { 293 | "Target": "Parameter", 294 | "Id": "ParamEyeBallX", 295 | "Segments": [ 296 | 0, 297 | 0, 298 | 1, 299 | 0.111, 300 | 0, 301 | 0.222, 302 | 0, 303 | 0.333, 304 | 0, 305 | 1, 306 | 0.356, 307 | 0, 308 | 0.378, 309 | 0, 310 | 0.4, 311 | 0, 312 | 1, 313 | 0.489, 314 | 0, 315 | 0.578, 316 | 0, 317 | 0.667, 318 | 0, 319 | 0, 320 | 1.933, 321 | 0 322 | ] 323 | }, 324 | { 325 | "Target": "Parameter", 326 | "Id": "ParamEyeBallY", 327 | "Segments": [ 328 | 0, 329 | 0, 330 | 1, 331 | 0.111, 332 | 0, 333 | 0.222, 334 | 0, 335 | 0.333, 336 | 0, 337 | 1, 338 | 0.356, 339 | 0, 340 | 0.378, 341 | 0, 342 | 0.4, 343 | 0, 344 | 1, 345 | 0.489, 346 | 0, 347 | 0.578, 348 | 0, 349 | 0.667, 350 | 0, 351 | 0, 352 | 1.933, 353 | 0 354 | ] 355 | }, 356 | { 357 | "Target": "Parameter", 358 | "Id": "ParamBrowLY", 359 | "Segments": [ 360 | 0, 361 | 0, 362 | 1, 363 | 0.111, 364 | 0, 365 | 0.222, 366 | 0, 367 | 0.333, 368 | 0, 369 | 1, 370 | 0.356, 371 | 0, 372 | 0.378, 373 | 0, 374 | 0.4, 375 | 0, 376 | 1, 377 | 0.489, 378 | 0, 379 | 0.578, 380 | 0.26, 381 | 0.667, 382 | 0.26, 383 | 0, 384 | 1.933, 385 | 0.26 386 | ] 387 | }, 388 | { 389 | "Target": "Parameter", 390 | "Id": "ParamBrowRY", 391 | "Segments": [ 392 | 0, 393 | 0, 394 | 1, 395 | 0.111, 396 | 0, 397 | 0.222, 398 | 0, 399 | 0.333, 400 | 0, 401 | 1, 402 | 0.356, 403 | 0, 404 | 0.378, 405 | 0, 406 | 0.4, 407 | 0, 408 | 1, 409 | 0.489, 410 | 0, 411 | 0.578, 412 | 0.36, 413 | 0.667, 414 | 0.36, 415 | 0, 416 | 1.933, 417 | 0.36 418 | ] 419 | }, 420 | { 421 | "Target": "Parameter", 422 | "Id": "ParamBrowLX", 423 | "Segments": [ 424 | 0, 425 | 0, 426 | 1, 427 | 0.111, 428 | 0, 429 | 0.222, 430 | 0, 431 | 0.333, 432 | 0, 433 | 1, 434 | 0.356, 435 | 0, 436 | 0.378, 437 | 0, 438 | 0.4, 439 | 0, 440 | 1, 441 | 0.489, 442 | 0, 443 | 0.578, 444 | 0, 445 | 0.667, 446 | 0, 447 | 0, 448 | 1.933, 449 | 0 450 | ] 451 | }, 452 | { 453 | "Target": "Parameter", 454 | "Id": "ParamBrowRX", 455 | "Segments": [ 456 | 0, 457 | 0, 458 | 1, 459 | 0.111, 460 | 0, 461 | 0.222, 462 | 0, 463 | 0.333, 464 | 0, 465 | 1, 466 | 0.356, 467 | 0, 468 | 0.378, 469 | 0, 470 | 0.4, 471 | 0, 472 | 1, 473 | 0.489, 474 | 0, 475 | 0.578, 476 | 0.27, 477 | 0.667, 478 | 0.27, 479 | 0, 480 | 1.933, 481 | 0.27 482 | ] 483 | }, 484 | { 485 | "Target": "Parameter", 486 | "Id": "ParamBrowLAngle", 487 | "Segments": [ 488 | 0, 489 | 0, 490 | 1, 491 | 0.111, 492 | 0, 493 | 0.222, 494 | 0, 495 | 0.333, 496 | 0, 497 | 1, 498 | 0.356, 499 | 0, 500 | 0.378, 501 | 0, 502 | 0.4, 503 | 0, 504 | 1, 505 | 0.489, 506 | 0, 507 | 0.578, 508 | 0.26, 509 | 0.667, 510 | 0.26, 511 | 0, 512 | 1.933, 513 | 0.26 514 | ] 515 | }, 516 | { 517 | "Target": "Parameter", 518 | "Id": "ParamBrowRAngle", 519 | "Segments": [ 520 | 0, 521 | 0, 522 | 1, 523 | 0.111, 524 | 0, 525 | 0.222, 526 | 0, 527 | 0.333, 528 | 0, 529 | 1, 530 | 0.356, 531 | 0, 532 | 0.378, 533 | 0, 534 | 0.4, 535 | 0, 536 | 1, 537 | 0.489, 538 | 0, 539 | 0.578, 540 | -0.03, 541 | 0.667, 542 | -0.03, 543 | 0, 544 | 1.933, 545 | -0.03 546 | ] 547 | }, 548 | { 549 | "Target": "Parameter", 550 | "Id": "ParamBrowLForm", 551 | "Segments": [ 552 | 0, 553 | 0, 554 | 1, 555 | 0.111, 556 | 0, 557 | 0.222, 558 | 0, 559 | 0.333, 560 | 0, 561 | 1, 562 | 0.356, 563 | 0, 564 | 0.378, 565 | 0, 566 | 0.4, 567 | 0, 568 | 1, 569 | 0.489, 570 | 0, 571 | 0.578, 572 | 0.33, 573 | 0.667, 574 | 0.33, 575 | 0, 576 | 1.933, 577 | 0.33 578 | ] 579 | }, 580 | { 581 | "Target": "Parameter", 582 | "Id": "ParamBrowRForm", 583 | "Segments": [ 584 | 0, 585 | 0, 586 | 1, 587 | 0.111, 588 | 0, 589 | 0.222, 590 | 0, 591 | 0.333, 592 | 0, 593 | 1, 594 | 0.356, 595 | 0, 596 | 0.378, 597 | 0, 598 | 0.4, 599 | 0, 600 | 1, 601 | 0.489, 602 | 0, 603 | 0.578, 604 | 0.21, 605 | 0.667, 606 | 0.21, 607 | 0, 608 | 1.933, 609 | 0.21 610 | ] 611 | }, 612 | { 613 | "Target": "Parameter", 614 | "Id": "ParamMouthForm", 615 | "Segments": [ 616 | 0, 617 | 1, 618 | 1, 619 | 0.111, 620 | 1, 621 | 0.222, 622 | 1, 623 | 0.333, 624 | 1, 625 | 1, 626 | 0.356, 627 | 1, 628 | 0.378, 629 | 1, 630 | 0.4, 631 | 1, 632 | 1, 633 | 0.489, 634 | 1, 635 | 0.578, 636 | -2, 637 | 0.667, 638 | -2, 639 | 0, 640 | 1.933, 641 | -2 642 | ] 643 | }, 644 | { 645 | "Target": "Parameter", 646 | "Id": "ParamMouthOpenY", 647 | "Segments": [ 648 | 0, 649 | 0, 650 | 1, 651 | 0.111, 652 | 0, 653 | 0.222, 654 | 0, 655 | 0.333, 656 | 0, 657 | 1, 658 | 0.356, 659 | 0, 660 | 0.378, 661 | 0, 662 | 0.4, 663 | 0, 664 | 1, 665 | 0.489, 666 | 0, 667 | 0.578, 668 | 0.75, 669 | 0.667, 670 | 0.75, 671 | 0, 672 | 1.933, 673 | 0.75 674 | ] 675 | }, 676 | { 677 | "Target": "Parameter", 678 | "Id": "ParamBodyAngleX", 679 | "Segments": [ 680 | 0, 681 | 0, 682 | 1, 683 | 0.111, 684 | 0, 685 | 0.222, 686 | 0, 687 | 0.333, 688 | 0, 689 | 1, 690 | 0.444, 691 | 0, 692 | 0.556, 693 | -6, 694 | 0.667, 695 | -6, 696 | 0, 697 | 1.933, 698 | -6 699 | ] 700 | }, 701 | { 702 | "Target": "Parameter", 703 | "Id": "ParamBodyAngleY", 704 | "Segments": [ 705 | 0, 706 | 0, 707 | 1, 708 | 0.111, 709 | 0, 710 | 0.222, 711 | 0, 712 | 0.333, 713 | 0, 714 | 1, 715 | 0.422, 716 | 0, 717 | 0.511, 718 | 10, 719 | 0.6, 720 | 10, 721 | 1, 722 | 0.667, 723 | 10, 724 | 0.733, 725 | -6, 726 | 0.8, 727 | -6, 728 | 1, 729 | 0.833, 730 | -6, 731 | 0.867, 732 | 5, 733 | 0.9, 734 | 5, 735 | 1, 736 | 1.011, 737 | 5, 738 | 1.122, 739 | 0, 740 | 1.233, 741 | 0, 742 | 0, 743 | 1.933, 744 | 0 745 | ] 746 | }, 747 | { 748 | "Target": "Parameter", 749 | "Id": "ParamBodyAngleZ", 750 | "Segments": [ 751 | 0, 752 | 0, 753 | 1, 754 | 0.111, 755 | 0, 756 | 0.222, 757 | 0, 758 | 0.333, 759 | 0, 760 | 1, 761 | 0.444, 762 | 0, 763 | 0.556, 764 | -3, 765 | 0.667, 766 | -3, 767 | 0, 768 | 1.933, 769 | -3 770 | ] 771 | }, 772 | { 773 | "Target": "Parameter", 774 | "Id": "ParamBreath", 775 | "Segments": [ 776 | 0, 777 | 0, 778 | 1, 779 | 0.111, 780 | 0, 781 | 0.222, 782 | 0, 783 | 0.333, 784 | 0, 785 | 0, 786 | 1.933, 787 | 0 788 | ] 789 | }, 790 | { 791 | "Target": "Parameter", 792 | "Id": "ParamShoulder", 793 | "Segments": [ 794 | 0, 795 | -0.062, 796 | 1, 797 | 0.111, 798 | -0.062, 799 | 0.222, 800 | -0.103, 801 | 0.333, 802 | 0, 803 | 1, 804 | 0.589, 805 | 0.238, 806 | 0.844, 807 | 1, 808 | 1.1, 809 | 1, 810 | 0, 811 | 1.933, 812 | 1 813 | ] 814 | }, 815 | { 816 | "Target": "Parameter", 817 | "Id": "ParamArmLA", 818 | "Segments": [ 819 | 0, 820 | 0, 821 | 1, 822 | 0.111, 823 | 0, 824 | 0.222, 825 | 0, 826 | 0.333, 827 | 0, 828 | 1, 829 | 0.478, 830 | 0, 831 | 0.622, 832 | -10, 833 | 0.767, 834 | -10, 835 | 1, 836 | 0.811, 837 | -10, 838 | 0.856, 839 | -8.2, 840 | 0.9, 841 | -8.2, 842 | 0, 843 | 1.933, 844 | -8.2 845 | ] 846 | }, 847 | { 848 | "Target": "Parameter", 849 | "Id": "ParamArmRA", 850 | "Segments": [ 851 | 0, 852 | 0, 853 | 1, 854 | 0.111, 855 | 0, 856 | 0.222, 857 | 0, 858 | 0.333, 859 | 0, 860 | 1, 861 | 0.478, 862 | 0, 863 | 0.622, 864 | -10, 865 | 0.767, 866 | -10, 867 | 1, 868 | 0.811, 869 | -10, 870 | 0.856, 871 | -7.2, 872 | 0.9, 873 | -7.2, 874 | 0, 875 | 1.933, 876 | -7.2 877 | ] 878 | }, 879 | { 880 | "Target": "Parameter", 881 | "Id": "ParamArmLB", 882 | "Segments": [ 883 | 0, 884 | 0, 885 | 1, 886 | 0.111, 887 | 0, 888 | 0.222, 889 | 0, 890 | 0.333, 891 | 0, 892 | 0, 893 | 1.933, 894 | 0 895 | ] 896 | }, 897 | { 898 | "Target": "Parameter", 899 | "Id": "ParamArmRB", 900 | "Segments": [ 901 | 0, 902 | 0, 903 | 1, 904 | 0.111, 905 | 0, 906 | 0.222, 907 | 0, 908 | 0.333, 909 | 0, 910 | 0, 911 | 1.933, 912 | 0 913 | ] 914 | }, 915 | { 916 | "Target": "Parameter", 917 | "Id": "ParamHairAhoge", 918 | "Segments": [ 919 | 0, 920 | 0, 921 | 1, 922 | 0.111, 923 | 0, 924 | 0.222, 925 | 1.9, 926 | 0.333, 927 | 5.2, 928 | 1, 929 | 0.444, 930 | 8.5, 931 | 0.556, 932 | 9.926, 933 | 0.667, 934 | 9.926, 935 | 1, 936 | 0.744, 937 | 9.926, 938 | 0.822, 939 | -10, 940 | 0.9, 941 | -10, 942 | 1, 943 | 0.956, 944 | -10, 945 | 1.011, 946 | 6, 947 | 1.067, 948 | 6, 949 | 1, 950 | 1.144, 951 | 6, 952 | 1.222, 953 | -4, 954 | 1.3, 955 | -4, 956 | 1, 957 | 1.367, 958 | -4, 959 | 1.433, 960 | 0, 961 | 1.5, 962 | 0, 963 | 0, 964 | 1.933, 965 | 0 966 | ] 967 | }, 968 | { 969 | "Target": "PartOpacity", 970 | "Id": "PartArmA", 971 | "Segments": [ 972 | 0, 973 | 0.999, 974 | 0, 975 | 1.933, 976 | 0.999 977 | ] 978 | }, 979 | { 980 | "Target": "PartOpacity", 981 | "Id": "PartArmB", 982 | "Segments": [ 983 | 0, 984 | 0, 985 | 0, 986 | 1.933, 987 | 0 988 | ] 989 | } 990 | ] 991 | } -------------------------------------------------------------------------------- /AndroidWallPaper/Resources/Hiyori/motions/Hiyori_m10.motion3.json: -------------------------------------------------------------------------------- 1 | { 2 | "Version": 3, 3 | "Meta": { 4 | "Duration": 4.2, 5 | "Fps": 30.0, 6 | "Loop": true, 7 | "AreBeziersRestricted": false, 8 | "CurveCount": 33, 9 | "TotalSegmentCount": 118, 10 | "TotalPointCount": 321, 11 | "UserDataCount": 0, 12 | "TotalUserDataSize": 0 13 | }, 14 | "Curves": [ 15 | { 16 | "Target": "Parameter", 17 | "Id": "ParamAngleX", 18 | "Segments": [ 19 | 0, 20 | 0, 21 | 1, 22 | 0.067, 23 | 0, 24 | 0.133, 25 | 0, 26 | 0.2, 27 | 0, 28 | 1, 29 | 0.4, 30 | 0, 31 | 0.6, 32 | 0, 33 | 0.8, 34 | 0, 35 | 1, 36 | 1.067, 37 | 0, 38 | 1.333, 39 | 1.041, 40 | 1.6, 41 | 1.041, 42 | 1, 43 | 1.844, 44 | 1.041, 45 | 2.089, 46 | -8, 47 | 2.333, 48 | -8, 49 | 1, 50 | 2.656, 51 | -8, 52 | 2.978, 53 | 6, 54 | 3.3, 55 | 6, 56 | 0, 57 | 4.2, 58 | 6 59 | ] 60 | }, 61 | { 62 | "Target": "Parameter", 63 | "Id": "ParamAngleY", 64 | "Segments": [ 65 | 0, 66 | 0, 67 | 1, 68 | 0.067, 69 | 0, 70 | 0.133, 71 | 0, 72 | 0.2, 73 | 0, 74 | 1, 75 | 0.344, 76 | 0, 77 | 0.489, 78 | -30, 79 | 0.633, 80 | -30, 81 | 0, 82 | 4.2, 83 | -30 84 | ] 85 | }, 86 | { 87 | "Target": "Parameter", 88 | "Id": "ParamAngleZ", 89 | "Segments": [ 90 | 0, 91 | 0, 92 | 1, 93 | 0.067, 94 | 0, 95 | 0.133, 96 | 0, 97 | 0.2, 98 | 0, 99 | 0, 100 | 4.2, 101 | 0 102 | ] 103 | }, 104 | { 105 | "Target": "Parameter", 106 | "Id": "ParamCheek", 107 | "Segments": [ 108 | 0, 109 | 0, 110 | 1, 111 | 0.067, 112 | 0, 113 | 0.133, 114 | 0, 115 | 0.2, 116 | 0, 117 | 0, 118 | 4.2, 119 | 0 120 | ] 121 | }, 122 | { 123 | "Target": "Parameter", 124 | "Id": "ParamEyeLOpen", 125 | "Segments": [ 126 | 0, 127 | 1, 128 | 1, 129 | 0.067, 130 | 1, 131 | 0.133, 132 | 1, 133 | 0.2, 134 | 1, 135 | 1, 136 | 0.311, 137 | 1, 138 | 0.422, 139 | 0.988, 140 | 0.533, 141 | 0.8, 142 | 1, 143 | 0.589, 144 | 0.706, 145 | 0.644, 146 | 0, 147 | 0.7, 148 | 0, 149 | 1, 150 | 0.722, 151 | 0, 152 | 0.744, 153 | 0, 154 | 0.767, 155 | 0, 156 | 1, 157 | 0.822, 158 | 0, 159 | 0.878, 160 | 0.8, 161 | 0.933, 162 | 0.8, 163 | 1, 164 | 1.422, 165 | 0.8, 166 | 1.911, 167 | 0.8, 168 | 2.4, 169 | 0.8, 170 | 1, 171 | 2.456, 172 | 0.8, 173 | 2.511, 174 | 0, 175 | 2.567, 176 | 0, 177 | 1, 178 | 2.589, 179 | 0, 180 | 2.611, 181 | 0, 182 | 2.633, 183 | 0, 184 | 1, 185 | 2.689, 186 | 0, 187 | 2.744, 188 | 0.8, 189 | 2.8, 190 | 0.8, 191 | 0, 192 | 4.2, 193 | 0.8 194 | ] 195 | }, 196 | { 197 | "Target": "Parameter", 198 | "Id": "ParamEyeLSmile", 199 | "Segments": [ 200 | 0, 201 | 0, 202 | 1, 203 | 0.067, 204 | 0, 205 | 0.133, 206 | 0, 207 | 0.2, 208 | 0, 209 | 0, 210 | 4.2, 211 | 0 212 | ] 213 | }, 214 | { 215 | "Target": "Parameter", 216 | "Id": "ParamEyeROpen", 217 | "Segments": [ 218 | 0, 219 | 1, 220 | 1, 221 | 0.067, 222 | 1, 223 | 0.133, 224 | 1, 225 | 0.2, 226 | 1, 227 | 1, 228 | 0.311, 229 | 1, 230 | 0.422, 231 | 0.988, 232 | 0.533, 233 | 0.8, 234 | 1, 235 | 0.589, 236 | 0.706, 237 | 0.644, 238 | 0, 239 | 0.7, 240 | 0, 241 | 1, 242 | 0.722, 243 | 0, 244 | 0.744, 245 | 0, 246 | 0.767, 247 | 0, 248 | 1, 249 | 0.822, 250 | 0, 251 | 0.878, 252 | 0.8, 253 | 0.933, 254 | 0.8, 255 | 1, 256 | 1.422, 257 | 0.8, 258 | 1.911, 259 | 0.8, 260 | 2.4, 261 | 0.8, 262 | 1, 263 | 2.456, 264 | 0.8, 265 | 2.511, 266 | 0, 267 | 2.567, 268 | 0, 269 | 1, 270 | 2.589, 271 | 0, 272 | 2.611, 273 | 0, 274 | 2.633, 275 | 0, 276 | 1, 277 | 2.689, 278 | 0, 279 | 2.744, 280 | 0.8, 281 | 2.8, 282 | 0.8, 283 | 0, 284 | 4.2, 285 | 0.8 286 | ] 287 | }, 288 | { 289 | "Target": "Parameter", 290 | "Id": "ParamEyeRSmile", 291 | "Segments": [ 292 | 0, 293 | 0, 294 | 1, 295 | 0.067, 296 | 0, 297 | 0.133, 298 | 0, 299 | 0.2, 300 | 0, 301 | 1, 302 | 0.278, 303 | 0, 304 | 0.356, 305 | 0, 306 | 0.433, 307 | 0, 308 | 0, 309 | 4.2, 310 | 0 311 | ] 312 | }, 313 | { 314 | "Target": "Parameter", 315 | "Id": "ParamEyeBallX", 316 | "Segments": [ 317 | 0, 318 | 0, 319 | 1, 320 | 0.067, 321 | 0, 322 | 0.133, 323 | 0, 324 | 0.2, 325 | 0, 326 | 1, 327 | 0.278, 328 | 0, 329 | 0.356, 330 | 0, 331 | 0.433, 332 | 0, 333 | 1, 334 | 0.667, 335 | 0, 336 | 0.9, 337 | 0.004, 338 | 1.133, 339 | -0.01, 340 | 1, 341 | 1.4, 342 | -0.025, 343 | 1.667, 344 | -0.43, 345 | 1.933, 346 | -0.43, 347 | 1, 348 | 2.211, 349 | -0.43, 350 | 2.489, 351 | 0.283, 352 | 2.767, 353 | 0.283, 354 | 0, 355 | 4.2, 356 | 0.283 357 | ] 358 | }, 359 | { 360 | "Target": "Parameter", 361 | "Id": "ParamEyeBallY", 362 | "Segments": [ 363 | 0, 364 | 0, 365 | 1, 366 | 0.067, 367 | 0, 368 | 0.133, 369 | 0, 370 | 0.2, 371 | 0, 372 | 1, 373 | 0.278, 374 | 0, 375 | 0.356, 376 | -1, 377 | 0.433, 378 | -1, 379 | 0, 380 | 4.2, 381 | -1 382 | ] 383 | }, 384 | { 385 | "Target": "Parameter", 386 | "Id": "ParamBrowLY", 387 | "Segments": [ 388 | 0, 389 | 0, 390 | 1, 391 | 0.067, 392 | 0, 393 | 0.133, 394 | 0, 395 | 0.2, 396 | 0, 397 | 1, 398 | 0.278, 399 | 0, 400 | 0.356, 401 | 0.19, 402 | 0.433, 403 | 0.19, 404 | 0, 405 | 4.2, 406 | 0.19 407 | ] 408 | }, 409 | { 410 | "Target": "Parameter", 411 | "Id": "ParamBrowRY", 412 | "Segments": [ 413 | 0, 414 | 0, 415 | 1, 416 | 0.067, 417 | 0, 418 | 0.133, 419 | 0, 420 | 0.2, 421 | 0, 422 | 1, 423 | 0.278, 424 | 0, 425 | 0.356, 426 | 0.11, 427 | 0.433, 428 | 0.11, 429 | 0, 430 | 4.2, 431 | 0.11 432 | ] 433 | }, 434 | { 435 | "Target": "Parameter", 436 | "Id": "ParamBrowLX", 437 | "Segments": [ 438 | 0, 439 | 0, 440 | 1, 441 | 0.067, 442 | 0, 443 | 0.133, 444 | 0, 445 | 0.2, 446 | 0, 447 | 1, 448 | 0.278, 449 | 0, 450 | 0.356, 451 | -0.48, 452 | 0.433, 453 | -0.48, 454 | 0, 455 | 4.2, 456 | -0.48 457 | ] 458 | }, 459 | { 460 | "Target": "Parameter", 461 | "Id": "ParamBrowRX", 462 | "Segments": [ 463 | 0, 464 | 0, 465 | 1, 466 | 0.067, 467 | 0, 468 | 0.133, 469 | 0, 470 | 0.2, 471 | 0, 472 | 1, 473 | 0.278, 474 | 0, 475 | 0.356, 476 | 0.29, 477 | 0.433, 478 | 0.29, 479 | 0, 480 | 4.2, 481 | 0.29 482 | ] 483 | }, 484 | { 485 | "Target": "Parameter", 486 | "Id": "ParamBrowLAngle", 487 | "Segments": [ 488 | 0, 489 | 0, 490 | 1, 491 | 0.067, 492 | 0, 493 | 0.133, 494 | 0, 495 | 0.2, 496 | 0, 497 | 1, 498 | 0.278, 499 | 0, 500 | 0.356, 501 | 1, 502 | 0.433, 503 | 1, 504 | 0, 505 | 4.2, 506 | 1 507 | ] 508 | }, 509 | { 510 | "Target": "Parameter", 511 | "Id": "ParamBrowRAngle", 512 | "Segments": [ 513 | 0, 514 | 0, 515 | 1, 516 | 0.067, 517 | 0, 518 | 0.133, 519 | 0, 520 | 0.2, 521 | 0, 522 | 1, 523 | 0.278, 524 | 0, 525 | 0.356, 526 | 0.85, 527 | 0.433, 528 | 0.85, 529 | 0, 530 | 4.2, 531 | 0.85 532 | ] 533 | }, 534 | { 535 | "Target": "Parameter", 536 | "Id": "ParamBrowLForm", 537 | "Segments": [ 538 | 0, 539 | 0, 540 | 1, 541 | 0.067, 542 | 0, 543 | 0.133, 544 | 0, 545 | 0.2, 546 | 0, 547 | 1, 548 | 0.278, 549 | 0, 550 | 0.356, 551 | -0.75, 552 | 0.433, 553 | -0.75, 554 | 0, 555 | 4.2, 556 | -0.75 557 | ] 558 | }, 559 | { 560 | "Target": "Parameter", 561 | "Id": "ParamBrowRForm", 562 | "Segments": [ 563 | 0, 564 | 0, 565 | 1, 566 | 0.067, 567 | 0, 568 | 0.133, 569 | 0, 570 | 0.2, 571 | 0, 572 | 1, 573 | 0.278, 574 | 0, 575 | 0.356, 576 | -0.87, 577 | 0.433, 578 | -0.87, 579 | 0, 580 | 4.2, 581 | -0.87 582 | ] 583 | }, 584 | { 585 | "Target": "Parameter", 586 | "Id": "ParamMouthForm", 587 | "Segments": [ 588 | 0, 589 | 1, 590 | 1, 591 | 0.067, 592 | 1, 593 | 0.133, 594 | 1, 595 | 0.2, 596 | 1, 597 | 1, 598 | 0.278, 599 | 1, 600 | 0.356, 601 | -1, 602 | 0.433, 603 | -1, 604 | 0, 605 | 4.2, 606 | -1 607 | ] 608 | }, 609 | { 610 | "Target": "Parameter", 611 | "Id": "ParamMouthOpenY", 612 | "Segments": [ 613 | 0, 614 | 0, 615 | 1, 616 | 0.067, 617 | 0, 618 | 0.133, 619 | 0, 620 | 0.2, 621 | 0, 622 | 1, 623 | 0.278, 624 | 0, 625 | 0.356, 626 | 1, 627 | 0.433, 628 | 1, 629 | 0, 630 | 4.2, 631 | 1 632 | ] 633 | }, 634 | { 635 | "Target": "Parameter", 636 | "Id": "ParamBodyAngleX", 637 | "Segments": [ 638 | 0, 639 | 0, 640 | 1, 641 | 0.067, 642 | 0, 643 | 0.133, 644 | 0, 645 | 0.2, 646 | 0, 647 | 1, 648 | 0.444, 649 | 0, 650 | 0.689, 651 | 0, 652 | 0.933, 653 | 0, 654 | 1, 655 | 1.211, 656 | 0, 657 | 1.489, 658 | 0, 659 | 1.767, 660 | 0, 661 | 1, 662 | 2.056, 663 | 0, 664 | 2.344, 665 | -6, 666 | 2.633, 667 | -6, 668 | 1, 669 | 3.033, 670 | -6, 671 | 3.433, 672 | 10, 673 | 3.833, 674 | 10, 675 | 0, 676 | 4.2, 677 | 10 678 | ] 679 | }, 680 | { 681 | "Target": "Parameter", 682 | "Id": "ParamBodyAngleY", 683 | "Segments": [ 684 | 0, 685 | 0, 686 | 1, 687 | 0.067, 688 | 0, 689 | 0.133, 690 | 0, 691 | 0.2, 692 | 0, 693 | 0, 694 | 4.2, 695 | 0 696 | ] 697 | }, 698 | { 699 | "Target": "Parameter", 700 | "Id": "ParamBodyAngleZ", 701 | "Segments": [ 702 | 0, 703 | 0, 704 | 1, 705 | 0.067, 706 | 0, 707 | 0.133, 708 | 0, 709 | 0.2, 710 | 0, 711 | 1, 712 | 0.8, 713 | 0, 714 | 1.4, 715 | -2, 716 | 2, 717 | -2, 718 | 1, 719 | 2.456, 720 | -2, 721 | 2.911, 722 | 8.125, 723 | 3.367, 724 | 8.125, 725 | 0, 726 | 4.2, 727 | 8.125 728 | ] 729 | }, 730 | { 731 | "Target": "Parameter", 732 | "Id": "ParamBreath", 733 | "Segments": [ 734 | 0, 735 | 0, 736 | 1, 737 | 0.067, 738 | 0, 739 | 0.133, 740 | 0, 741 | 0.2, 742 | 0, 743 | 0, 744 | 4.2, 745 | 0 746 | ] 747 | }, 748 | { 749 | "Target": "Parameter", 750 | "Id": "ParamShoulder", 751 | "Segments": [ 752 | 0, 753 | 0, 754 | 0, 755 | 4.2, 756 | 0 757 | ] 758 | }, 759 | { 760 | "Target": "Parameter", 761 | "Id": "ParamLeg", 762 | "Segments": [ 763 | 0, 764 | 1, 765 | 1, 766 | 0.667, 767 | 1, 768 | 1.333, 769 | 1, 770 | 2, 771 | 1, 772 | 1, 773 | 2.267, 774 | 1, 775 | 2.533, 776 | 0.948, 777 | 2.8, 778 | 0.948, 779 | 0, 780 | 4.2, 781 | 0.948 782 | ] 783 | }, 784 | { 785 | "Target": "Parameter", 786 | "Id": "ParamArmLA", 787 | "Segments": [ 788 | 0, 789 | 0, 790 | 1, 791 | 0.067, 792 | 0, 793 | 0.133, 794 | 0, 795 | 0.2, 796 | 0, 797 | 1, 798 | 0.233, 799 | 0, 800 | 0.267, 801 | 0, 802 | 0.3, 803 | 0, 804 | 1, 805 | 0.478, 806 | 0, 807 | 0.656, 808 | -10, 809 | 0.833, 810 | -10, 811 | 1, 812 | 0.922, 813 | -10, 814 | 1.011, 815 | -8.846, 816 | 1.1, 817 | -8.846, 818 | 1, 819 | 1.467, 820 | -8.846, 821 | 1.833, 822 | -8.835, 823 | 2.2, 824 | -9.1, 825 | 1, 826 | 2.622, 827 | -9.405, 828 | 3.044, 829 | -10, 830 | 3.467, 831 | -10, 832 | 0, 833 | 4.2, 834 | -10 835 | ] 836 | }, 837 | { 838 | "Target": "Parameter", 839 | "Id": "ParamArmRA", 840 | "Segments": [ 841 | 0, 842 | 0, 843 | 1, 844 | 0.067, 845 | 0, 846 | 0.133, 847 | 0, 848 | 0.2, 849 | 0, 850 | 1, 851 | 0.233, 852 | 0, 853 | 0.267, 854 | 0, 855 | 0.3, 856 | 0, 857 | 1, 858 | 0.478, 859 | 0, 860 | 0.656, 861 | -10, 862 | 0.833, 863 | -10, 864 | 1, 865 | 0.922, 866 | -10, 867 | 1.011, 868 | -8.972, 869 | 1.1, 870 | -8.846, 871 | 1, 872 | 1.467, 873 | -8.328, 874 | 1.833, 875 | -8.2, 876 | 2.2, 877 | -8.2, 878 | 1, 879 | 2.622, 880 | -8.2, 881 | 3.044, 882 | -10, 883 | 3.467, 884 | -10, 885 | 0, 886 | 4.2, 887 | -10 888 | ] 889 | }, 890 | { 891 | "Target": "Parameter", 892 | "Id": "ParamArmLB", 893 | "Segments": [ 894 | 0, 895 | 0, 896 | 0, 897 | 4.2, 898 | 0 899 | ] 900 | }, 901 | { 902 | "Target": "Parameter", 903 | "Id": "ParamArmRB", 904 | "Segments": [ 905 | 0, 906 | 0, 907 | 0, 908 | 4.2, 909 | 0 910 | ] 911 | }, 912 | { 913 | "Target": "Parameter", 914 | "Id": "ParamHairAhoge", 915 | "Segments": [ 916 | 0, 917 | 0, 918 | 1, 919 | 0.067, 920 | 0, 921 | 0.133, 922 | 0, 923 | 0.2, 924 | 0, 925 | 1, 926 | 0.233, 927 | 0, 928 | 0.267, 929 | -5, 930 | 0.3, 931 | -5, 932 | 1, 933 | 0.378, 934 | -5, 935 | 0.456, 936 | 10, 937 | 0.533, 938 | 10, 939 | 1, 940 | 0.633, 941 | 10, 942 | 0.733, 943 | 4, 944 | 0.833, 945 | 4, 946 | 0, 947 | 4.2, 948 | 4 949 | ] 950 | }, 951 | { 952 | "Target": "PartOpacity", 953 | "Id": "PartArmA", 954 | "Segments": [ 955 | 0, 956 | 0.997, 957 | 0, 958 | 4.2, 959 | 0.997 960 | ] 961 | }, 962 | { 963 | "Target": "PartOpacity", 964 | "Id": "PartArmB", 965 | "Segments": [ 966 | 0, 967 | 0, 968 | 0, 969 | 4.2, 970 | 0 971 | ] 972 | } 973 | ] 974 | } -------------------------------------------------------------------------------- /AndroidWallPaper/Resources/back.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/Resources/back.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.10) 2 | 3 | # Set app name. 4 | set(APP_NAME Demo) 5 | # Set directory paths. 6 | set(SDK_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../..) 7 | set(CORE_PATH ${SDK_ROOT_PATH}/Core) 8 | set(FRAMEWORK_PATH ${SDK_ROOT_PATH}/Framework) 9 | set(THIRD_PARTY_PATH ${SDK_ROOT_PATH}/thirdParty) 10 | set(STB_PATH ${THIRD_PARTY_PATH}/stb) 11 | 12 | # Specify version of compiler. 13 | set(CMAKE_CXX_STANDARD 14) 14 | set(CMAKE_CXX_STANDARD_REQUIRED ON) 15 | set(CMAKE_CXX_EXTENSIONS OFF) 16 | 17 | # Add Cubism Core. 18 | # Import as static library. 19 | add_library(Live2DCubismCore STATIC IMPORTED) 20 | # Find library path. 21 | set_target_properties(Live2DCubismCore 22 | PROPERTIES 23 | IMPORTED_LOCATION 24 | ${CORE_PATH}/lib/android/${ANDROID_ABI}/libLive2DCubismCore.a 25 | INTERFACE_INCLUDE_DIRECTORIES ${CORE_PATH}/include 26 | ) 27 | 28 | # Specify Cubism Framework rendering. 29 | set(FRAMEWORK_SOURCE OpenGL) 30 | # Add Cubism Native Framework. 31 | add_subdirectory(${FRAMEWORK_PATH} ${CMAKE_CURRENT_BINARY_DIR}/Framework) 32 | # Add rendering definition to framework. 33 | target_compile_definitions(Framework PUBLIC CSM_TARGET_ANDROID_ES2) 34 | 35 | # Make library for android app. 36 | add_library(${APP_NAME} SHARED) 37 | # Add source files. 38 | add_subdirectory(src/main/cpp) 39 | # Link libraries to app. 40 | target_link_libraries(${APP_NAME} 41 | Framework 42 | Live2DCubismCore 43 | GLESv2 44 | EGL 45 | log 46 | ) 47 | # Specify include directories. 48 | target_include_directories(${APP_NAME} PRIVATE ${STB_PATH}) 49 | 50 | # 51 | # * USE_RENDER_TARGET 52 | # Renderer draws to target of LAppView. 53 | # * USE_MODEL_RENDER_TARGET 54 | # Renderer draws to target of each LAppModel. 55 | # * default 56 | # Renderer draws to default main framebuffer. 57 | # 58 | # INFO: USE_RENDER_TARGET has higher priority than USE_MODEL_RENDER_TARGET. 59 | # 60 | # target_compile_definitions(${APP_NAME} 61 | # PRIVATE 62 | # USE_RENDER_TARGET 63 | # USE_MODEL_RENDER_TARGET 64 | # ) 65 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: 'com.android.application' 2 | 3 | android { 4 | compileSdkVersion PROP_COMPILE_SDK_VERSION.toInteger() 5 | 6 | defaultConfig { 7 | applicationId "com.live2d.demo" 8 | minSdkVersion PROP_MIN_SDK_VERSION 9 | targetSdkVersion PROP_TARGET_SDK_VERSION 10 | versionCode 1 11 | versionName "1.0" 12 | externalNativeBuild { 13 | ndk { 14 | abiFilters = [] 15 | abiFilters.addAll(PROP_APP_ABI.split(':').collect{ it as String }) 16 | } 17 | } 18 | } 19 | buildTypes { 20 | release { 21 | minifyEnabled false 22 | proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 23 | } 24 | debug { 25 | debuggable=true 26 | jniDebuggable=true 27 | } 28 | } 29 | externalNativeBuild { 30 | cmake { 31 | path "CMakeLists.txt" 32 | version "3.18.1" 33 | } 34 | } 35 | sourceSets.main { 36 | assets.srcDir "../Resources" 37 | } 38 | } 39 | 40 | dependencies { 41 | implementation 'androidx.appcompat:appcompat:1.3.0' 42 | } 43 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # You can control the set of applied configuration files using the 3 | # proguardFiles setting in build.gradle. 4 | # 5 | # For more details, see 6 | # http://developer.android.com/guide/developing/tools/proguard.html 7 | 8 | # If your project uses WebView with JS, uncomment the following 9 | # and specify the fully qualified class name to the JavaScript interface 10 | # class: 11 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 12 | # public *; 13 | #} 14 | 15 | # Uncomment this to preserve the line number information for 16 | # debugging stack traces. 17 | #-keepattributes SourceFile,LineNumberTable 18 | 19 | # If you keep the line number information, uncomment this to 20 | # hide the original source file name. 21 | #-renamesourcefileattribute SourceFile 22 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 18 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | target_sources(${APP_NAME} 2 | PRIVATE 3 | ${CMAKE_CURRENT_SOURCE_DIR}/JniBridgeC.cpp 4 | ${CMAKE_CURRENT_SOURCE_DIR}/JniBridgeC.hpp 5 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperAllocator.cpp 6 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperAllocator.hpp 7 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperDefine.cpp 8 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperDefine.hpp 9 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperDelegate.cpp 10 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperDelegate.hpp 11 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperLive2DManager.cpp 12 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperLive2DManager.hpp 13 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperModel.cpp 14 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperModel.hpp 15 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperPal.cpp 16 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperPal.hpp 17 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperSprite.cpp 18 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperSprite.hpp 19 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperTextureManager.cpp 20 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperTextureManager.hpp 21 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperView.cpp 22 | ${CMAKE_CURRENT_SOURCE_DIR}/LWallpaperView.hpp 23 | ${CMAKE_CURRENT_SOURCE_DIR}/TouchManager.cpp 24 | ${CMAKE_CURRENT_SOURCE_DIR}/TouchManager.hpp 25 | ) 26 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/JniBridgeC.cpp: -------------------------------------------------------------------------------- 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 9 | #include "JniBridgeC.hpp" 10 | #include "LWallpaperDelegate.hpp" 11 | #include "LWallpaperPal.hpp" 12 | 13 | using namespace Csm; 14 | 15 | static JavaVM* g_JVM; // JavaVM is valid for all threads, so just save it globally 16 | static jclass g_JniBridgeJavaClass; 17 | static jmethodID g_LoadFileMethodId; 18 | 19 | JNIEnv* GetEnv() 20 | { 21 | JNIEnv* env = NULL; 22 | g_JVM->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6); 23 | return env; 24 | } 25 | 26 | // The VM calls JNI_OnLoad when the native library is loaded 27 | jint JNICALL JNI_OnLoad(JavaVM* vm, void* reserved) 28 | { 29 | g_JVM = vm; 30 | 31 | JNIEnv *env; 32 | if (vm->GetEnv(reinterpret_cast(&env), JNI_VERSION_1_6) != JNI_OK) 33 | { 34 | return JNI_ERR; 35 | } 36 | 37 | jclass clazz = env->FindClass("com/live2d/demo/JniBridgeJava"); 38 | g_JniBridgeJavaClass = reinterpret_cast(env->NewGlobalRef(clazz)); 39 | g_LoadFileMethodId = env->GetStaticMethodID(g_JniBridgeJavaClass, "LoadFile", "(Ljava/lang/String;)[B"); 40 | 41 | return JNI_VERSION_1_6; 42 | } 43 | 44 | void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) 45 | { 46 | JNIEnv *env = GetEnv(); 47 | env->DeleteGlobalRef(g_JniBridgeJavaClass); 48 | } 49 | 50 | char* JniBridgeC::LoadFileAsBytesFromJava(const char* filePath, unsigned int* outSize) 51 | { 52 | JNIEnv *env = GetEnv(); 53 | 54 | // ファイルロード 55 | jbyteArray obj = (jbyteArray)env->CallStaticObjectMethod(g_JniBridgeJavaClass, g_LoadFileMethodId, env->NewStringUTF(filePath)); 56 | *outSize = static_cast(env->GetArrayLength(obj)); 57 | 58 | char* buffer = new char[*outSize]; 59 | env->GetByteArrayRegion(obj, 0, *outSize, reinterpret_cast(buffer)); 60 | 61 | return buffer; 62 | } 63 | 64 | extern "C" 65 | { 66 | JNIEXPORT void JNICALL 67 | Java_com_live2d_demo_JniBridgeJava_nativeOnStart(JNIEnv *env, jclass type) 68 | { 69 | LWallpaperDelegate::GetInstance()->OnStart(); 70 | } 71 | 72 | JNIEXPORT void JNICALL 73 | Java_com_live2d_demo_JniBridgeJava_nativeOnPause(JNIEnv *env, jclass type) 74 | { 75 | LWallpaperDelegate::GetInstance()->OnPause(); 76 | } 77 | 78 | JNIEXPORT void JNICALL 79 | Java_com_live2d_demo_JniBridgeJava_nativeOnStop(JNIEnv *env, jclass type) 80 | { 81 | LWallpaperDelegate::GetInstance()->OnStop(); 82 | } 83 | 84 | JNIEXPORT void JNICALL 85 | Java_com_live2d_demo_JniBridgeJava_nativeOnDestroy(JNIEnv *env, jclass type) 86 | { 87 | LWallpaperDelegate::GetInstance()->OnDestroy(); 88 | } 89 | 90 | JNIEXPORT void JNICALL 91 | Java_com_live2d_demo_JniBridgeJava_nativeOnSurfaceCreated(JNIEnv *env, jclass type) 92 | { 93 | // 第一問 1.1 94 | LWallpaperDelegate::GetInstance()->OnSurfaceCreate(); 95 | } 96 | 97 | JNIEXPORT void JNICALL 98 | Java_com_live2d_demo_JniBridgeJava_nativeOnSurfaceChanged(JNIEnv *env, jclass type, jint width, jint height) 99 | { 100 | // 第一問 1.2 101 | LWallpaperDelegate::GetInstance()->OnSurfaceChanged(width, height); 102 | } 103 | 104 | JNIEXPORT void JNICALL 105 | Java_com_live2d_demo_JniBridgeJava_nativeOnDrawFrame(JNIEnv *env, jclass type) 106 | { 107 | // 第一問 1.3 108 | LWallpaperDelegate::GetInstance()->Run(); 109 | } 110 | 111 | JNIEXPORT void JNICALL 112 | Java_com_live2d_demo_JniBridgeJava_nativeOnTouchesBegan(JNIEnv *env, jclass type, jfloat pointX, jfloat pointY) 113 | { 114 | LWallpaperDelegate::GetInstance()->OnTouchBegan(pointX, pointY); 115 | } 116 | 117 | JNIEXPORT void JNICALL 118 | Java_com_live2d_demo_JniBridgeJava_nativeOnTouchesEnded(JNIEnv *env, jclass type, jfloat pointX, jfloat pointY) 119 | { 120 | LWallpaperDelegate::GetInstance()->OnTouchEnded(pointX, pointY); 121 | } 122 | 123 | JNIEXPORT void JNICALL 124 | Java_com_live2d_demo_JniBridgeJava_nativeOnTouchesMoved(JNIEnv *env, jclass type, jfloat pointX, jfloat pointY) 125 | { 126 | LWallpaperDelegate::GetInstance()->OnTouchMoved(pointX, pointY); 127 | } 128 | 129 | JNIEXPORT void JNICALL 130 | Java_com_live2d_demo_JniBridgeJava_nativeStartRandomMotion(JNIEnv *env, jclass type) 131 | { 132 | // 第二問 2.1 133 | LWallpaperDelegate::GetInstance()->StartRandomMotion(); 134 | } 135 | 136 | JNIEXPORT void JNICALL 137 | Java_com_live2d_demo_JniBridgeJava_nativeStartMotion(JNIEnv *env, jclass type, jint index) 138 | { 139 | LWallpaperDelegate::GetInstance()->StartMotion(index); 140 | } 141 | 142 | JNIEXPORT void JNICALL 143 | Java_com_live2d_demo_JniBridgeJava_nativeSetClearColor(JNIEnv *env, jclass clazz, jfloat r, jfloat g, jfloat b) 144 | { 145 | LWallpaperDelegate::GetInstance()->SetClearColor(r, g, b); 146 | } 147 | 148 | JNIEXPORT void JNICALL 149 | Java_com_live2d_demo_JniBridgeJava_SetBackGroundSpriteAlpha(JNIEnv *env, jclass clazz, jfloat a) 150 | { 151 | LWallpaperDelegate::GetInstance()->SetBackGroundSpriteAlpha(a); 152 | } 153 | 154 | JNIEXPORT void JNICALL 155 | Java_com_live2d_demo_JniBridgeJava_SetGravitationalAccelerationX(JNIEnv *env, jclass clazz, jfloat gravity) 156 | { 157 | LWallpaperDelegate::GetInstance()->SetGravitationalAccelerationX(gravity); 158 | } 159 | } 160 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/JniBridgeC.hpp: -------------------------------------------------------------------------------- 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 | /** 11 | * @brief Jni Bridge Class 12 | */ 13 | class JniBridgeC 14 | { 15 | public: 16 | /** 17 | * @brief Javaからファイル読み込み 18 | */ 19 | static char* LoadFileAsBytesFromJava(const char* filePath, unsigned int* outSize); 20 | }; 21 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperAllocator.cpp: -------------------------------------------------------------------------------- 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 "LWallpaperAllocator.hpp" 9 | 10 | using namespace Csm; 11 | 12 | void* LWallpaperAllocator::Allocate(const csmSizeType size) 13 | { 14 | return malloc(size); 15 | } 16 | 17 | void LWallpaperAllocator::Deallocate(void* memory) 18 | { 19 | free(memory); 20 | } 21 | 22 | void* LWallpaperAllocator::AllocateAligned(const csmSizeType size, const csmUint32 alignment) 23 | { 24 | size_t offset, shift, alignedAddress; 25 | void* allocation; 26 | void** preamble; 27 | 28 | offset = alignment - 1 + sizeof(void*); 29 | 30 | allocation = Allocate(size + static_cast(offset)); 31 | 32 | alignedAddress = reinterpret_cast(allocation) + sizeof(void*); 33 | 34 | shift = alignedAddress % alignment; 35 | 36 | if (shift) 37 | { 38 | alignedAddress += (alignment - shift); 39 | } 40 | 41 | preamble = reinterpret_cast(alignedAddress); 42 | preamble[-1] = allocation; 43 | 44 | return reinterpret_cast(alignedAddress); 45 | } 46 | 47 | void LWallpaperAllocator::DeallocateAligned(void* alignedMemory) 48 | { 49 | void** preamble; 50 | 51 | preamble = static_cast(alignedMemory); 52 | 53 | Deallocate(preamble[-1]); 54 | } 55 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperAllocator.hpp: -------------------------------------------------------------------------------- 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 11 | #include 12 | 13 | /** 14 | * @brief メモリアロケーションを実装するクラス。 15 | * 16 | * メモリ確保・解放処理のインターフェースの実装。 17 | * フレームワークから呼び出される。 18 | * 19 | */ 20 | class LWallpaperAllocator : public Csm::ICubismAllocator 21 | { 22 | /** 23 | * @brief メモリ領域を割り当てる。 24 | * 25 | * @param[in] size 割り当てたいサイズ。 26 | * @return 指定したメモリ領域 27 | */ 28 | void* Allocate(const Csm::csmSizeType size); 29 | 30 | /** 31 | * @brief メモリ領域を解放する 32 | * 33 | * @param[in] memory 解放するメモリ。 34 | */ 35 | void Deallocate(void* memory); 36 | 37 | /** 38 | * @brief 39 | * 40 | * @param[in] size 割り当てたいサイズ。 41 | * @param[in] alignment 割り当てたいサイズ。 42 | * @return alignedAddress 43 | */ 44 | void* AllocateAligned(const Csm::csmSizeType size, const Csm::csmUint32 alignment); 45 | 46 | /** 47 | * @brief 48 | * 49 | * @param[in] alignedMemory 解放するメモリ。 50 | */ 51 | void DeallocateAligned(void* alignedMemory); 52 | }; 53 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperDefine.cpp: -------------------------------------------------------------------------------- 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 "LWallpaperDefine.hpp" 9 | #include 10 | 11 | namespace LWallpaperDefine { 12 | 13 | using namespace Csm; 14 | 15 | // 画面 16 | const csmFloat32 ViewScale = 1.0f; 17 | const csmFloat32 ViewMaxScale = 2.0f; 18 | const csmFloat32 ViewMinScale = 0.8f; 19 | 20 | const csmFloat32 ViewLogicalLeft = -1.0f; 21 | const csmFloat32 ViewLogicalRight = 1.0f; 22 | const csmFloat32 ViewLogicalBottom = -1.0f; 23 | const csmFloat32 ViewLogicalTop = 1.0f; 24 | 25 | const csmFloat32 ViewLogicalMaxLeft = -2.0f; 26 | const csmFloat32 ViewLogicalMaxRight = 2.0f; 27 | const csmFloat32 ViewLogicalMaxBottom = -2.0f; 28 | const csmFloat32 ViewLogicalMaxTop = 2.0f; 29 | 30 | // 相対パス 31 | const csmChar* ResourcesPath = ""; 32 | 33 | // モデルの後ろにある背景の画像ファイル 34 | const csmChar* BackImageName = "back.png"; 35 | // 歯車 36 | const csmChar* GearImageName = "icon_gear.png"; 37 | // 終了ボタン 38 | const csmChar* PowerImageName = "close.png"; 39 | 40 | // モデル定義------------------------------------------ 41 | // モデルを配置したディレクトリ名の配列 42 | // ディレクトリ名とmodel3.jsonの名前を一致させておくこと 43 | const csmChar* ModelDir[] = { 44 | "Haru", 45 | "Hiyori", 46 | "Mark", 47 | "Natori", 48 | "Rice" 49 | }; 50 | const csmInt32 ModelDirSize = sizeof(ModelDir) / sizeof(const csmChar*); 51 | 52 | // 外部定義ファイル(json)と合わせる 53 | const csmChar* MotionGroupIdle = "Idle"; // アイドリング 54 | const csmChar* MotionGroupTapBody = "TapBody"; // 体をタップしたとき 55 | 56 | // 外部定義ファイル(json)と合わせる 57 | const csmChar* HitAreaNameHead = "Head"; 58 | const csmChar* HitAreaNameBody = "Body"; 59 | 60 | // モーションの優先度定数 61 | const csmInt32 PriorityNone = 0; 62 | const csmInt32 PriorityIdle = 1; 63 | const csmInt32 PriorityNormal = 2; 64 | const csmInt32 PriorityForce = 3; 65 | 66 | // デバッグ用ログの表示オプション 67 | const csmBool DebugLogEnable = true; 68 | const csmBool DebugTouchLogEnable = false; 69 | 70 | // Frameworkから出力するログのレベル設定 71 | const CubismFramework::Option::LogLevel CubismLoggingLevel = CubismFramework::Option::LogLevel_Verbose; 72 | } 73 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperDefine.hpp: -------------------------------------------------------------------------------- 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 11 | 12 | /** 13 | * @brief Sample Appで使用する定数 14 | * 15 | */ 16 | namespace LWallpaperDefine { 17 | 18 | using namespace Csm; 19 | 20 | extern const csmFloat32 ViewScale; ///< 拡大縮小率 21 | extern const csmFloat32 ViewMaxScale; ///< 拡大縮小率の最大値 22 | extern const csmFloat32 ViewMinScale; ///< 拡大縮小率の最小値 23 | 24 | extern const csmFloat32 ViewLogicalLeft; ///< 論理的なビュー座標系の左端の値 25 | extern const csmFloat32 ViewLogicalRight; ///< 論理的なビュー座標系の右端の値 26 | extern const csmFloat32 ViewLogicalBottom; ///< 論理的なビュー座標系の下端の値 27 | extern const csmFloat32 ViewLogicalTop; ///< 論理的なビュー座標系の上端の値 28 | 29 | extern const csmFloat32 ViewLogicalMaxLeft; ///< 論理的なビュー座標系の左端の最大値 30 | extern const csmFloat32 ViewLogicalMaxRight; ///< 論理的なビュー座標系の右端の最大値 31 | extern const csmFloat32 ViewLogicalMaxBottom; ///< 論理的なビュー座標系の下端の最大値 32 | extern const csmFloat32 ViewLogicalMaxTop; ///< 論理的なビュー座標系の上端の最大値 33 | 34 | extern const csmChar* ResourcesPath; ///< 素材パス 35 | extern const csmChar* BackImageName; ///< 背景画像ファイル 36 | extern const csmChar* GearImageName; ///< 歯車画像ファイル 37 | extern const csmChar* PowerImageName; ///< 終了ボタン画像ファイル 38 | 39 | // モデル定義-------------------------------------------- 40 | extern const csmChar* ModelDir[]; ///< モデルを配置したディレクトリ名の配列. ディレクトリ名とmodel3.jsonの名前を一致させておく. 41 | extern const csmInt32 ModelDirSize; ///< モデルディレクトリ配列のサイズ 42 | 43 | // 外部定義ファイル(json)と合わせる 44 | extern const csmChar* MotionGroupIdle; ///< アイドリング時に再生するモーションのリスト 45 | extern const csmChar* MotionGroupTapBody; ///< 体をタップした時に再生するモーションのリスト 46 | 47 | // 外部定義ファイル(json)と合わせる 48 | extern const csmChar* HitAreaNameHead; ///< 当たり判定の[Head]タグ 49 | extern const csmChar* HitAreaNameBody; ///< 当たり判定の[Body]タグ 50 | 51 | // モーションの優先度定数 52 | extern const csmInt32 PriorityNone; ///< モーションの優先度定数: 0 53 | extern const csmInt32 PriorityIdle; ///< モーションの優先度定数: 1 54 | extern const csmInt32 PriorityNormal; ///< モーションの優先度定数: 2 55 | extern const csmInt32 PriorityForce; ///< モーションの優先度定数: 3 56 | 57 | // デバッグ用ログの表示 58 | extern const csmBool DebugLogEnable; ///< デバッグ用ログ表示の有効・無効 59 | extern const csmBool DebugTouchLogEnable; ///< タッチ処理のデバッグ用ログ表示の有効・無効 60 | 61 | // Frameworkから出力するログのレベル設定 62 | extern const CubismFramework::Option::LogLevel CubismLoggingLevel; 63 | } 64 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperDelegate.cpp: -------------------------------------------------------------------------------- 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 "LWallpaperDelegate.hpp" 9 | #include 10 | #include 11 | #include 12 | #include "LWallpaperView.hpp" 13 | #include "LWallpaperPal.hpp" 14 | #include "LWallpaperDefine.hpp" 15 | #include "LWallpaperLive2DManager.hpp" 16 | #include "LWallpaperTextureManager.hpp" 17 | #include "JniBridgeC.hpp" 18 | #include "Utils/CubismDebug.hpp" 19 | #include "LWallpaperModel.hpp" 20 | #include "Math/CubismMath.hpp" 21 | 22 | using namespace Csm; 23 | using namespace std; 24 | using namespace LWallpaperDefine; 25 | 26 | namespace { 27 | LWallpaperDelegate* s_instance = nullptr; 28 | } 29 | 30 | LWallpaperDelegate* LWallpaperDelegate::GetInstance() 31 | { 32 | if (!s_instance) 33 | { 34 | s_instance = new LWallpaperDelegate(); 35 | } 36 | 37 | return s_instance; 38 | } 39 | 40 | void LWallpaperDelegate::ReleaseInstance() 41 | { 42 | if (s_instance) 43 | { 44 | delete s_instance; 45 | } 46 | 47 | s_instance = nullptr; 48 | } 49 | 50 | 51 | void LWallpaperDelegate::OnStart() 52 | { 53 | LWallpaperPal::UpdateTime(); 54 | } 55 | 56 | void LWallpaperDelegate::OnPause() 57 | { 58 | 59 | } 60 | 61 | void LWallpaperDelegate::OnStop() 62 | { 63 | if (_view) 64 | { 65 | delete _view; 66 | _view = nullptr; 67 | } 68 | if (_textureManager) 69 | { 70 | delete _textureManager; 71 | _textureManager = nullptr; 72 | } 73 | 74 | // リソースを解放 75 | LWallpaperLive2DManager::ReleaseInstance(); 76 | 77 | CubismFramework::Dispose(); 78 | } 79 | 80 | void LWallpaperDelegate::OnDestroy() 81 | { 82 | OnStop(); 83 | ReleaseInstance(); 84 | } 85 | 86 | void LWallpaperDelegate::Run() 87 | { 88 | // 時間更新 89 | LWallpaperPal::UpdateTime(); 90 | 91 | // 第一問 2.1 92 | // 画面の初期化 93 | glClearColor(_r, _g, _b, 1.0f); 94 | glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 95 | glClearDepthf(1.0f); 96 | 97 | //描画更新 98 | if (_view) 99 | { 100 | _view->Render(); 101 | } 102 | } 103 | 104 | void LWallpaperDelegate::OnSurfaceCreate() 105 | { 106 | _view = new LWallpaperView(); 107 | _textureManager = new LWallpaperTextureManager(); 108 | 109 | // setup view 110 | int width,height; 111 | glViewport(0, 0, width, height); 112 | _width = width; 113 | _height = height; 114 | 115 | //テクスチャサンプリング設定 116 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 117 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); 118 | 119 | //透過設定 120 | glEnable(GL_BLEND); 121 | glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 122 | 123 | //Initialize cubism 124 | CubismFramework::Initialize(); 125 | 126 | _view->InitializeShader(); 127 | } 128 | 129 | void LWallpaperDelegate::OnSurfaceChanged(float width, float height) 130 | { 131 | glViewport(0, 0, width, height); 132 | _width = width; 133 | _height = height; 134 | 135 | //AppViewの初期化 136 | _view->Initialize(); 137 | _view->InitializeSprite(); 138 | 139 | _isActive = true; 140 | } 141 | 142 | LWallpaperDelegate::LWallpaperDelegate(): 143 | _cubismOption(), 144 | _isCaptured(false), 145 | _mouseX(0.0f), 146 | _mouseY(0.0f), 147 | _isActive(true), 148 | _width(0), 149 | _height(0), 150 | _viewPoint(0,0), 151 | _isTapped(false), 152 | _isSecondCount(false), 153 | _deltaTimeCount(0.0f), 154 | _r(0.0f), 155 | _g(0.0f), 156 | _b(0.0f) 157 | { 158 | // Setup Cubism 159 | _cubismOption.LogFunction = LWallpaperPal::PrintMessage; 160 | _cubismOption.LoggingLevel = LWallpaperDefine::CubismLoggingLevel; 161 | CubismFramework::CleanUp(); 162 | CubismFramework::StartUp(&_cubismAllocator, &_cubismOption); 163 | } 164 | 165 | LWallpaperDelegate::~LWallpaperDelegate() 166 | { 167 | } 168 | 169 | void LWallpaperDelegate::OnTouchBegan(double x, double y) 170 | { 171 | _mouseX = static_cast(x); 172 | _mouseY = static_cast(y); 173 | 174 | if (_view) 175 | { 176 | _isTapped = true; 177 | _isSecondCount = false; 178 | _isCaptured = true; 179 | _view->OnTouchesBegan(_mouseX, _mouseY); 180 | } 181 | } 182 | 183 | void LWallpaperDelegate::OnTouchEnded(double x, double y) 184 | { 185 | _mouseX = static_cast(x); 186 | _mouseY = static_cast(y); 187 | 188 | if (_view) 189 | { 190 | _isTapped = false; 191 | _isSecondCount = true; 192 | _deltaTimeCount = 0.0f; 193 | _isCaptured = false; 194 | _viewPoint = _view->OnTouchesEnded(_mouseX, _mouseY); 195 | } 196 | } 197 | 198 | void LWallpaperDelegate::OnTouchMoved(double x, double y) 199 | { 200 | _mouseX = static_cast(x); 201 | _mouseY = static_cast(y); 202 | 203 | if (_isCaptured && _view) 204 | { 205 | _isTapped = false; 206 | _isSecondCount = false; 207 | _view->OnTouchesMoved(_mouseX, _mouseY); 208 | } 209 | } 210 | 211 | GLuint LWallpaperDelegate::CreateShader() 212 | { 213 | //バーテックスシェーダのコンパイル 214 | GLuint vertexShaderId = glCreateShader(GL_VERTEX_SHADER); 215 | const char* vertexShader = 216 | "#version 100\n" 217 | "attribute vec3 position;" 218 | "attribute vec2 uv;" 219 | "varying vec2 vuv;" 220 | "void main(void){" 221 | " gl_Position = vec4(position, 1.0);" 222 | " vuv = uv;" 223 | "}"; 224 | glShaderSource(vertexShaderId, 1, &vertexShader, nullptr); 225 | glCompileShader(vertexShaderId); 226 | 227 | //フラグメントシェーダのコンパイル 228 | GLuint fragmentShaderId = glCreateShader(GL_FRAGMENT_SHADER); 229 | const char* fragmentShader = 230 | "#version 100\n" 231 | "precision mediump float;" 232 | "varying vec2 vuv;" 233 | "uniform sampler2D texture;" 234 | "uniform vec4 baseColor;" 235 | "void main(void){" 236 | " gl_FragColor = texture2D(texture, vuv) * baseColor;" 237 | "}"; 238 | glShaderSource(fragmentShaderId, 1, &fragmentShader, nullptr); 239 | glCompileShader(fragmentShaderId); 240 | 241 | //プログラムオブジェクトの作成 242 | GLuint programId = glCreateProgram(); 243 | glAttachShader(programId, vertexShaderId); 244 | glAttachShader(programId, fragmentShaderId); 245 | 246 | // リンク 247 | glLinkProgram(programId); 248 | 249 | glUseProgram(programId); 250 | 251 | return programId; 252 | } 253 | 254 | void LWallpaperDelegate::StartRandomMotion() 255 | { 256 | LWallpaperLive2DManager::GetInstance()->GetModel()->StartRandomMotion(); 257 | } 258 | 259 | void LWallpaperDelegate::StartMotion(Csm::csmInt32 index) 260 | { 261 | LWallpaperLive2DManager::GetInstance()->GetModel()->StartOrderMotion(MotionGroupIdle, index, PriorityIdle); 262 | } 263 | 264 | void LWallpaperDelegate::ParameterResetCount() 265 | { 266 | if (_isSecondCount) 267 | { 268 | if (_deltaTimeCount > 1.0f) 269 | { 270 | _isSecondCount = false; 271 | _deltaTimeCount = 0.0f; 272 | } 273 | 274 | _deltaTimeCount += LWallpaperPal::GetDeltaTime(); 275 | } 276 | } 277 | 278 | void LWallpaperDelegate::SetClearColor(float r, float g, float b) 279 | { 280 | //カラー情報を設定 281 | _r = r; 282 | _g = g; 283 | _b = b; 284 | } 285 | 286 | void LWallpaperDelegate::SetBackGroundSpriteAlpha(float a) 287 | { 288 | // 第四問 1.1 289 | if (_view) 290 | { 291 | _view->SetBackGroundSpriteColor(1.0f,1.0f,1.0f,a); 292 | } 293 | } 294 | 295 | void LWallpaperDelegate::SetGravitationalAccelerationX(float gravity) 296 | { 297 | // 第四問 1.2 298 | if (CubismMath::AbsF(gravity) < 0.001f) 299 | { 300 | return; 301 | } 302 | LWallpaperLive2DManager::GetInstance()->SetGravitationalAccelerationX(gravity); 303 | } 304 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperDelegate.hpp: -------------------------------------------------------------------------------- 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 11 | #include 12 | #include "LWallpaperAllocator.hpp" 13 | #include "Math/CubismVector2.hpp" 14 | 15 | class LWallpaperView; 16 | class LWallpaperTextureManager; 17 | 18 | /** 19 | * @brief アプリケーションクラス。 20 | * Cubism SDK の管理を行う。 21 | */ 22 | class LWallpaperDelegate 23 | { 24 | public: 25 | /** 26 | * @brief クラスのインスタンス(シングルトン)を返す。
27 | * インスタンスが生成されていない場合は内部でインスタンを生成する。 28 | * 29 | * @return クラスのインスタンス 30 | */ 31 | static LWallpaperDelegate* GetInstance(); 32 | 33 | /** 34 | * @brief クラスのインスタンス(シングルトン)を解放する。 35 | * 36 | */ 37 | static void ReleaseInstance(); 38 | 39 | /** 40 | * @brief JavaのActivityのOnStart()のコールバック関数。 41 | */ 42 | void OnStart(); 43 | 44 | /** 45 | * @brief JavaのActivityのOnPause()のコールバック関数。 46 | */ 47 | void OnPause(); 48 | 49 | /** 50 | * @brief JavaのActivityのOnStop()のコールバック関数。 51 | */ 52 | void OnStop(); 53 | 54 | /** 55 | * @brief JavaのActivityのOnDestroy()のコールバック関数。 56 | */ 57 | void OnDestroy(); 58 | 59 | /** 60 | * @brief JavaのGLSurfaceviewのOnSurfaceCreate()のコールバック関数。 61 | */ 62 | void OnSurfaceCreate(); 63 | 64 | /** 65 | * @brief JavaのGLSurfaceviewのOnSurfaceChanged()のコールバック関数。 66 | * @param width 67 | * @param height 68 | */ 69 | void OnSurfaceChanged(float width, float height); 70 | 71 | /** 72 | * @brief 実行処理。 73 | */ 74 | void Run(); 75 | 76 | /** 77 | * @brief Touch開始。 78 | * 79 | * @param[in] x x座標 80 | * @param[in] y x座標 81 | */ 82 | void OnTouchBegan(double x, double y); 83 | 84 | /** 85 | * @brief Touch終了。 86 | * 87 | * @param[in] x x座標 88 | * @param[in] y x座標 89 | */ 90 | void OnTouchEnded(double x, double y); 91 | 92 | /** 93 | * @brief Touch移動。 94 | * 95 | * @param[in] x x座標 96 | * @param[in] y x座標 97 | */ 98 | void OnTouchMoved(double x, double y); 99 | 100 | /** 101 | * @brief ランダムなモーションの開始 102 | */ 103 | void StartRandomMotion(); 104 | 105 | /** 106 | * @brief モーションの開始 107 | */ 108 | void StartMotion(Csm::csmInt32 index); 109 | 110 | /** 111 | * @brief シェーダーを登録する。 112 | */ 113 | GLuint CreateShader(); 114 | 115 | /** 116 | * @brief パラメータを初期状態に戻すまでの時間をカウントする。 117 | */ 118 | void ParameterResetCount(); 119 | 120 | /** 121 | * @brief 背景クリア色設定 122 | * @param[in] r 赤(0.0~1.0) 123 | * @param[in] g 緑(0.0~1.0) 124 | * @param[in] b 青(0.0~1.0) 125 | */ 126 | void SetClearColor(float r, float g, float b); 127 | 128 | /** 129 | * @brief 背景画像アルファ値 130 | * @param[in] r 赤(0.0~1.0) 131 | * @param[in] g 緑(0.0~1.0) 132 | * @param[in] b 青(0.0~1.0) 133 | */ 134 | void SetBackGroundSpriteAlpha(float a); 135 | 136 | /** 137 | * @brief 重力加速度の値の設定 138 | * @param[in] gravity 重力加速度(-9.81~9.81) 139 | */ 140 | void SetGravitationalAccelerationX(float gravity); 141 | 142 | /** 143 | * @brief テクスチャマネージャーの取得 144 | */ 145 | LWallpaperTextureManager* GetTextureManager() { return _textureManager; } 146 | 147 | /** 148 | * @brief ウインドウ幅の設定 149 | */ 150 | int GetWindowWidth() { return _width; } 151 | 152 | /** 153 | * @brief ウインドウ高さの取得 154 | */ 155 | int GetWindowHeight() { return _height; } 156 | 157 | /** 158 | * @brief View情報を取得する。 159 | */ 160 | LWallpaperView* GetView() { return _view; } 161 | 162 | /** 163 | * @brief View座標を取得する。 164 | */ 165 | Csm::CubismVector2 GetViewPoint() { return _viewPoint; } 166 | 167 | /** 168 | * @brief タップ状態かを取得する。 169 | */ 170 | bool GetIsTapped() { return _isTapped; } 171 | 172 | /** 173 | * @brief タップ状態から解放されたかどうかを取得する。 174 | */ 175 | bool GetIsSecondCount() { return _isSecondCount; } 176 | 177 | private: 178 | /** 179 | * @brief コンストラクタ 180 | */ 181 | LWallpaperDelegate(); 182 | 183 | /** 184 | * @brief デストラクタ 185 | */ 186 | ~LWallpaperDelegate(); 187 | 188 | LWallpaperAllocator _cubismAllocator; ///< Cubism SDK Allocator 189 | Csm::CubismFramework::Option _cubismOption; ///< Cubism SDK Option 190 | LWallpaperTextureManager* _textureManager; ///< テクスチャマネージャー 191 | LWallpaperView* _view; ///< View情報 192 | int _width; ///< Windowの幅 193 | int _height; ///< windowの高さ 194 | bool _isCaptured; ///< クリックしているか 195 | bool _isTapped; ///< タップ状態か 196 | bool _isSecondCount; ///< 時間をカウントしているか 197 | bool _isActive; ///< アプリがアクティブ状態なのか 198 | float _mouseY; ///< マウスY座標 199 | float _mouseX; ///< マウスX座標 200 | 201 | Csm::CubismVector2 _viewPoint; ///< ビュー座標 202 | Csm::csmFloat32 _deltaTimeCount; ///< 経過したデルタ時間 203 | 204 | float _r,_g,_b; ///< カラー情報 205 | }; 206 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperLive2DManager.cpp: -------------------------------------------------------------------------------- 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 "LWallpaperLive2DManager.hpp" 9 | #include 10 | #include 11 | #include 12 | #include "LWallpaperPal.hpp" 13 | #include "LWallpaperDefine.hpp" 14 | #include "LWallpaperDelegate.hpp" 15 | #include "LWallpaperModel.hpp" 16 | #include "LWallpaperView.hpp" 17 | 18 | using namespace Csm; 19 | using namespace LWallpaperDefine; 20 | using namespace std; 21 | 22 | namespace { 23 | LWallpaperLive2DManager* s_instance = nullptr; 24 | } 25 | 26 | LWallpaperLive2DManager* LWallpaperLive2DManager::GetInstance() 27 | { 28 | if (!s_instance) 29 | { 30 | s_instance = new LWallpaperLive2DManager(); 31 | } 32 | 33 | return s_instance; 34 | } 35 | 36 | void LWallpaperLive2DManager::ReleaseInstance() 37 | { 38 | if (s_instance) 39 | { 40 | delete s_instance; 41 | } 42 | 43 | s_instance = nullptr; 44 | } 45 | 46 | LWallpaperLive2DManager::LWallpaperLive2DManager() 47 | { 48 | _viewMatrix = new CubismMatrix44(); 49 | LoadModel(_modelDirectoryName); 50 | } 51 | 52 | LWallpaperLive2DManager::~LWallpaperLive2DManager() 53 | { 54 | ReleaseModel(); 55 | } 56 | 57 | void LWallpaperLive2DManager::ReleaseModel() 58 | { 59 | delete _model; 60 | } 61 | 62 | LWallpaperModel* LWallpaperLive2DManager::GetModel() const 63 | { 64 | return _model; 65 | } 66 | 67 | void LWallpaperLive2DManager::OnDrag(csmFloat32 x, csmFloat32 y) const 68 | { 69 | LWallpaperModel* model = GetModel(); 70 | model->SetDragging(x, y); 71 | } 72 | 73 | void LWallpaperLive2DManager::OnTap(csmFloat32 x, csmFloat32 y) 74 | { 75 | if (_model->HitTest(HitAreaNameHead, x, y)) 76 | { 77 | _model->SetRandomExpression(); 78 | } 79 | else if (_model->HitTest(HitAreaNameBody, x, y)) 80 | { 81 | _model->StartRandomMotionWithOption(MotionGroupTapBody, PriorityNormal); 82 | } 83 | } 84 | 85 | void LWallpaperLive2DManager::OnUpdate() const 86 | { 87 | int width = LWallpaperDelegate::GetInstance()->GetWindowWidth(); 88 | int height = LWallpaperDelegate::GetInstance()->GetWindowHeight(); 89 | 90 | CubismMatrix44 projection; 91 | 92 | LWallpaperModel* model = GetModel(); 93 | 94 | if (model->GetModel()->GetCanvasWidth() > 1.0f && width < height) 95 | { 96 | // 横に長いモデルを縦長ウィンドウに表示する際モデルの横サイズでscaleを算出する 97 | model->GetModelMatrix()->SetWidth(2.0f); 98 | projection.Scale(1.0f, static_cast(width) / static_cast(height)); 99 | } 100 | else 101 | { 102 | projection.Scale(static_cast(height) / static_cast(width), 1.0f); 103 | } 104 | 105 | // 必要があればここで乗算 106 | if (_viewMatrix) 107 | { 108 | projection.MultiplyByMatrix(_viewMatrix); 109 | } 110 | 111 | // モデル1体描画前コール 112 | LWallpaperDelegate::GetInstance()->GetView()->PreModelDraw(*model); 113 | 114 | model->Update(); 115 | model->Draw(projection);///< 参照渡しなのでprojectionは変質する 116 | 117 | // モデル1体描画前コール 118 | LWallpaperDelegate::GetInstance()->GetView()->PostModelDraw(*model); 119 | } 120 | 121 | void LWallpaperLive2DManager::SetAssetDirectory(const std::string &path) 122 | { 123 | _currentModelDirectory = path; 124 | } 125 | 126 | void LWallpaperLive2DManager::LoadModel(const std::string modelDirectoryName) 127 | { 128 | // モデルのディレクトリを指定 129 | SetAssetDirectory(LWallpaperDefine::ResourcesPath + modelDirectoryName + "/"); 130 | 131 | // モデルデータの新規生成 132 | _model = new LWallpaperModel(modelDirectoryName, _currentModelDirectory); 133 | 134 | // モデルデータの読み込み及び生成とセットアップを行う 135 | static_cast(_model)->SetupModel(); 136 | } 137 | 138 | void LWallpaperLive2DManager::SetGravitationalAccelerationX(float gravity) 139 | { 140 | if(_model) 141 | { 142 | _model->SetGravitationalAccelerationX(gravity); 143 | } 144 | } 145 | 146 | 147 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperLive2DManager.hpp: -------------------------------------------------------------------------------- 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 11 | #include 12 | #include 13 | #include 14 | 15 | class LWallpaperModel; 16 | 17 | /** 18 | * @brief サンプルアプリケーションにおいてCubismModelを管理するクラス
19 | * モデル生成と破棄、タップイベントの処理、モデル切り替えを行う。 20 | * 21 | */ 22 | class LWallpaperLive2DManager 23 | { 24 | 25 | public: 26 | /** 27 | * @brief クラスのインスタンス(シングルトン)を返す。
28 | * インスタンスが生成されていない場合は内部でインスタンを生成する。 29 | * 30 | * @return クラスのインスタンス 31 | */ 32 | static LWallpaperLive2DManager* GetInstance(); 33 | 34 | /** 35 | * @brief クラスのインスタンス(シングルトン)を解放する。 36 | * 37 | */ 38 | static void ReleaseInstance(); 39 | 40 | /** 41 | * @brief 現在のシーンで保持しているモデルを返す 42 | * 43 | * @return モデルのインスタンスを返す。 44 | */ 45 | LWallpaperModel* GetModel() const; 46 | 47 | /** 48 | * @brief 現在のシーンで保持しているすべてのモデルを解放する 49 | * 50 | */ 51 | void ReleaseModel(); 52 | 53 | /** 54 | * @brief 画面をドラッグしたときの処理 55 | * 56 | * @param[in] x 画面のX座標 57 | * @param[in] y 画面のY座標 58 | */ 59 | void OnDrag(Csm::csmFloat32 x, Csm::csmFloat32 y) const; 60 | 61 | /** 62 | * @brief 画面をタップしたときの処理 63 | * 64 | * @param[in] x 画面のX座標 65 | * @param[in] y 画面のY座標 66 | */ 67 | void OnTap(Csm::csmFloat32 x, Csm::csmFloat32 y); 68 | 69 | /** 70 | * @brief 画面を更新するときの処理 71 | * モデルの更新処理および描画処理を行う 72 | */ 73 | void OnUpdate() const; 74 | 75 | /** 76 | * @brief 重力加速度の値の設定 77 | * @param[in] gravity 重力加速度(-9.81~9.81) 78 | */ 79 | void SetGravitationalAccelerationX(float gravity); 80 | 81 | private: 82 | /** 83 | * @brief コンストラクタ 84 | */ 85 | LWallpaperLive2DManager(); 86 | 87 | /** 88 | * @brief デストラクタ 89 | */ 90 | virtual ~LWallpaperLive2DManager(); 91 | 92 | /** 93 | * @brief ディレクトリパスの設定 94 | * 95 | * モデルのディレクトリパスを設定する 96 | */ 97 | void SetAssetDirectory(const std::string& path); 98 | 99 | /** 100 | * @brief モデルの読み込み 101 | * 102 | * モデルデータの読み込み処理を行う 103 | * 104 | * @param[in] modelDirectory モデルのディレクトリ名 105 | */ 106 | void LoadModel(const std::string modelDirectoryName); 107 | 108 | Csm::CubismMatrix44* _viewMatrix; ///< モデル描画に用いるView行列 109 | LWallpaperModel* _model; ///< モデルインスタンス 110 | 111 | /** 112 | *@brief モデルデータのディレクトリ名 113 | * このディレクトリ名と同名の.model3.jsonを読み込む 114 | */ 115 | const Csm::csmChar* _modelDirectoryName = "Hiyori"; 116 | std::string _currentModelDirectory; ///< 現在のモデルのディレクトリ 117 | }; 118 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperModel.hpp: -------------------------------------------------------------------------------- 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 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | 17 | /** 18 | * @brief ユーザーが実際に使用するモデルの実装クラス
19 | * モデル生成、機能コンポーネント生成、更新処理とレンダリングの呼び出しを行う。 20 | * 21 | */ 22 | class LWallpaperModel : public Csm::CubismUserModel 23 | { 24 | public: 25 | /** 26 | * @brief コンストラクタ 27 | */ 28 | LWallpaperModel(); 29 | 30 | /** 31 | * @brief コンストラクタ 32 | */ 33 | LWallpaperModel(const std::string modelDirectoryName, const std::string currentModelDirectory); 34 | 35 | /** 36 | * @brief デストラクタ 37 | * 38 | */ 39 | virtual ~LWallpaperModel(); 40 | 41 | /** 42 | * @brief パスを作成 43 | * 44 | * アセットのパスを作成する 45 | */ 46 | std::string MakeAssetPath(const std::string & assetFileName); 47 | 48 | /** 49 | * @brief model3.jsonが置かれたディレクトリとファイルパスからモデルを生成する 50 | * 51 | */ 52 | void LoadAssets(const std::string & fiileName, const std::function& afterLoadCallback); 53 | 54 | /** 55 | * @brief レンダラを再構築する 56 | * 57 | */ 58 | void ReloadRenderer(); 59 | 60 | /** 61 | * @brief モデルの更新処理。モデルのパラメータから描画状態を決定する。 62 | * 63 | */ 64 | void Update(); 65 | 66 | /** 67 | * @brief ランダムなモーションを再生する(JNI呼び出し用) 68 | * 69 | */ 70 | void StartRandomMotion(); 71 | 72 | /** 73 | * @brief ランダムに選ばれたモーションの再生を開始する。 74 | * 75 | * @param[in] group モーショングループ名 76 | * @param[in] priority 優先度 77 | * @param[in] onFinishedMotionHandler モーション再生終了時に呼び出されるコールバック関数。NULLの場合、呼び出されない。 78 | */ 79 | void StartRandomMotionWithOption(const Csm::csmChar* group, Csm::csmInt32 priority, Csm::ACubismMotion::FinishedMotionCallback onFinishedMotionHandler = NULL); 80 | 81 | /** 82 | * @brief 指定したモーションを再生する(JNIび出し用) 83 | * 84 | */ 85 | void StartOrderMotion(const Csm::csmChar* group,Csm::csmInt32 index,Csm::csmInt32 priority); 86 | 87 | /** 88 | * @brief モデルを描画する処理。モデルを描画する空間のView-Projection行列を渡す。 89 | * 90 | * @param[in] matrix View-Projection行列 91 | */ 92 | void Draw(Csm::CubismMatrix44& matrix); 93 | 94 | /** 95 | * @brief 引数で指定した表情モーションをセットする 96 | * 97 | * @param expressionID 表情モーションのID 98 | */ 99 | void SetExpression(const Csm::csmChar* expressionID); 100 | 101 | /** 102 | * @brief ランダムに選ばれた表情モーションをセットする 103 | * 104 | */ 105 | void SetRandomExpression(); 106 | 107 | /** 108 | * @brief イベントの発火を受け取る 109 | * 110 | */ 111 | virtual void MotionEventFired(const Live2D::Cubism::Framework::csmString& eventValue); 112 | 113 | /** 114 | * @brief model3.jsonからモデルを生成する。
115 | * model3.jsonの記述に従ってモデル生成、モーション、物理演算などのコンポーネント生成を行う。 116 | */ 117 | void SetupModel(); 118 | 119 | /** 120 | * @brief 別ターゲットに描画する際に使用するバッファの取得 121 | */ 122 | Csm::Rendering::CubismOffscreenFrame_OpenGLES2& GetRenderBuffer(); 123 | 124 | /** 125 | * @brief X方向にかかる重力加速度をセット 126 | * 127 | * @param[in] gravity X方向の重力加速度 128 | */ 129 | void SetGravitationalAccelerationX(Csm::csmFloat32 gravity); 130 | 131 | /** 132 | * @brief 当たり判定テスト。
133 | * 指定IDの頂点リストから矩形を計算し、座標が矩形範囲内か判定する。 134 | * 135 | * @param[in] hitAreaName 当たり判定をテストする対象のID 136 | * @param[in] x 判定を行うX座標 137 | * @param[in] y 判定を行うY座標 138 | */ 139 | virtual Csm::csmBool HitTest(const Csm::csmChar* hitAreaName, Csm::csmFloat32 x, Csm::csmFloat32 y); 140 | 141 | private: 142 | /** 143 | * @brief OpenGLのテクスチャユニットにテクスチャをロードする 144 | * 145 | */ 146 | void SetupTextures(); 147 | 148 | /** 149 | * @brief モーションデータをグループ名から一括でロードする。
150 | * モーションデータの名前は内部でModelSettingから取得する。 151 | * 152 | * @param[in] group モーションデータのグループ名 153 | */ 154 | void PreloadMotionGroup(const Csm::csmChar* group); 155 | 156 | /** 157 | * @brief モーションデータをグループ名から一括で解放する。
158 | * モーションデータの名前は内部でModelSettingから取得する。 159 | * 160 | * @param[in] group モーションデータのグループ名 161 | */ 162 | void ReleaseMotionGroup(const Csm::csmChar* group) const; 163 | 164 | /** 165 | * @brief すべてのモーションデータの解放 166 | * 167 | * すべてのモーションデータを解放する。 168 | */ 169 | void ReleaseMotions(); 170 | 171 | /** 172 | * @brief すべての表情データの解放 173 | * 174 | * すべての表情データを解放する。 175 | */ 176 | void ReleaseExpressions(); 177 | 178 | /** 179 | * @brief ランダムに選ばれたモーションの再生を開始する。 180 | * 181 | * @param[in] group モーショングループ名 182 | * @param[in] priority 優先度 183 | * @param[in] onFinishedMotionHandler モーション再生終了時に呼び出されるコールバック関数。NULLの場合、呼び出されない。 184 | * @return 開始したモーションの識別番号を返す。個別のモーションが終了したか否かを判定するIsFinished()の引数で使用する。開始できない時は「-1」 185 | */ 186 | Csm::CubismMotionQueueEntryHandle StartRandomMotion(const Csm::csmChar* group, Csm::csmInt32 priority, Csm::ACubismMotion::FinishedMotionCallback onFinishedMotionHandler = NULL); 187 | 188 | /** 189 | * @brief 引数で指定したモーションの再生を開始する。 190 | * 191 | * @param[in] group モーショングループ名 192 | * @param[in] no グループ内の番号 193 | * @param[in] priority 優先度 194 | * @param[in] onFinishedMotionHandler モーション再生終了時に呼び出されるコールバック関数。NULLの場合、呼び出されない。 195 | * @return 開始したモーションの識別番号を返す。個別のモーションが終了したか否かを判定するIsFinished()の引数で使用する。開始できない時は「-1」 196 | */ 197 | Csm::CubismMotionQueueEntryHandle StartMotion(const Csm::csmChar* group, Csm::csmInt32 no, Csm::csmInt32 priority, Csm::ACubismMotion::FinishedMotionCallback onFinishedMotionHandler = NULL); 198 | 199 | Csm::CubismModelSettingJson* _modelJson; ///< モデルセッティング情報 200 | std::string _modelDirName; ///< モデルセッティングが置かれたディレクトリの名称 201 | std::string _currentModelDirectory; ///< モデルセッティングが置かれたディレクトリ 202 | Csm::csmFloat32 _userTimeSeconds; ///< デルタ時間の積算値[秒] 203 | Csm::csmVector _eyeBlinkIds; ///< モデルに設定されたまばたき機能用パラメータID 204 | Csm::csmMap _motions; ///< 読み込まれているモーションのリスト 205 | Csm::csmMap _expressions; ///< 読み込まれている表情のリスト 206 | const Csm::CubismId* _idParamAngleX; ///< パラメータID: ParamAngleX 207 | const Csm::CubismId* _idParamAngleY; ///< パラメータID: ParamAngleX 208 | const Csm::CubismId* _idParamAngleZ; ///< パラメータID: ParamAngleX 209 | const Csm::CubismId* _idParamBodyAngleX; ///< パラメータID: ParamBodyAngleX 210 | const Csm::CubismId* _idParamEyeBallX; ///< パラメータID: ParamEyeBallX 211 | const Csm::CubismId* _idParamEyeBallY; ///< パラメータID: ParamEyeBallXY 212 | 213 | Csm::Rendering::CubismOffscreenFrame_OpenGLES2 _renderBuffer; ///< フレームバッファ以外の描画先 214 | 215 | Csm::csmFloat32* _initParameterValues; ///< パラメータの初期値のリスト 216 | 217 | Csm::csmFloat32 _gravitationalAccelerationX; ///< X方向にかかっている重力加速度 218 | }; 219 | 220 | 221 | 222 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperPal.cpp: -------------------------------------------------------------------------------- 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 "LWallpaperPal.hpp" 9 | #include 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include "LWallpaperDefine.hpp" 20 | #include "JniBridgeC.hpp" 21 | 22 | using std::endl; 23 | using namespace Csm; 24 | using namespace std; 25 | using namespace LWallpaperDefine; 26 | 27 | double LWallpaperPal::s_currentFrame = 0.0; 28 | double LWallpaperPal::s_lastFrame = 0.0; 29 | double LWallpaperPal::s_deltaTime = 0.0; 30 | 31 | csmByte* LWallpaperPal::LoadFileAsBytes(const string filePath, csmSizeInt* outSize) 32 | { 33 | //filePath;// 34 | const char* path = filePath.c_str(); 35 | 36 | // file buffer 37 | char* buf = JniBridgeC::LoadFileAsBytesFromJava(path, outSize); 38 | 39 | return reinterpret_cast(buf); 40 | } 41 | 42 | void LWallpaperPal::ReleaseBytes(csmByte* byteData) 43 | { 44 | delete[] byteData; 45 | } 46 | 47 | csmFloat32 LWallpaperPal::GetDeltaTime() 48 | { 49 | return static_cast(s_deltaTime); 50 | } 51 | 52 | void LWallpaperPal::UpdateTime() 53 | { 54 | s_currentFrame = GetSystemTime(); 55 | s_deltaTime = s_currentFrame - s_lastFrame; 56 | s_lastFrame = s_currentFrame; 57 | } 58 | 59 | void LWallpaperPal::PrintLog(const csmChar* format, ...) 60 | { 61 | va_list args; 62 | csmChar buf[256]; 63 | va_start(args, format); 64 | __android_log_vprint(ANDROID_LOG_DEBUG, "NativePrint", format, args); // 標準出力でレンダリング 65 | std::cerr << buf << std::endl; 66 | va_end(args); 67 | } 68 | 69 | void LWallpaperPal::PrintMessage(const csmChar* message) 70 | { 71 | PrintLog("%s", message); 72 | } 73 | 74 | double LWallpaperPal::GetSystemTime() 75 | { 76 | struct timespec res; 77 | clock_gettime(CLOCK_MONOTONIC, &res); 78 | return (res.tv_sec + res.tv_nsec * 1e-9); 79 | } 80 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperPal.hpp: -------------------------------------------------------------------------------- 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 11 | #include 12 | 13 | /** 14 | * @brief プラットフォーム依存機能を抽象化する Cubism Platform Abstraction Layer. 15 | * 16 | * ファイル読み込みや時刻取得等のプラットフォームに依存する関数をまとめる 17 | * 18 | */ 19 | class LWallpaperPal 20 | { 21 | public: 22 | /** 23 | * @brief ファイルをバイトデータとして読み込む 24 | * 25 | * ファイルをバイトデータとして読み込む 26 | * 27 | * @param[in] filePath 読み込み対象ファイルのパス 28 | * @param[out] outSize ファイルサイズ 29 | * @return バイトデータ 30 | */ 31 | static Csm::csmByte* LoadFileAsBytes(const std::string filePath, Csm::csmSizeInt* outSize); 32 | 33 | 34 | /** 35 | * @brief バイトデータを解放する 36 | * 37 | * バイトデータを解放する 38 | * 39 | * @param[in] byteData 解放したいバイトデータ 40 | */ 41 | static void ReleaseBytes(Csm::csmByte* byteData); 42 | 43 | /** 44 | * @biref デルタ時間(前回フレームとの差分)を取得する 45 | * 46 | * @return デルタ時間[ms] 47 | * 48 | */ 49 | static Csm::csmFloat32 GetDeltaTime(); 50 | 51 | /** 52 | * @biref デルタ時間の更新 53 | * 54 | */ 55 | static void UpdateTime(); 56 | 57 | /** 58 | * @brief ログを出力する 59 | * 60 | * ログを出力する 61 | * 62 | * @param[in] format 書式付文字列 63 | * @param[in] ... (可変長引数)文字列 64 | * 65 | */ 66 | static void PrintLog(const Csm::csmChar* format, ...); 67 | 68 | /** 69 | * @brief メッセージを出力する 70 | * 71 | * メッセージを出力する 72 | * 73 | * @param[in] message 文字列 74 | * 75 | */ 76 | static void PrintMessage(const Csm::csmChar* message); 77 | 78 | private: 79 | /** 80 | * @brief システムタイムの取得 81 | */ 82 | static double GetSystemTime(); 83 | 84 | static double s_currentFrame; 85 | static double s_lastFrame; 86 | static double s_deltaTime; 87 | }; 88 | 89 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperSprite.cpp: -------------------------------------------------------------------------------- 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 "LWallpaperSprite.hpp" 9 | #include "LWallpaperDelegate.hpp" 10 | 11 | LWallpaperSprite::LWallpaperSprite(float x, float y, float width, float height, GLuint textureId, GLuint programId) 12 | : _rect() 13 | { 14 | _rect.left = (x - width * 0.5f); 15 | _rect.right = (x + width * 0.5f); 16 | _rect.up = (y + height * 0.5f); 17 | _rect.down = (y - height * 0.5f); 18 | _textureId = textureId; 19 | 20 | // 何番目のattribute変数か 21 | _positionLocation = glGetAttribLocation(programId, "position"); 22 | _uvLocation = glGetAttribLocation(programId, "uv"); 23 | _textureLocation = glGetUniformLocation(programId, "texture"); 24 | _colorLocation = glGetUniformLocation(programId, "baseColor"); 25 | 26 | _spriteColor[0] = 1.0f; 27 | _spriteColor[1] = 1.0f; 28 | _spriteColor[2] = 1.0f; 29 | _spriteColor[3] = 1.0f; 30 | } 31 | 32 | LWallpaperSprite::~LWallpaperSprite() 33 | { 34 | } 35 | 36 | void LWallpaperSprite::ReSize(float x, float y, float width, float height) 37 | { 38 | _rect.left = (x - width * 0.5f); 39 | _rect.right = (x + width * 0.5f); 40 | _rect.up = (y + height * 0.5f); 41 | _rect.down = (y - height * 0.5f); 42 | } 43 | 44 | void LWallpaperSprite::Render() const 45 | { 46 | glEnable(GL_TEXTURE_2D); 47 | const GLfloat uvVertex[] = 48 | { 49 | 1.0f, 0.0f, 50 | 0.0f, 0.0f, 51 | 0.0f, 1.0f, 52 | 1.0f, 1.0f, 53 | }; 54 | 55 | 56 | // attribute属性を有効にする 57 | glEnableVertexAttribArray(_positionLocation); 58 | glEnableVertexAttribArray(_uvLocation); 59 | 60 | // uniform属性の登録 61 | glUniform1i(_textureLocation, 0); 62 | 63 | // 画面サイズを取得する 64 | int maxWidth = LWallpaperDelegate::GetInstance()->GetWindowWidth(); 65 | int maxHeight = LWallpaperDelegate::GetInstance()->GetWindowHeight(); 66 | 67 | // 頂点データ 68 | float positionVertex[] = 69 | { 70 | (_rect.right - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.up - maxHeight * 0.5f) / (maxHeight * 0.5f), 71 | (_rect.left - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.up - maxHeight * 0.5f) / (maxHeight * 0.5f), 72 | (_rect.left - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.down - maxHeight * 0.5f) / (maxHeight * 0.5f), 73 | (_rect.right - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.down - maxHeight * 0.5f) / (maxHeight * 0.5f) 74 | }; 75 | 76 | // attribute属性を登録 77 | glVertexAttribPointer(_positionLocation, 2, GL_FLOAT, false, 0, positionVertex); 78 | glVertexAttribPointer(_uvLocation, 2, GL_FLOAT, false, 0, uvVertex); 79 | 80 | glUniform4f(_colorLocation, _spriteColor[0], _spriteColor[1], _spriteColor[2], _spriteColor[3]); 81 | 82 | // モデルの描画 83 | glBindTexture(GL_TEXTURE_2D, _textureId); 84 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 85 | } 86 | 87 | void LWallpaperSprite::RenderImmidiate(GLuint textureId, const GLfloat uvVertex[8]) const 88 | { 89 | glEnable(GL_TEXTURE_2D); 90 | 91 | // attribute属性を有効にする 92 | glEnableVertexAttribArray(_positionLocation); 93 | glEnableVertexAttribArray(_uvLocation); 94 | 95 | // uniform属性の登録 96 | glUniform1i(_textureLocation, 0); 97 | 98 | // 画面サイズを取得する 99 | int maxWidth = LWallpaperDelegate::GetInstance()->GetWindowWidth(); 100 | int maxHeight = LWallpaperDelegate::GetInstance()->GetWindowHeight(); 101 | 102 | // 頂点データ 103 | float positionVertex[] = 104 | { 105 | (_rect.right - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.up - maxHeight * 0.5f) / (maxHeight * 0.5f), 106 | (_rect.left - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.up - maxHeight * 0.5f) / (maxHeight * 0.5f), 107 | (_rect.left - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.down - maxHeight * 0.5f) / (maxHeight * 0.5f), 108 | (_rect.right - maxWidth * 0.5f) / (maxWidth * 0.5f), (_rect.down - maxHeight * 0.5f) / (maxHeight * 0.5f) 109 | }; 110 | 111 | // attribute属性を登録 112 | glVertexAttribPointer(_positionLocation, 2, GL_FLOAT, false, 0, positionVertex); 113 | glVertexAttribPointer(_uvLocation, 2, GL_FLOAT, false, 0, uvVertex); 114 | 115 | glUniform4f(_colorLocation, _spriteColor[0], _spriteColor[1], _spriteColor[2], _spriteColor[3]); 116 | 117 | // モデルの描画 118 | glBindTexture(GL_TEXTURE_2D, textureId); 119 | glDrawArrays(GL_TRIANGLE_FAN, 0, 4); 120 | } 121 | 122 | bool LWallpaperSprite::IsHit(float pointX, float pointY) const 123 | { 124 | // 画面高さを取得する 125 | int maxHeight = LWallpaperDelegate::GetInstance()->GetWindowHeight(); 126 | 127 | //Y座標は変換する必要あり 128 | float y = maxHeight - pointY; 129 | 130 | return (pointX >= _rect.left && pointX <= _rect.right && y <= _rect.up && y >= _rect.down); 131 | } 132 | 133 | void LWallpaperSprite::SetColor(float r, float g, float b, float a) 134 | { 135 | _spriteColor[0] = r; 136 | _spriteColor[1] = g; 137 | _spriteColor[2] = b; 138 | _spriteColor[3] = a; 139 | } 140 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperSprite.hpp: -------------------------------------------------------------------------------- 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 11 | #include 12 | 13 | /** 14 | * @brief スプライトを実装するクラス。 15 | * 16 | * テクスチャID、Rectの管理。 17 | * 18 | */ 19 | class LWallpaperSprite 20 | { 21 | public: 22 | /** 23 | * @brief Rect 構造体。 24 | */ 25 | struct Rect 26 | { 27 | public: 28 | float left; ///< 左辺 29 | float right; ///< 右辺 30 | float up; ///< 上辺 31 | float down; ///< 下辺 32 | }; 33 | 34 | /** 35 | * @brief コンストラクタ 36 | * 37 | * @param[in] x x座標 38 | * @param[in] y y座標 39 | * @param[in] width 横幅 40 | * @param[in] height 高さ 41 | * @param[in] textureId テクスチャID 42 | * @param[in] programId シェーダID 43 | */ 44 | LWallpaperSprite(float x, float y, float width, float height, GLuint textureId, GLuint programId); 45 | 46 | /** 47 | * @brief デストラクタ 48 | */ 49 | ~LWallpaperSprite(); 50 | 51 | /** 52 | * @brief スプライトサイズ変更 53 | * 54 | * @param[in] x x座標 55 | * @param[in] y y座標 56 | * @param[in] width 横幅 57 | * @param[in] height 高さ 58 | */ 59 | void ReSize(float x, float y, float width, float height); 60 | 61 | /** 62 | * @brief Getter テクスチャID 63 | * @return テクスチャIDを返す 64 | */ 65 | GLuint GetTextureId() { return _textureId; } 66 | 67 | /** 68 | * @brief 描画する 69 | * 70 | */ 71 | void Render() const; 72 | 73 | /** 74 | * @brief テクスチャIDを指定して描画する 75 | * 76 | */ 77 | void RenderImmidiate(GLuint textureId, const GLfloat uvVertex[8]) const; 78 | 79 | /** 80 | * @brief コンストラクタ 81 | * 82 | * @param[in] pointX x座標 83 | * @param[in] pointY y座標 84 | */ 85 | bool IsHit(float pointX, float pointY) const; 86 | 87 | /** 88 | * @brief 色設定 89 | * 90 | * @param[in] r (0.0~1.0) 91 | * @param[in] g (0.0~1.0) 92 | * @param[in] b (0.0~1.0) 93 | * @param[in] a (0.0~1.0) 94 | */ 95 | void SetColor(float r, float g, float b, float a); 96 | 97 | private: 98 | GLuint _textureId; ///< テクスチャID 99 | Rect _rect; ///< 矩形 100 | int _positionLocation; ///< 位置アトリビュート 101 | int _uvLocation; ///< UVアトリビュート 102 | int _textureLocation; ///< テクスチャアトリビュート 103 | int _colorLocation; ///< カラーアトリビュート 104 | 105 | float _spriteColor[4]; ///< 表示カラー 106 | }; 107 | 108 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperTextureManager.cpp: -------------------------------------------------------------------------------- 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 "LWallpaperTextureManager.hpp" 9 | #include 10 | #define STBI_NO_STDIO 11 | #define STBI_ONLY_PNG 12 | #define STB_IMAGE_IMPLEMENTATION 13 | #include "stb_image.h" 14 | #include "LWallpaperPal.hpp" 15 | 16 | LWallpaperTextureManager::LWallpaperTextureManager() 17 | { 18 | } 19 | 20 | LWallpaperTextureManager::~LWallpaperTextureManager() 21 | { 22 | ReleaseTextures(); 23 | } 24 | 25 | LWallpaperTextureManager::TextureInfo* LWallpaperTextureManager::CreateTextureFromPngFile(std::string fileName) 26 | { 27 | //search loaded texture already. 28 | for (Csm::csmUint32 i = 0; i < _textures.GetSize(); i++) 29 | { 30 | if (_textures[i]->fileName == fileName) 31 | { 32 | return _textures[i]; 33 | } 34 | } 35 | 36 | GLuint textureId; 37 | int width, height, channels; 38 | unsigned int size; 39 | unsigned char* png; 40 | unsigned char* address; 41 | 42 | address = LWallpaperPal::LoadFileAsBytes(fileName, &size); 43 | 44 | // png情報を取得する 45 | png = stbi_load_from_memory( 46 | address, 47 | static_cast(size), 48 | &width, 49 | &height, 50 | &channels, 51 | STBI_rgb_alpha); 52 | { 53 | #ifdef PREMULTIPLIED_ALPHA_ENABLE 54 | unsigned int* fourBytes = reinterpret_cast(png); 55 | for (int i = 0; i < width * height; i++) 56 | { 57 | unsigned char* p = png + i * 4; 58 | fourBytes[i] = Premultiply(p[0], p[1], p[2], p[3]); 59 | } 60 | #endif 61 | } 62 | 63 | // OpenGL用のテクスチャを生成する 64 | glGenTextures(1, &textureId); 65 | glBindTexture(GL_TEXTURE_2D, textureId); 66 | glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, png); 67 | glGenerateMipmap(GL_TEXTURE_2D); 68 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); 69 | glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); 70 | glBindTexture(GL_TEXTURE_2D, 0); 71 | 72 | // 解放処理 73 | stbi_image_free(png); 74 | LWallpaperPal::ReleaseBytes(address); 75 | 76 | LWallpaperTextureManager::TextureInfo* textureInfo = new LWallpaperTextureManager::TextureInfo(); 77 | if (textureInfo != NULL) 78 | { 79 | textureInfo->fileName = fileName; 80 | textureInfo->width = width; 81 | textureInfo->height = height; 82 | textureInfo->id = textureId; 83 | 84 | _textures.PushBack(textureInfo); 85 | } 86 | 87 | return textureInfo; 88 | 89 | } 90 | 91 | void LWallpaperTextureManager::ReleaseTextures() 92 | { 93 | for (Csm::csmUint32 i = 0; i < _textures.GetSize(); i++) 94 | { 95 | delete _textures[i]; 96 | } 97 | 98 | _textures.Clear(); 99 | } 100 | 101 | void LWallpaperTextureManager::ReleaseTexture(Csm::csmUint32 textureId) 102 | { 103 | for (Csm::csmUint32 i = 0; i < _textures.GetSize(); i++) 104 | { 105 | if (_textures[i]->id != textureId) 106 | { 107 | continue; 108 | } 109 | delete _textures[i]; 110 | _textures.Remove(i); 111 | break; 112 | } 113 | } 114 | 115 | void LWallpaperTextureManager::ReleaseTexture(std::string fileName) 116 | { 117 | for (Csm::csmUint32 i = 0; i < _textures.GetSize(); i++) 118 | { 119 | if (_textures[i]->fileName == fileName) 120 | { 121 | delete _textures[i]; 122 | _textures.Remove(i); 123 | break; 124 | } 125 | } 126 | } 127 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperTextureManager.hpp: -------------------------------------------------------------------------------- 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 11 | #include 12 | #include 13 | #include 14 | 15 | /** 16 | * @brief テクスチャ管理クラス 17 | * 18 | * 画像読み込み、管理を行うクラス。 19 | */ 20 | class LWallpaperTextureManager 21 | { 22 | public: 23 | 24 | /** 25 | * @brief 画像情報構造体 26 | */ 27 | struct TextureInfo 28 | { 29 | GLuint id; ///< テクスチャID 30 | int width; ///< 横幅 31 | int height; ///< 高さ 32 | std::string fileName; ///< ファイル名 33 | }; 34 | 35 | /** 36 | * @brief コンストラクタ 37 | */ 38 | LWallpaperTextureManager(); 39 | 40 | /** 41 | * @brief デストラクタ 42 | * 43 | */ 44 | ~LWallpaperTextureManager(); 45 | 46 | 47 | /** 48 | * @brief プリマルチプライ処理 49 | * 50 | * @param[in] red 画像のRed値 51 | * @param[in] green 画像のGreen値 52 | * @param[in] blue 画像のBlue値 53 | * @param[in] alpha 画像のAlpha値 54 | * 55 | * @return プリマルチプライ処理後のカラー値 56 | */ 57 | inline unsigned int Premultiply(unsigned char red, unsigned char green, unsigned char blue, unsigned char alpha) 58 | { 59 | return static_cast(\ 60 | (red * (alpha + 1) >> 8) | \ 61 | ((green * (alpha + 1) >> 8) << 8) | \ 62 | ((blue * (alpha + 1) >> 8) << 16) | \ 63 | (((alpha)) << 24) \ 64 | ); 65 | } 66 | 67 | /** 68 | * @brief 画像読み込み 69 | * 70 | * @param[in] fileName 読み込む画像ファイルパス名 71 | * @return 画像情報。読み込み失敗時はNULLを返す 72 | */ 73 | TextureInfo* CreateTextureFromPngFile(std::string fileName); 74 | 75 | /** 76 | * @brief 画像の解放 77 | * 78 | * 配列に存在する画像全てを解放する 79 | */ 80 | void ReleaseTextures(); 81 | 82 | /** 83 | * @brief 画像の解放 84 | * 85 | * 指定したテクスチャIDの画像を解放する 86 | * @param[in] textureId 解放するテクスチャID 87 | **/ 88 | void ReleaseTexture(Csm::csmUint32 textureId); 89 | 90 | /** 91 | * @brief 画像の解放 92 | * 93 | * 指定した名前の画像を解放する 94 | * @param[in] fileName 解放する画像ファイルパス名 95 | **/ 96 | void ReleaseTexture(std::string fileName); 97 | 98 | private: 99 | Csm::csmVector _textures; 100 | }; 101 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperView.cpp: -------------------------------------------------------------------------------- 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 "LWallpaperView.hpp" 9 | #include 10 | #include 11 | #include "LWallpaperPal.hpp" 12 | #include "LWallpaperDelegate.hpp" 13 | #include "LWallpaperDefine.hpp" 14 | #include "LWallpaperTextureManager.hpp" 15 | #include "LWallpaperLive2DManager.hpp" 16 | #include "TouchManager.hpp" 17 | #include "LWallpaperSprite.hpp" 18 | #include "LWallpaperModel.hpp" 19 | 20 | #include 21 | #include 22 | 23 | #include "JniBridgeC.hpp" 24 | 25 | using namespace std; 26 | using namespace LWallpaperDefine; 27 | using namespace Csm; 28 | 29 | LWallpaperView::LWallpaperView(): 30 | _programId(0), 31 | _renderSprite(nullptr), 32 | _renderTarget(SelectTarget_None), 33 | _backgroundImage(nullptr) 34 | { 35 | _clearColor[0] = 1.0f; 36 | _clearColor[1] = 1.0f; 37 | _clearColor[2] = 1.0f; 38 | _clearColor[3] = 0.0f; 39 | 40 | // タッチ関係のイベント管理 41 | _touchManager = new TouchManager(); 42 | 43 | // デバイス座標からスクリーン座標に変換するための 44 | _deviceToScreen = new CubismMatrix44(); 45 | 46 | // 画面の表示の拡大縮小や移動の変換を行う行列 47 | _viewMatrix = new CubismViewMatrix(); 48 | } 49 | 50 | LWallpaperView::~LWallpaperView() 51 | { 52 | _renderBuffer.DestroyOffscreenFrame(); 53 | delete _renderSprite; 54 | 55 | glDeleteShader(_programId); 56 | 57 | delete _viewMatrix; 58 | delete _deviceToScreen; 59 | delete _touchManager; 60 | delete _backgroundImage; 61 | } 62 | 63 | void LWallpaperView::Initialize() 64 | { 65 | int width = LWallpaperDelegate::GetInstance()->GetWindowWidth(); 66 | int height = LWallpaperDelegate::GetInstance()->GetWindowHeight(); 67 | 68 | // 縦サイズを基準とする 69 | float ratio = static_cast(width) / static_cast(height); 70 | float left = -ratio; 71 | float right = ratio; 72 | float bottom = ViewLogicalLeft; 73 | float top = ViewLogicalRight; 74 | 75 | _viewMatrix->SetScreenRect(left, right, bottom, top); // デバイスに対応する画面の範囲。 Xの左端, Xの右端, Yの下端, Yの上端 76 | _viewMatrix->Scale(ViewScale, ViewScale); 77 | 78 | _deviceToScreen->LoadIdentity(); 79 | if (width > height) 80 | { 81 | float screenW = fabsf(right - left); 82 | _deviceToScreen->ScaleRelative(screenW / width, -screenW / width); 83 | } 84 | else 85 | { 86 | float screenH = fabsf(top - bottom); 87 | _deviceToScreen->ScaleRelative(screenH / height, -screenH / height); 88 | } 89 | _deviceToScreen->TranslateRelative(-width * 0.5f, -height * 0.5f); 90 | 91 | // 表示範囲の設定 92 | _viewMatrix->SetMaxScale(ViewMaxScale); // 限界拡大率 93 | _viewMatrix->SetMinScale(ViewMinScale); // 限界縮小率 94 | 95 | // 表示できる最大範囲 96 | _viewMatrix->SetMaxScreenRect( 97 | ViewLogicalMaxLeft, 98 | ViewLogicalMaxRight, 99 | ViewLogicalMaxBottom, 100 | ViewLogicalMaxTop 101 | ); 102 | } 103 | 104 | void LWallpaperView::InitializeShader() 105 | { 106 | _programId = LWallpaperDelegate::GetInstance()->CreateShader(); 107 | } 108 | 109 | void LWallpaperView::InitializeSprite() 110 | { 111 | int width = LWallpaperDelegate::GetInstance()->GetWindowWidth(); 112 | int height = LWallpaperDelegate::GetInstance()->GetWindowHeight(); 113 | 114 | LWallpaperTextureManager* textureManager = LWallpaperDelegate::GetInstance()->GetTextureManager(); 115 | const string resourcesPath = ResourcesPath; 116 | 117 | string imageName = BackImageName; 118 | // 第四問 2.2 119 | LWallpaperTextureManager::TextureInfo* backgroundTexture = textureManager->CreateTextureFromPngFile(resourcesPath + imageName); 120 | 121 | float x = width * 0.5f; 122 | float y = height * 0.5f; 123 | float fWidth = width; 124 | float fHeight = height; 125 | 126 | // 第四問 2.3 127 | if(_backgroundImage == NULL) 128 | { 129 | _backgroundImage = new LWallpaperSprite(x, y, fWidth, fHeight, backgroundTexture->id, _programId); 130 | } 131 | else 132 | { 133 | _backgroundImage->ReSize(x, y, fWidth, fHeight); 134 | } 135 | 136 | _backgroundImage->SetColor(1.0f, 1.0f, 1.0f, 0.0f); 137 | 138 | // 画面全体を覆うサイズ 139 | x = width * 0.5f; 140 | y = height * 0.5f; 141 | 142 | if (!_renderSprite) 143 | { 144 | _renderSprite = new LWallpaperSprite(x, y, width, height, 0, _programId); 145 | } 146 | else 147 | { 148 | _renderSprite->ReSize(x, y, width, height); 149 | } 150 | } 151 | 152 | void LWallpaperView::Render() 153 | { 154 | LWallpaperLive2DManager* Live2DManager = LWallpaperLive2DManager::GetInstance(); 155 | 156 | // 第二問 2.4 157 | _backgroundImage->Render(); 158 | 159 | // Cubism更新・描画 160 | Live2DManager->OnUpdate(); 161 | 162 | // 各モデルが持つ描画ターゲットをテクスチャとする場合 163 | if (_renderTarget == SelectTarget_ModelFrameBuffer && _renderSprite) 164 | { 165 | const GLfloat uvVertex[] = 166 | { 167 | 1.0f, 1.0f, 168 | 0.0f, 1.0f, 169 | 0.0f, 0.0f, 170 | 1.0f, 0.0f, 171 | }; 172 | 173 | float alpha = GetSpriteAlpha(2); // サンプルとしてαに適当な差をつける 174 | _renderSprite->SetColor(1.0f, 1.0f, 1.0f, alpha); 175 | 176 | LWallpaperModel *model = Live2DManager->GetModel(); 177 | if (model) 178 | { 179 | _renderSprite->RenderImmidiate(model->GetRenderBuffer().GetColorBuffer(), uvVertex); 180 | } 181 | } 182 | } 183 | 184 | void LWallpaperView::OnTouchesBegan(float pointX, float pointY) const 185 | { 186 | // 第三問 1.1 187 | _touchManager->TouchesBegan(pointX, pointY); 188 | } 189 | 190 | void LWallpaperView::OnTouchesMoved(float pointX, float pointY) const 191 | { 192 | // 第三問 1.2 193 | float viewX = this->TransformViewX(_touchManager->GetX()); 194 | float viewY = this->TransformViewY(_touchManager->GetY()); 195 | 196 | _touchManager->TouchesMoved(pointX, pointY); 197 | 198 | LWallpaperLive2DManager::GetInstance()->OnDrag(viewX, viewY); 199 | } 200 | 201 | Csm::CubismVector2 LWallpaperView::OnTouchesEnded(float pointX, float pointY) 202 | { 203 | // タッチ終了 204 | LWallpaperLive2DManager* live2DManager = LWallpaperLive2DManager::GetInstance(); 205 | live2DManager->OnDrag(0.0f, 0.0f); 206 | 207 | // シングルタップ 208 | // 第三問 1.3 209 | float x = _deviceToScreen->TransformX(_touchManager->GetX()); // 論理座標変換した座標を取得。 210 | float y = _deviceToScreen->TransformY(_touchManager->GetY()); // 論理座標変換した座標を取得。 211 | 212 | live2DManager->OnTap(x, y); 213 | 214 | return {x,y}; 215 | } 216 | 217 | float LWallpaperView::TransformViewX(float deviceX) const 218 | { 219 | float screenX = _deviceToScreen->TransformX(deviceX); // 論理座標変換した座標を取得。 220 | return _viewMatrix->InvertTransformX(screenX); // 拡大、縮小、移動後の値。 221 | } 222 | 223 | float LWallpaperView::TransformViewY(float deviceY) const 224 | { 225 | float screenY = _deviceToScreen->TransformY(deviceY); // 論理座標変換した座標を取得。 226 | return _viewMatrix->InvertTransformY(screenY); // 拡大、縮小、移動後の値。 227 | } 228 | 229 | float LWallpaperView::TransformScreenX(float deviceX) const 230 | { 231 | return _deviceToScreen->TransformX(deviceX); 232 | } 233 | 234 | float LWallpaperView::TransformScreenY(float deviceY) const 235 | { 236 | return _deviceToScreen->TransformY(deviceY); 237 | } 238 | 239 | void LWallpaperView::PreModelDraw(LWallpaperModel &refModel) 240 | { 241 | // 別のレンダリングターゲットへ向けて描画する場合の使用するフレームバッファ 242 | Csm::Rendering::CubismOffscreenFrame_OpenGLES2* useTarget = nullptr; 243 | 244 | if (_renderTarget != SelectTarget_None) 245 | {// 別のレンダリングターゲットへ向けて描画する場合 246 | 247 | // 使用するターゲット 248 | useTarget = (_renderTarget == SelectTarget_ViewFrameBuffer) ? &_renderBuffer : &refModel.GetRenderBuffer(); 249 | 250 | if (!useTarget->IsValid()) 251 | {// 描画ターゲット内部未作成の場合はここで作成 252 | int width = LWallpaperDelegate::GetInstance()->GetWindowWidth(); 253 | int height = LWallpaperDelegate::GetInstance()->GetWindowHeight(); 254 | 255 | // モデル描画キャンバス 256 | useTarget->CreateOffscreenFrame(static_cast(width), static_cast(height)); 257 | } 258 | 259 | // レンダリング開始 260 | useTarget->BeginDraw(); 261 | useTarget->Clear(_clearColor[0], _clearColor[1], _clearColor[2], _clearColor[3]); // 背景クリアカラー 262 | } 263 | } 264 | 265 | void LWallpaperView::PostModelDraw(LWallpaperModel &refModel) 266 | { 267 | // 別のレンダリングターゲットへ向けて描画する場合の使用するフレームバッファ 268 | Csm::Rendering::CubismOffscreenFrame_OpenGLES2* useTarget = nullptr; 269 | 270 | if (_renderTarget != SelectTarget_None) 271 | {// 別のレンダリングターゲットへ向けて描画する場合 272 | 273 | // 使用するターゲット 274 | useTarget = (_renderTarget == SelectTarget_ViewFrameBuffer) ? &_renderBuffer : &refModel.GetRenderBuffer(); 275 | 276 | // レンダリング終了 277 | useTarget->EndDraw(); 278 | 279 | // LAppMinimumViewの持つフレームバッファを使うなら、スプライトへの描画はここ 280 | if (_renderTarget == SelectTarget_ViewFrameBuffer && _renderSprite) 281 | { 282 | const GLfloat uvVertex[] = 283 | { 284 | 1.0f, 1.0f, 285 | 0.0f, 1.0f, 286 | 0.0f, 0.0f, 287 | 1.0f, 0.0f, 288 | }; 289 | 290 | _renderSprite->SetColor(1.0f, 1.0f, 1.0f, GetSpriteAlpha(0)); 291 | _renderSprite->RenderImmidiate(useTarget->GetColorBuffer(), uvVertex); 292 | } 293 | } 294 | } 295 | 296 | void LWallpaperView::SwitchRenderingTarget(SelectTarget targetType) 297 | { 298 | _renderTarget = targetType; 299 | } 300 | 301 | void LWallpaperView::SetRenderTargetClearColor(float r, float g, float b) 302 | { 303 | _clearColor[0] = r; 304 | _clearColor[1] = g; 305 | _clearColor[2] = b; 306 | } 307 | 308 | float LWallpaperView::GetSpriteAlpha(int assign) const 309 | { 310 | // assignの数値に応じて適当に決定 311 | float alpha = 0.25f + static_cast(assign) * 0.5f; // サンプルとしてαに適当な差をつける 312 | if (alpha > 1.0f) 313 | { 314 | alpha = 1.0f; 315 | } 316 | if (alpha < 0.1f) 317 | { 318 | alpha = 0.1f; 319 | } 320 | 321 | return alpha; 322 | } 323 | 324 | void LWallpaperView::SetBackGroundSpriteColor(float r, float g, float b, float a) 325 | { 326 | // 第四問 2.1 327 | if (_backgroundImage) 328 | { 329 | _backgroundImage->SetColor(r, g, b, a); 330 | } 331 | } 332 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/LWallpaperView.hpp: -------------------------------------------------------------------------------- 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 11 | #include 12 | #include 13 | #include 14 | #include "CubismFramework.hpp" 15 | #include 16 | #include 17 | 18 | class TouchManager; 19 | class LWallpaperSprite; 20 | class LWallpaperModel; 21 | 22 | /** 23 | * @brief 描画クラス 24 | */ 25 | class LWallpaperView 26 | { 27 | public: 28 | 29 | /** 30 | * @brief LAppMinimumModelのレンダリング先 31 | */ 32 | enum SelectTarget 33 | { 34 | SelectTarget_None, ///< デフォルトのフレームバッファにレンダリング 35 | SelectTarget_ModelFrameBuffer, ///< LAppMinimumModelが各自持つフレームバッファにレンダリング 36 | SelectTarget_ViewFrameBuffer, ///< LAppMinimumViewの持つフレームバッファにレンダリング 37 | }; 38 | 39 | /** 40 | * @brief コンストラクタ 41 | */ 42 | LWallpaperView(); 43 | 44 | /** 45 | * @brief デストラクタ 46 | */ 47 | ~LWallpaperView(); 48 | 49 | /** 50 | * @brief 初期化する。 51 | */ 52 | void Initialize(); 53 | 54 | /** 55 | * @brief 描画する。 56 | */ 57 | void Render(); 58 | 59 | /** 60 | * @brief シェーダーの初期化を行う。 61 | */ 62 | void InitializeShader(); 63 | 64 | /** 65 | * @brief 画像の初期化を行う。 66 | */ 67 | void InitializeSprite(); 68 | 69 | /** 70 | * @brief タッチされたときに呼ばれる。 71 | * 72 | * @param[in] pointX スクリーンX座標 73 | * @param[in] pointY スクリーンY座標 74 | */ 75 | void OnTouchesBegan(float pointX, float pointY) const; 76 | 77 | /** 78 | * @brief タッチしているときにポインタが動いたら呼ばれる。 79 | * 80 | * @param[in] pointX スクリーンX座標 81 | * @param[in] pointY スクリーンY座標 82 | */ 83 | void OnTouchesMoved(float pointX, float pointY) const; 84 | 85 | /** 86 | * @brief タッチが終了したら呼ばれる。 87 | * 88 | * @param[in] pointX スクリーンX座標 89 | * @param[in] pointY スクリーンY座標 90 | * 91 | * @return viewPoint ビュー座標 92 | */ 93 | Csm::CubismVector2 OnTouchesEnded(float pointX, float pointY); 94 | 95 | /** 96 | * @brief X座標をView座標に変換する。 97 | * 98 | * @param[in] deviceX デバイスX座標 99 | */ 100 | float TransformViewX(float deviceX) const; 101 | 102 | /** 103 | * @brief Y座標をView座標に変換する。 104 | * 105 | * @param[in] deviceY デバイスY座標 106 | */ 107 | float TransformViewY(float deviceY) const; 108 | 109 | /** 110 | * @brief X座標をScreen座標に変換する。 111 | * 112 | * @param[in] deviceX デバイスX座標 113 | */ 114 | float TransformScreenX(float deviceX) const; 115 | 116 | /** 117 | * @brief Y座標をScreen座標に変換する。 118 | * 119 | * @param[in] deviceY デバイスY座標 120 | */ 121 | float TransformScreenY(float deviceY) const; 122 | 123 | /** 124 | * @brief モデル1体を描画する直前にコールされる 125 | */ 126 | void PreModelDraw(LWallpaperModel &refModel); 127 | 128 | /** 129 | * @brief モデル1体を描画した直後にコールされる 130 | */ 131 | void PostModelDraw(LWallpaperModel &refModel); 132 | 133 | /** 134 | * @brief 別レンダリングターゲットにモデルを描画するサンプルで 135 | * 描画時のαを決定する 136 | */ 137 | float GetSpriteAlpha(int assign) const; 138 | 139 | /** 140 | * @brief レンダリング先を切り替える 141 | */ 142 | void SwitchRenderingTarget(SelectTarget targetType); 143 | 144 | /** 145 | * @brief レンダリング先をデフォルト以外に切り替えた際の背景クリア色設定 146 | * @param[in] r 赤(0.0~1.0) 147 | * @param[in] g 緑(0.0~1.0) 148 | * @param[in] b 青(0.0~1.0) 149 | */ 150 | void SetRenderTargetClearColor(float r, float g, float b); 151 | 152 | /** 153 | * @brief 背景画像の色情報 154 | * @param[in] r 赤(0.0~1.0) 155 | * @param[in] g 緑(0.0~1.0) 156 | * @param[in] b 青(0.0~1.0) 157 | * @param[in] a 不透明度(0.0~1.0) 158 | */ 159 | void SetBackGroundSpriteColor(float r, float g, float b, float a); 160 | 161 | private: 162 | TouchManager* _touchManager; ///< タッチマネージャー 163 | Csm::CubismMatrix44* _deviceToScreen; ///< デバイスからスクリーンへの行列 164 | Csm::CubismViewMatrix* _viewMatrix; ///< viewMatrix 165 | GLuint _programId; ///< シェーダID 166 | 167 | LWallpaperSprite* _backgroundImage; ///< 背景画像 168 | 169 | // レンダリング先を別ターゲットにする方式の場合に使用 170 | LWallpaperSprite* _renderSprite; ///< モードによっては_renderBufferのテクスチャを描画 171 | Csm::Rendering::CubismOffscreenFrame_OpenGLES2 _renderBuffer; ///< モードによってはCubismモデル結果をこっちにレンダリング 172 | SelectTarget _renderTarget; ///< レンダリング先の選択肢 173 | float _clearColor[4]; ///< レンダリングターゲットのクリアカラー 174 | }; 175 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/TouchManager.cpp: -------------------------------------------------------------------------------- 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 "TouchManager.hpp" 9 | #include 10 | 11 | TouchManager::TouchManager() 12 | : _startY(0.0f) 13 | , _startX(0.0f) 14 | , _lastX(0.0f) 15 | , _lastY(0.0f) 16 | , _lastX1(0.0f) 17 | , _lastY1(0.0f) 18 | , _lastX2(0.0f) 19 | , _lastY2(0.0f) 20 | , _lastTouchDistance(0.0f) 21 | , _deltaX(0.0f) 22 | , _deltaY(0.0f) 23 | , _scale(1.0f) 24 | , _touchSingle(false) 25 | , _flipAvailable(false) 26 | { } 27 | 28 | void TouchManager::TouchesBegan(float deviceX, float deviceY) 29 | { 30 | _lastX = deviceX; 31 | _lastY = deviceY; 32 | _startX = deviceX; 33 | _startY = deviceY; 34 | _lastTouchDistance = -1.0f; 35 | _flipAvailable = true; 36 | _touchSingle = true; 37 | } 38 | 39 | void TouchManager::TouchesMoved(float deviceX, float deviceY) 40 | { 41 | _lastX = deviceX; 42 | _lastY = deviceY; 43 | _lastTouchDistance = -1.0f; 44 | _touchSingle = true; 45 | } 46 | 47 | void TouchManager::TouchesMoved(float deviceX1, float deviceY1, float deviceX2, float deviceY2) 48 | { 49 | float distance = CalculateDistance(deviceX1, deviceY1, deviceX2, deviceY2); 50 | float centerX = (deviceX1 + deviceX2) * 0.5f; 51 | float centerY = (deviceY1 + deviceY2) * 0.5f; 52 | 53 | if (_lastTouchDistance > 0.0f) 54 | { 55 | _scale = powf(distance / _lastTouchDistance, 0.75f); 56 | _deltaX = CalculateMovingAmount(deviceX1 - _lastX1, deviceX2 - _lastX2); 57 | _deltaY = CalculateMovingAmount(deviceY1 - _lastY1, deviceY2 - _lastY2); 58 | } 59 | else 60 | { 61 | _scale = 1.0f; 62 | _deltaX = 0.0f; 63 | _deltaY = 0.0f; 64 | } 65 | 66 | _lastX = centerX; 67 | _lastY = centerY; 68 | _lastX1 = deviceX1; 69 | _lastY1 = deviceY1; 70 | _lastX2 = deviceX2; 71 | _lastY2 = deviceY2; 72 | _lastTouchDistance = distance; 73 | _touchSingle = false; 74 | } 75 | 76 | float TouchManager::GetFlickDistance() const 77 | { 78 | return CalculateDistance(_startX, _startY, _lastX, _lastY); 79 | } 80 | 81 | float TouchManager::CalculateDistance(float x1, float y1, float x2, float y2) const 82 | { 83 | return sqrtf((x1 - x2) * (x1 - x2) + (y1 - y2) * (y1 - y2)); 84 | } 85 | 86 | float TouchManager::CalculateMovingAmount(float v1, float v2) 87 | { 88 | if ((v1 > 0.0f) != (v2 > 0.0f)) 89 | { 90 | return 0.0f; 91 | } 92 | 93 | float sign = v1 > 0.0f ? 1.0f : -1.0f; 94 | float absoluteValue1 = fabsf(v1); 95 | float absoluteValue2 = fabsf(v2); 96 | return sign * ((absoluteValue1 < absoluteValue2) ? absoluteValue1 : absoluteValue2); 97 | } 98 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/cpp/TouchManager.hpp: -------------------------------------------------------------------------------- 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 | /** 11 | * @brief タッチマネジャー 12 | */ 13 | class TouchManager 14 | { 15 | public: 16 | /** 17 | * @brief コンストラクタ 18 | */ 19 | TouchManager(); 20 | 21 | float GetCenterX() const { return _lastX; } 22 | float GetCenterY() const { return _lastY; } 23 | float GetDeltaX() const { return _deltaX; } 24 | float GetDeltaY() const{ return _deltaY; } 25 | float GetStartX() const{ return _startX; } 26 | float GetStartY() const{ return _startY; } 27 | float GetScale() const { return _scale; } 28 | float GetX() const{ return _lastX; } 29 | float GetY() const{ return _lastY; } 30 | float GetX1() const{ return _lastX1; } 31 | float GetY1() const{ return _lastY1; } 32 | float GetX2() const{ return _lastX2; } 33 | float GetY2() const{ return _lastY2; } 34 | bool IsSingleTouch() const { return _touchSingle; } 35 | bool IsFlickAvailable() const { return _flipAvailable; } 36 | void DisableFlick() { _flipAvailable = false; } 37 | 38 | /* 39 | * @brief タッチ開始時イベント 40 | * 41 | * @param[in] deviceY タッチした画面のyの値 42 | * @param[in] deviceX タッチした画面のxの値 43 | */ 44 | void TouchesBegan(float deviceX, float deviceY); 45 | 46 | /* 47 | * @brief ドラッグ時のイベント 48 | * 49 | * @param[in] deviceX タッチした画面のyの値 50 | * @param[in] deviceY タッチした画面のxの値 51 | */ 52 | void TouchesMoved(float deviceX, float deviceY); 53 | 54 | /* 55 | * @brief ドラッグ時のイベント 56 | * 57 | * @param[in] deviceX1 1つめのタッチした画面のxの値 58 | * @param[in] deviceY1 1つめのタッチした画面のyの値 59 | * @param[in] deviceX2 2つめのタッチした画面のxの値 60 | * @param[in] deviceY2 2つめのタッチした画面のyの値 61 | */ 62 | void TouchesMoved(float deviceX1, float deviceY1, float deviceX2, float deviceY2); 63 | 64 | /* 65 | * @brief フリックの距離測定 66 | * 67 | * @return フリック距離 68 | */ 69 | float GetFlickDistance() const; 70 | 71 | private: 72 | /* 73 | * @brief 点1から点2への距離を求める 74 | * 75 | * @param[in] x1 1つめのタッチした画面のxの値 76 | * @param[in] y1 1つめのタッチした画面のyの値 77 | * @param[in] x2 2つめのタッチした画面のxの値 78 | * @param[in] y2 2つめのタッチした画面のyの値 79 | * @return 2点の距離 80 | */ 81 | float CalculateDistance(float x1, float y1, float x2, float y2) const; 82 | 83 | /* 84 | * 二つの値から、移動量を求める。 85 | * 違う方向の場合は移動量0。同じ方向の場合は、絶対値が小さい方の値を参照する 86 | * 87 | * @param[in] v1 1つめの移動量 88 | * @param[in] v2 2つめの移動量 89 | * 90 | * @return 小さい方の移動量 91 | */ 92 | float CalculateMovingAmount(float v1, float v2); 93 | 94 | float _startY; // タッチを開始した時のxの値 95 | float _startX; // タッチを開始した時のyの値 96 | float _lastX; // シングルタッチ時のxの値 97 | float _lastY; // シングルタッチ時のyの値 98 | float _lastX1; // ダブルタッチ時の一つ目のxの値 99 | float _lastY1; // ダブルタッチ時の一つ目のyの値 100 | float _lastX2; // ダブルタッチ時の二つ目のxの値 101 | float _lastY2; // ダブルタッチ時の二つ目のyの値 102 | float _lastTouchDistance; // 2本以上でタッチしたときの指の距離 103 | float _deltaX; // 前回の値から今回の値へのxの移動距離。 104 | float _deltaY; // 前回の値から今回の値へのyの移動距離。 105 | float _scale; // このフレームで掛け合わせる拡大率。拡大操作中以外は1。 106 | bool _touchSingle; // シングルタッチ時はtrue 107 | bool _flipAvailable; // フリップが有効かどうか 108 | 109 | }; 110 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/java/com/live2d/demo/JniBridgeJava.java: -------------------------------------------------------------------------------- 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 | package com.live2d.demo; 9 | 10 | import android.content.Context; 11 | 12 | import java.io.IOException; 13 | import java.io.InputStream; 14 | 15 | public class JniBridgeJava { 16 | 17 | private static final String LIBRARY_NAME = "Demo"; 18 | private static Context _context; 19 | 20 | static { 21 | System.loadLibrary(LIBRARY_NAME); 22 | } 23 | 24 | // Native ----------------------------------------------------------------- 25 | 26 | public static native void nativeOnStart(); 27 | 28 | public static native void nativeOnDestroy(); 29 | 30 | public static native void nativeOnSurfaceCreated(); 31 | 32 | public static native void nativeOnSurfaceChanged(int width, int height); 33 | 34 | public static native void nativeOnDrawFrame(); 35 | 36 | public static native void nativeOnTouchesBegan(float pointX, float pointY); 37 | 38 | public static native void nativeOnTouchesEnded(float pointX, float pointY); 39 | 40 | public static native void nativeOnTouchesMoved(float pointX, float pointY); 41 | 42 | public static native void nativeStartRandomMotion(); 43 | 44 | public static native void nativeStartMotion(int index); 45 | 46 | public static native void nativeSetClearColor(float r, float g, float b); 47 | 48 | public static native void SetBackGroundSpriteAlpha(float a); 49 | 50 | public static native void SetGravitationalAccelerationX(float gravity); 51 | 52 | // Java ----------------------------------------------------------------- 53 | 54 | public static void SetContext(Context context) { 55 | _context = context; 56 | } 57 | 58 | public static byte[] LoadFile(String filePath) { 59 | InputStream fileData = null; 60 | try { 61 | fileData = _context.getAssets().open(filePath); 62 | int fileSize = fileData.available(); 63 | byte[] fileBuffer = new byte[fileSize]; 64 | fileData.read(fileBuffer, 0, fileSize); 65 | return fileBuffer; 66 | } catch (IOException e) { 67 | e.printStackTrace(); 68 | return null; 69 | } finally { 70 | try { 71 | if (fileData != null) { 72 | fileData.close(); 73 | } 74 | } catch (IOException e) { 75 | e.printStackTrace(); 76 | } 77 | } 78 | } 79 | } 80 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/java/com/live2d/demo/Live2DGLRenderer.java: -------------------------------------------------------------------------------- 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 | package com.live2d.demo; 9 | 10 | import android.content.Context; 11 | import android.hardware.Sensor; 12 | import android.hardware.SensorEvent; 13 | import android.hardware.SensorEventListener; 14 | import android.hardware.SensorManager; 15 | import android.opengl.GLSurfaceView; 16 | 17 | import javax.microedition.khronos.egl.EGLConfig; 18 | import javax.microedition.khronos.opengles.GL10; 19 | 20 | public class Live2DGLRenderer implements GLSurfaceView.Renderer, SensorEventListener { 21 | Context con; 22 | 23 | private SensorManager sensorManager; 24 | private Sensor sensor; 25 | 26 | 27 | public Live2DGLRenderer(Context context) 28 | { 29 | con = context; 30 | sensorManager = (SensorManager)con.getSystemService(Context.SENSOR_SERVICE); 31 | if (sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY) != null){ 32 | sensor = sensorManager.getDefaultSensor(Sensor.TYPE_GRAVITY); 33 | } 34 | sensorManager.registerListener(this, sensor, SensorManager.SENSOR_DELAY_FASTEST); 35 | } 36 | 37 | public void onSurfaceCreated(GL10 gl, EGLConfig config) { 38 | JniBridgeJava.nativeOnSurfaceCreated(); 39 | } 40 | 41 | public void onSurfaceChanged(GL10 gl, int width, int height) { 42 | JniBridgeJava.nativeOnSurfaceChanged(width, height); 43 | } 44 | 45 | public void onDrawFrame(GL10 gl) { 46 | JniBridgeJava.nativeOnDrawFrame(); 47 | } 48 | 49 | @Override 50 | public void onSensorChanged(SensorEvent event) { 51 | JniBridgeJava.SetGravitationalAccelerationX(event.values[0]); 52 | } 53 | 54 | @Override 55 | public void onAccuracyChanged(Sensor sensor, int accuracy) { } 56 | 57 | /** 58 | * Called when the engine is destroyed. Do any necessary clean up because 59 | * at this point your renderer instance is now done for. 60 | */ 61 | public void release() { 62 | sensorManager.unregisterListener(this,sensor); 63 | } 64 | } 65 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/java/com/live2d/demo/Live2DReceiver.java: -------------------------------------------------------------------------------- 1 | package com.live2d.demo; 2 | 3 | import java.util.Random; 4 | 5 | import android.content.BroadcastReceiver; 6 | import android.content.Context; 7 | import android.content.Intent; 8 | 9 | public class Live2DReceiver extends BroadcastReceiver { 10 | 11 | private boolean airPlaneMode; 12 | 13 | public Live2DReceiver (){ 14 | super(); 15 | airPlaneMode = false; 16 | } 17 | 18 | @Override 19 | public void onReceive(Context context, Intent intent) { 20 | switch (intent.getAction()) { 21 | case Intent.ACTION_SCREEN_ON: 22 | JniBridgeJava.nativeStartRandomMotion(); 23 | break; 24 | // Android API 31から非推奨 25 | case Intent.ACTION_CLOSE_SYSTEM_DIALOGS: 26 | Random rnd = new Random(); 27 | float r = rnd.nextFloat(); 28 | float g = rnd.nextFloat(); 29 | float b = rnd.nextFloat(); 30 | JniBridgeJava.nativeSetClearColor(r,g,b); 31 | break; 32 | case Intent.ACTION_AIRPLANE_MODE_CHANGED: 33 | airPlaneMode = !airPlaneMode; 34 | if (airPlaneMode) 35 | { 36 | JniBridgeJava.SetBackGroundSpriteAlpha(1.0f); 37 | } 38 | else 39 | { 40 | JniBridgeJava.SetBackGroundSpriteAlpha(0.0f); 41 | } 42 | break; 43 | } 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/java/com/live2d/demo/LiveWallpaperService.java: -------------------------------------------------------------------------------- 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 | package com.live2d.demo; 9 | 10 | import android.app.ActivityManager; 11 | import android.content.BroadcastReceiver; 12 | import android.content.Context; 13 | import android.content.Intent; 14 | import android.content.IntentFilter; 15 | import android.content.pm.ConfigurationInfo; 16 | import android.hardware.usb.UsbManager; 17 | import android.view.MotionEvent; 18 | import android.view.SurfaceHolder; 19 | 20 | import net.rbgrn.android.glwallpaperservice.*; 21 | 22 | public class LiveWallpaperService extends GLWallpaperService { 23 | 24 | public LiveWallpaperService() { 25 | super(); 26 | } 27 | 28 | public Engine onCreateEngine() { 29 | Live2DWallpaperEngine engine = new Live2DWallpaperEngine(); 30 | 31 | BroadcastReceiver br = new Live2DReceiver(); 32 | IntentFilter filter = new IntentFilter(); 33 | filter.addAction(Intent.ACTION_SCREEN_ON); 34 | filter.addAction(Intent.ACTION_CLOSE_SYSTEM_DIALOGS); // Android API 31から非推奨 35 | filter.addAction(Intent.ACTION_AIRPLANE_MODE_CHANGED); 36 | this.registerReceiver(br,filter); 37 | 38 | return engine; 39 | } 40 | 41 | @Override 42 | public void onDestroy() { 43 | super.onDestroy(); 44 | } 45 | 46 | class Live2DWallpaperEngine extends GLEngine { 47 | Live2DGLRenderer renderer; 48 | 49 | public Live2DWallpaperEngine() { 50 | super(); 51 | 52 | JniBridgeJava.SetContext(getApplicationContext()); 53 | JniBridgeJava.nativeOnStart(); 54 | } 55 | 56 | @Override 57 | public void onCreate(SurfaceHolder surfaceHolder) { 58 | super.onCreate(surfaceHolder); 59 | 60 | // Check if the system supports OpenGL ES 2.0. 61 | // システムがOpenGL ES 2.0に対応しているかのチェック 62 | final ActivityManager activityManager = 63 | (ActivityManager) getSystemService(Context.ACTIVITY_SERVICE); 64 | final ConfigurationInfo configurationInfo = 65 | activityManager.getDeviceConfigurationInfo(); 66 | final boolean supportsEs2 = 67 | configurationInfo.reqGlEsVersion >= 0x20000; 68 | 69 | if (supportsEs2) 70 | { 71 | // Request an OpenGL ES 2.0 compatible context. 72 | // OpenGL ES 2.0互換のコンテキストを要求 73 | setEGLContextClientVersion(2); 74 | 75 | // On Honeycomb+ devices, this improves the performance when 76 | // leaving and resuming the live wallpaper. 77 | // Honeycomb以降のデバイスでは、ライブ壁紙を終了して再開した際のパフォーマンスが向上します。 78 | setPreserveEGLContextOnPause(true); 79 | 80 | // Set the renderer. 81 | // レンダラーの設定 82 | renderer = new Live2DGLRenderer(getApplicationContext()); 83 | setRenderer(renderer); 84 | } 85 | } 86 | 87 | @Override 88 | public void onTouchEvent(MotionEvent event) { 89 | float pointX = event.getX(); 90 | float pointY = event.getY(); 91 | switch (event.getAction()) { 92 | case MotionEvent.ACTION_DOWN: 93 | JniBridgeJava.nativeOnTouchesBegan(pointX, pointY); 94 | break; 95 | case MotionEvent.ACTION_UP: 96 | JniBridgeJava.nativeOnTouchesEnded(pointX, pointY); 97 | break; 98 | case MotionEvent.ACTION_MOVE: 99 | JniBridgeJava.nativeOnTouchesMoved(pointX, pointY); 100 | break; 101 | } 102 | } 103 | 104 | public void onDestroy() { 105 | super.onDestroy(); 106 | JniBridgeJava.nativeOnDestroy(); 107 | 108 | if (renderer != null) { 109 | renderer.release(); 110 | } 111 | renderer = null; 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/java/net/rbgrn/android/glwallpaperservice/Apache_License_2.0_license.txt: -------------------------------------------------------------------------------- 1 |  2 | Apache License 3 | Version 2.0, January 2004 4 | http://www.apache.org/licenses/ 5 | 6 | TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION 7 | 8 | 1. Definitions. 9 | 10 | "License" shall mean the terms and conditions for use, reproduction, 11 | and distribution as defined by Sections 1 through 9 of this document. 12 | 13 | "Licensor" shall mean the copyright owner or entity authorized by 14 | the copyright owner that is granting the License. 15 | 16 | "Legal Entity" shall mean the union of the acting entity and all 17 | other entities that control, are controlled by, or are under common 18 | control with that entity. For the purposes of this definition, 19 | "control" means (i) the power, direct or indirect, to cause the 20 | direction or management of such entity, whether by contract or 21 | otherwise, or (ii) ownership of fifty percent (50%) or more of the 22 | outstanding shares, or (iii) beneficial ownership of such entity. 23 | 24 | "You" (or "Your") shall mean an individual or Legal Entity 25 | exercising permissions granted by this License. 26 | 27 | "Source" form shall mean the preferred form for making modifications, 28 | including but not limited to software source code, documentation 29 | source, and configuration files. 30 | 31 | "Object" form shall mean any form resulting from mechanical 32 | transformation or translation of a Source form, including but 33 | not limited to compiled object code, generated documentation, 34 | and conversions to other media types. 35 | 36 | "Work" shall mean the work of authorship, whether in Source or 37 | Object form, made available under the License, as indicated by a 38 | copyright notice that is included in or attached to the work 39 | (an example is provided in the Appendix below). 40 | 41 | "Derivative Works" shall mean any work, whether in Source or Object 42 | form, that is based on (or derived from) the Work and for which the 43 | editorial revisions, annotations, elaborations, or other modifications 44 | represent, as a whole, an original work of authorship. For the purposes 45 | of this License, Derivative Works shall not include works that remain 46 | separable from, or merely link (or bind by name) to the interfaces of, 47 | the Work and Derivative Works thereof. 48 | 49 | "Contribution" shall mean any work of authorship, including 50 | the original version of the Work and any modifications or additions 51 | to that Work or Derivative Works thereof, that is intentionally 52 | submitted to Licensor for inclusion in the Work by the copyright owner 53 | or by an individual or Legal Entity authorized to submit on behalf of 54 | the copyright owner. For the purposes of this definition, "submitted" 55 | means any form of electronic, verbal, or written communication sent 56 | to the Licensor or its representatives, including but not limited to 57 | communication on electronic mailing lists, source code control systems, 58 | and issue tracking systems that are managed by, or on behalf of, the 59 | Licensor for the purpose of discussing and improving the Work, but 60 | excluding communication that is conspicuously marked or otherwise 61 | designated in writing by the copyright owner as "Not a Contribution." 62 | 63 | "Contributor" shall mean Licensor and any individual or Legal Entity 64 | on behalf of whom a Contribution has been received by Licensor and 65 | subsequently incorporated within the Work. 66 | 67 | 2. Grant of Copyright License. Subject to the terms and conditions of 68 | this License, each Contributor hereby grants to You a perpetual, 69 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 70 | copyright license to reproduce, prepare Derivative Works of, 71 | publicly display, publicly perform, sublicense, and distribute the 72 | Work and such Derivative Works in Source or Object form. 73 | 74 | 3. Grant of Patent License. Subject to the terms and conditions of 75 | this License, each Contributor hereby grants to You a perpetual, 76 | worldwide, non-exclusive, no-charge, royalty-free, irrevocable 77 | (except as stated in this section) patent license to make, have made, 78 | use, offer to sell, sell, import, and otherwise transfer the Work, 79 | where such license applies only to those patent claims licensable 80 | by such Contributor that are necessarily infringed by their 81 | Contribution(s) alone or by combination of their Contribution(s) 82 | with the Work to which such Contribution(s) was submitted. If You 83 | institute patent litigation against any entity (including a 84 | cross-claim or counterclaim in a lawsuit) alleging that the Work 85 | or a Contribution incorporated within the Work constitutes direct 86 | or contributory patent infringement, then any patent licenses 87 | granted to You under this License for that Work shall terminate 88 | as of the date such litigation is filed. 89 | 90 | 4. Redistribution. You may reproduce and distribute copies of the 91 | Work or Derivative Works thereof in any medium, with or without 92 | modifications, and in Source or Object form, provided that You 93 | meet the following conditions: 94 | 95 | (a) You must give any other recipients of the Work or 96 | Derivative Works a copy of this License; and 97 | 98 | (b) You must cause any modified files to carry prominent notices 99 | stating that You changed the files; and 100 | 101 | (c) You must retain, in the Source form of any Derivative Works 102 | that You distribute, all copyright, patent, trademark, and 103 | attribution notices from the Source form of the Work, 104 | excluding those notices that do not pertain to any part of 105 | the Derivative Works; and 106 | 107 | (d) If the Work includes a "NOTICE" text file as part of its 108 | distribution, then any Derivative Works that You distribute must 109 | include a readable copy of the attribution notices contained 110 | within such NOTICE file, excluding those notices that do not 111 | pertain to any part of the Derivative Works, in at least one 112 | of the following places: within a NOTICE text file distributed 113 | as part of the Derivative Works; within the Source form or 114 | documentation, if provided along with the Derivative Works; or, 115 | within a display generated by the Derivative Works, if and 116 | wherever such third-party notices normally appear. The contents 117 | of the NOTICE file are for informational purposes only and 118 | do not modify the License. You may add Your own attribution 119 | notices within Derivative Works that You distribute, alongside 120 | or as an addendum to the NOTICE text from the Work, provided 121 | that such additional attribution notices cannot be construed 122 | as modifying the License. 123 | 124 | You may add Your own copyright statement to Your modifications and 125 | may provide additional or different license terms and conditions 126 | for use, reproduction, or distribution of Your modifications, or 127 | for any such Derivative Works as a whole, provided Your use, 128 | reproduction, and distribution of the Work otherwise complies with 129 | the conditions stated in this License. 130 | 131 | 5. Submission of Contributions. Unless You explicitly state otherwise, 132 | any Contribution intentionally submitted for inclusion in the Work 133 | by You to the Licensor shall be under the terms and conditions of 134 | this License, without any additional terms or conditions. 135 | Notwithstanding the above, nothing herein shall supersede or modify 136 | the terms of any separate license agreement you may have executed 137 | with Licensor regarding such Contributions. 138 | 139 | 6. Trademarks. This License does not grant permission to use the trade 140 | names, trademarks, service marks, or product names of the Licensor, 141 | except as required for reasonable and customary use in describing the 142 | origin of the Work and reproducing the content of the NOTICE file. 143 | 144 | 7. Disclaimer of Warranty. Unless required by applicable law or 145 | agreed to in writing, Licensor provides the Work (and each 146 | Contributor provides its Contributions) on an "AS IS" BASIS, 147 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 148 | implied, including, without limitation, any warranties or conditions 149 | of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A 150 | PARTICULAR PURPOSE. You are solely responsible for determining the 151 | appropriateness of using or redistributing the Work and assume any 152 | risks associated with Your exercise of permissions under this License. 153 | 154 | 8. Limitation of Liability. In no event and under no legal theory, 155 | whether in tort (including negligence), contract, or otherwise, 156 | unless required by applicable law (such as deliberate and grossly 157 | negligent acts) or agreed to in writing, shall any Contributor be 158 | liable to You for damages, including any direct, indirect, special, 159 | incidental, or consequential damages of any character arising as a 160 | result of this License or out of the use or inability to use the 161 | Work (including but not limited to damages for loss of goodwill, 162 | work stoppage, computer failure or malfunction, or any and all 163 | other commercial damages or losses), even if such Contributor 164 | has been advised of the possibility of such damages. 165 | 166 | 9. Accepting Warranty or Additional Liability. While redistributing 167 | the Work or Derivative Works thereof, You may choose to offer, 168 | and charge a fee for, acceptance of support, warranty, indemnity, 169 | or other liability obligations and/or rights consistent with this 170 | License. However, in accepting such obligations, You may act only 171 | on Your own behalf and on Your sole responsibility, not on behalf 172 | of any other Contributor, and only if You agree to indemnify, 173 | defend, and hold each Contributor harmless for any liability 174 | incurred by, or claims asserted against, such Contributor by reason 175 | of your accepting any such warranty or additional liability. 176 | 177 | END OF TERMS AND CONDITIONS 178 | 179 | APPENDIX: How to apply the Apache License to your work. 180 | 181 | To apply the Apache License to your work, attach the following 182 | boilerplate notice, with the fields enclosed by brackets "[]" 183 | replaced with your own identifying information. (Don't include 184 | the brackets!) The text should be enclosed in the appropriate 185 | comment syntax for the file format. We also recommend that a 186 | file or class name and description of purpose be included on the 187 | same "printed page" as the copyright notice for easier 188 | identification within third-party archives. 189 | 190 | Copyright [yyyy] [name of copyright owner] 191 | 192 | Licensed under the Apache License, Version 2.0 (the "License"); 193 | you may not use this file except in compliance with the License. 194 | You may obtain a copy of the License at 195 | 196 | http://www.apache.org/licenses/LICENSE-2.0 197 | 198 | Unless required by applicable law or agreed to in writing, software 199 | distributed under the License is distributed on an "AS IS" BASIS, 200 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 201 | See the License for the specific language governing permissions and 202 | limitations under the License. 203 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/java/net/rbgrn/android/glwallpaperservice/GLWallpaperService-CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # GLWallpaperService Changelog 2 | 3 | Based on [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html), any changes made to GLWallpaperService.java by Live2D will be written to this file. 4 | 5 | The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). 6 | 7 | ## [Unreleased] 8 | 9 | ### Changed 10 | - Remove `GLThread` and related processing. 11 | - Create a class that extends `GLSurfaceView` add related processing. 12 | - Remove deprecated functions and unnecessary variables. 13 | 14 | --- 15 | 16 | ©Live2D -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/java/net/rbgrn/android/glwallpaperservice/NOTICE.txt: -------------------------------------------------------------------------------- 1 | Copyright 2008 The Android Open Source Project 2 | 3 | Licensed under the Apache License, Version 2.0 (the "License"); 4 | you may not use this file except in compliance with the License. 5 | You may obtain a copy of the License at 6 | 7 | http://www.apache.org/licenses/LICENSE-2.0 8 | 9 | Unless required by applicable law or agreed to in writing, software 10 | distributed under the License is distributed on an "AS IS" BASIS, 11 | WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | See the License for the specific language governing permissions and 13 | limitations under the License. 14 | 15 | Portions of this software were developed by Robert Green. The original 16 | software is available from 17 | http://www.rbgrn.net/content/354-glsurfaceview-adapted-3d-live-wallpapers 18 | 19 | Other contributors include 20 | Mark Guerra - https://github.com/markfguerra 21 | TaDaa - https://github.com/TaDaa 22 | Timo Griese - https://github.com/Projekt2501 23 | Walter Reid - https://github.com/walterreid 24 | Zachary Burke - http://mobilecoder.wordpress.com 25 | Jay Weisskopf - http://jayschwa.net 26 | Cédric Roux - https://github.com/Cedroux 27 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/drawable-hdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/drawable-hdpi/icon.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/drawable-ldpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/drawable-ldpi/icon.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/drawable-mdpi/icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/drawable-mdpi/icon.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/drawable-v24/ic_launcher_foreground.xml: -------------------------------------------------------------------------------- 1 | 7 | 12 | 13 | 19 | 22 | 25 | 26 | 27 | 28 | 34 | 35 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/drawable/ic_launcher_background.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 10 | 15 | 20 | 25 | 30 | 35 | 40 | 45 | 50 | 55 | 60 | 65 | 70 | 75 | 80 | 85 | 90 | 95 | 100 | 105 | 110 | 115 | 120 | 125 | 130 | 135 | 140 | 145 | 150 | 155 | 160 | 165 | 170 | 171 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/layout/activity_main.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Live2D/CubismAndroidLiveWallpaper/61cc9dc8f6a43742eb7d27a027e2d739c033c43a/AndroidWallPaper/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/values/colors.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | #008577 4 | #00574B 5 | #D81B60 6 | 7 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | Live2DWallpaper 3 | Live2DWallpaper 4 | 5 | -------------------------------------------------------------------------------- /AndroidWallPaper/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 |