| 381 | } |
| 382 | |
| 383 | bool MobileNerf::prepare(const vkb::ApplicationOptions &options) |
| 384 | { |
| 385 | read_json_map(); |
| 386 | |
| 387 | // Load the mlp for each model |
| 388 | mlp_weight_vector.resize(model_path.size()); |
| 389 | |
| 390 | for (int i = 0; i < model_path.size(); i++) |
| 391 | { |
| 392 | initialize_mlp_uniform_buffers(i); |
| 393 | } |
| 394 | |
| 395 | if (!ApiVulkanSample::prepare(options)) |
| 396 | { |
| 397 | return false; |
| 398 | } |
| 399 | |
| 400 | if (view_port_width == 0 || view_port_height == 0) |
| 401 | { |
| 402 | view_port_width = width; |
| 403 | view_port_height = height; |
| 404 | use_native_screen_size = true; |
| 405 | } |
| 406 | |
| 407 | load_shaders(); |
| 408 | |
| 409 | if (use_deferred) |
| 410 | { |
| 411 | update_render_pass_nerf_baseline(); |
| 412 | } |
| 413 | else |
| 414 | { |
| 415 | update_render_pass_nerf_forward(); |
| 416 | } |
| 417 | |
| 418 | setup_nerf_framebuffer_baseline(); |
| 419 | // Because we have our own customized render pass, the UI render pass need to be updated with load on load so it won't |
| 420 | // clear out the written color attachment |
| 421 | update_render_pass_flags(RenderPassCreateFlags::ColorAttachmentLoad); |
| 422 | |
| 423 | camera.type = vkb::CameraType::LookAt; |
| 424 | camera_pos.y = -camera_pos.y; // flip y to keep consistency of the init pos between rayquery and rasterization |
| 425 | camera.set_position(camera_pos); |
| 426 | camera_set_look_at(camera, glm::vec3(0.0f), glm::vec3(0.0f, 1.0f, 0.0f)); |
| 427 | |
| 428 | camera.set_perspective(60.0f, static_cast<float>(width) / static_cast<float>(height), 0.01f, 256.0f); |
| 429 | |
| 430 | int models_entry = 0; |
| 431 | |
| 432 | for (int model_index = 0; model_index < model_path.size(); model_index++) |
| 433 | { |
| 434 | int num_sub_model = models[models_entry].sub_model_num; |
| 435 | |
| 436 | for (int sub_model_index = 0; sub_model_index < num_sub_model; sub_model_index++) |
| 437 | { |
| 438 | load_scene(model_index, sub_model_index, models_entry); |
| 439 | create_texture(model_index, sub_model_index, models_entry); |
| 440 | create_static_object_buffers(model_index, sub_model_index, models_entry); |
nothing calls this directly
no test coverage detected