| 232 | } |
| 233 | |
| 234 | void LAppLive2DManager::ChangeModelTo(std::string modelPath, std::string modelJsonFileName) |
| 235 | { |
| 236 | // モデルパスの「/」は必要な、モデルJsonファイル名前は「xxx.model3.json」 |
| 237 | if (DebugLogEnable) |
| 238 | { |
| 239 | LAppPal::PrintLog("[APP]model load: %s (Dir: %s)", modelJsonFileName.c_str(), modelPath.c_str()); |
| 240 | } |
| 241 | |
| 242 | LAppModel* newModel = new LAppModel(); |
| 243 | |
| 244 | ReleaseAllModel(); |
| 245 | if (newModel->LoadAssets(modelPath.c_str(), modelJsonFileName.c_str())) { |
| 246 | // ReleaseAllModel(); |
| 247 | _models.PushBack(newModel); |
| 248 | |
| 249 | /* |
| 250 | * モデル半透明表示を行うサンプルを提示する。 |
| 251 | * ここでUSE_RENDER_TARGET、USE_MODEL_RENDER_TARGETが定義されている場合 |
| 252 | * 別のレンダリングターゲットにモデルを描画し、描画結果をテクスチャとして別のスプライトに張り付ける。 |
| 253 | */ |
| 254 | { |
| 255 | #if defined(USE_RENDER_TARGET) |
| 256 | // LAppViewの持つターゲットに描画を行う場合、こちらを選択 |
| 257 | LAppView::SelectTarget useRenderTarget = LAppView::SelectTarget_ViewFrameBuffer; |
| 258 | #elif defined(USE_MODEL_RENDER_TARGET) |
| 259 | // 各LAppModelの持つターゲットに描画を行う場合、こちらを選択 |
| 260 | LAppView::SelectTarget useRenderTarget = LAppView::SelectTarget_ModelFrameBuffer; |
| 261 | #else |
| 262 | // デフォルトのメインフレームバッファへレンダリングする(通常) |
| 263 | LAppView::SelectTarget useRenderTarget = LAppView::SelectTarget_None; |
| 264 | #endif |
| 265 | |
| 266 | #if defined(USE_RENDER_TARGET) || defined(USE_MODEL_RENDER_TARGET) |
| 267 | // モデル個別にαを付けるサンプルとして、もう1体モデルを作成し、少し位置をずらす |
| 268 | _models.PushBack(new LAppModel()); |
| 269 | _models[1]->LoadAssets(modelPath.c_str(), modelJsonName.c_str()); |
| 270 | _models[1]->GetModelMatrix()->TranslateX(0.2f); |
| 271 | #endif |
| 272 | |
| 273 | LAppDelegate::GetInstance()->GetView()->SwitchRenderingTarget(useRenderTarget); |
| 274 | |
| 275 | // 別レンダリング先を選択した際の背景クリア色 |
| 276 | float clearColor[3] = { 1.0f, 1.0f, 1.0f }; |
| 277 | LAppDelegate::GetInstance()->GetView()->SetRenderTargetClearColor(clearColor[0], clearColor[1], clearColor[2]); |
| 278 | } |
| 279 | LAppPal::PrintLog("[APP] L2D glGetError (INIT): %d", glGetError()); |
| 280 | JniBridgeC::OnLoadDone(); |
| 281 | } else { |
| 282 | delete newModel; |
| 283 | if (DebugLogEnable) |
| 284 | { |
| 285 | LAppPal::PrintLog("[APP]model load: %s (Dir: %s), failed.", modelJsonFileName.c_str(), modelPath.c_str()); |
| 286 | } |
| 287 | JniBridgeC::OnLoadError(); |
| 288 | } |
| 289 | } |
| 290 |
nothing calls this directly
no test coverage detected