| 425 | } |
| 426 | |
| 427 | void LAppModel::Update(LAppModelParameters parameters) |
| 428 | { |
| 429 | const csmFloat32 deltaTimeSeconds = LAppPal::GetDeltaTime(); |
| 430 | _userTimeSeconds += deltaTimeSeconds; |
| 431 | |
| 432 | _dragManager->Update(deltaTimeSeconds); |
| 433 | _dragX = _dragManager->GetX(); |
| 434 | _dragY = _dragManager->GetY(); |
| 435 | |
| 436 | // モーションによるパラメータ更新の有無 |
| 437 | csmBool motionUpdated = false; |
| 438 | |
| 439 | //----------------------------------------------------------------- |
| 440 | _model->LoadParameters(); // 前回セーブされた状態をロード |
| 441 | if (_motionManager->IsFinished()) |
| 442 | { |
| 443 | // モーションの再生がない場合、待機モーションの中からランダムで再生する |
| 444 | // StartRandomMotion(MotionGroupIdle, PriorityIdle); |
| 445 | } |
| 446 | else |
| 447 | { |
| 448 | motionUpdated = _motionManager->UpdateMotion(_model, deltaTimeSeconds); // モーションを更新 |
| 449 | } |
| 450 | _model->SaveParameters(); // 状態を保存 |
| 451 | //----------------------------------------------------------------- |
| 452 | |
| 453 | // まばたき |
| 454 | if (!motionUpdated) |
| 455 | { |
| 456 | if (_eyeBlink != NULL && parameters.autoBlinkEyesEnabled) |
| 457 | { |
| 458 | // メインモーションの更新がないとき |
| 459 | _eyeBlink->UpdateParameters(_model, deltaTimeSeconds); // 目パチ |
| 460 | } |
| 461 | } |
| 462 | |
| 463 | if (!parameters.autoBlinkEyesEnabled) |
| 464 | { |
| 465 | // 目の開閉、eg: ひゆりは0.0から1.2 |
| 466 | _model->AddParameterValue(_idParamEyeLOpen, parameters.eyeLOpen - 1.0f); |
| 467 | _model->AddParameterValue(_idParamEyeROpen, parameters.eyeROpen - 1.0f); |
| 468 | } |
| 469 | |
| 470 | // 口の変形、eg: ひゆりは-2.0から |
| 471 | _model->AddParameterValue(_idParamMouthForm, parameters.mouthForm - 1.0f); |
| 472 | // 口の開閉 |
| 473 | _model->AddParameterValue(_idParamMouthOpenY, parameters.mouthOpenY); |
| 474 | |
| 475 | if (_expressionManager != NULL) |
| 476 | { |
| 477 | _expressionManager->UpdateMotion(_model, deltaTimeSeconds); // 表情でパラメータ更新(相対変化) |
| 478 | } |
| 479 | |
| 480 | if (parameters.changeExpression) { |
| 481 | if (_debugMode) |
| 482 | { |
| 483 | LAppPal::PrintLog("[APP]try start expression: %s.", parameters.nextExpressionName.c_str()); |
| 484 | } |
no test coverage detected