| 453 | void AfterDrawInstancesImpl(); |
| 454 | |
| 455 | void EnvObject::DrawInstances(EnvObject** instance_array, int num_instances, const mat4& proj_view_matrix, const mat4& prev_proj_view_matrix, const std::vector<mat4>* shadow_matrix, const vec3& cam_pos, Object::DrawType type) { |
| 456 | if (g_debug_runtime_disable_env_object_draw_instances) { |
| 457 | return; |
| 458 | } |
| 459 | |
| 460 | if (g_debug_runtime_disable_env_object_draw_instances_transparent && transparent) { |
| 461 | return; |
| 462 | } |
| 463 | |
| 464 | if (type == Object::DrawType::kDrawDepthOnly && transparent) { |
| 465 | return; |
| 466 | } |
| 467 | |
| 468 | PROFILER_GPU_ZONE(g_profiler_ctx, "EnvObject::DrawInstances"); |
| 469 | |
| 470 | if (g_draw_collision) { |
| 471 | if (GetCollisionModelID() == -1 || ofr->no_collision) { |
| 472 | return; |
| 473 | } |
| 474 | } |
| 475 | PROFILER_ENTER(g_profiler_ctx, "Setup"); |
| 476 | |
| 477 | // Tessellation is ignored when preloading shaders right now because the use-case isn't obvious. |
| 478 | // Is it set once? Is it per-object? Where would it be set? |
| 479 | bool use_tesselation = false; // GLEW_ARB_tessellation_shader; |
| 480 | Shaders* shaders = Shaders::Instance(); |
| 481 | Models* models = Models::Instance(); |
| 482 | Graphics* graphics = Graphics::Instance(); |
| 483 | Textures* textures = Textures::Instance(); |
| 484 | Timer* timer = &game_timer; |
| 485 | Model* model = &models->GetModel(model_id_); |
| 486 | if (g_draw_collision) { |
| 487 | model = &models->GetModel(GetCollisionModelID()); |
| 488 | } |
| 489 | Camera* cam = ActiveCameras::Get(); |
| 490 | |
| 491 | PROFILER_ENTER(g_profiler_ctx, "GL State"); |
| 492 | GLState gl_state; |
| 493 | gl_state.cull_face = !ofr->double_sided; |
| 494 | ; |
| 495 | gl_state.depth_test = true; |
| 496 | if (type == Object::kDecal) { |
| 497 | gl_state.blend = true; |
| 498 | gl_state.depth_write = false; |
| 499 | } else if (transparent) { |
| 500 | gl_state.blend = false; |
| 501 | gl_state.depth_write = false; |
| 502 | if (g_simple_water) { |
| 503 | gl_state.depth_write = true; |
| 504 | } |
| 505 | } else { |
| 506 | gl_state.blend = false; |
| 507 | gl_state.depth_write = true; |
| 508 | } |
| 509 | graphics->setGLState(gl_state); |
| 510 | |
| 511 | if (graphics->use_sample_alpha_to_coverage) { |
| 512 | bool enable_alpha_to_coverage = !transparent; |
no test coverage detected