MCPcopy Create free account
hub / github.com/OpenNFS/OpenNFS / DrawUI

Method DrawUI

src/Renderer/Renderer.cpp:405–477  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

403}
404
405void Renderer::DrawUI(ParamData *preferences, glm::vec3 worldPosition) {
406 // Draw Shadow Map
407 ImGui::Begin("Shadow Map");
408 ImGui::Image((ImTextureID) shadowMapRenderer.depthTextureID, ImVec2(256, 256), ImVec2(0, 0), ImVec2(1, -1));
409 ImGui::End();
410 // Draw Logger UI
411 logger->onScreenLog.Draw("ONFS Log");
412 // Draw UI (Tactically)
413 static float f = 0.0f;
414 ImGui::Text("OpenNFS Engine");
415 ImGui::Text("Application average %.3f ms/frame (%.1f FPS)", 1000.0f / ImGui::GetIO().Framerate,
416 ImGui::GetIO().Framerate);
417 ImGui::SliderFloat("Time Scale Factor", &preferences->timeScaleFactor, 0, 10);
418 ImGui::Checkbox("Bullet Debug View", &preferences->physics_debug_view);
419 ImGui::Checkbox("Classic Graphics", &preferences->use_classic_graphics);
420 ImGui::Checkbox("Hermite Curve Cam", &preferences->attach_cam_to_hermite);
421 ImGui::Checkbox("Car Cam", &preferences->attach_cam_to_car);
422 std::stringstream world_position_string;
423 ImGui::Text("X %f Y %f Z %f H: %f V: %f", worldPosition.x, worldPosition.y, worldPosition.z,
424 mainCamera.horizontalAngle, mainCamera.verticalAngle);
425 ImGui::Text("CarCam Yaw: %f Pitch: %f Distance: %f AAC: %f", mainCamera.yaw, mainCamera.pitch,
426 mainCamera.distanceFromCar, mainCamera.angleAroundCar);
427 ImGui::Text("Hermite Roll: %f Time: %f", mainCamera.roll, fmod(totalTime, (mainCamera.loopTime / 200)));
428 ImGui::Text("Block ID: %d", closestBlockID);
429 ImGui::Text("Frustrum Objects: %d", physicsEngine.numObjects);
430 ImGui::Checkbox("Frustum Cull", &preferences->frustum_cull);
431 ImGui::Checkbox("Raycast Viz", &preferences->draw_raycast);
432 ImGui::Checkbox("AI Sim", &preferences->simulate_car);
433 ImGui::Checkbox("Vroad Viz", &preferences->draw_vroad);
434 ImGui::Checkbox("CAN Debug", &preferences->draw_can);
435
436 if (ImGui::Button("Reset View")) {
437 mainCamera.resetView();
438 };
439 ImGui::SameLine(0, -1.0f);
440 if (ImGui::Button("Reset Car to Start")) {
441 ResetToVroad(0, track, car);
442 };
443 ImGui::NewLine();
444 ImGui::SameLine(0, 0.0f);
445 if (!preferences->use_nb_data)
446 ImGui::SliderInt("Draw Dist", &preferences->blockDrawDistance, 0, track->nBlocks);
447 ImGui::Checkbox("NBData", &preferences->use_nb_data);
448 ImGui::NewLine();
449 ImGui::ColorEdit3("Sky Colour", (float *) &preferences->clear_color); // Edit 3 floats representing a color
450 ImGui::ColorEdit3("Sun Atten", (float *) &preferences->sun_attenuation); // Edit 3 floats representing a color
451 //ImGui::SliderFloat3("NFS2 Rot Dbg", (float *) &preferences->nfs2_rotate, -M_PI, M_PI);
452
453 ImGui::SliderFloat("Track Specular Damper", &preferences->trackSpecDamper, 0, 100);
454 ImGui::SliderFloat("Track Specular Reflectivity", &preferences->trackSpecReflectivity, 0, 10);
455
456 if (ImGui::TreeNode("Car Models")) {
457 ImGui::Checkbox(car->car_body_model.m_name.c_str(), &car->car_body_model.enabled);
458 ImGui::Checkbox(car->left_front_wheel_model.m_name.c_str(), &car->left_front_wheel_model.enabled);
459 ImGui::Checkbox(car->left_rear_wheel_model.m_name.c_str(), &car->left_rear_wheel_model.enabled);
460 ImGui::Checkbox(car->right_front_wheel_model.m_name.c_str(), &car->right_front_wheel_model.enabled);
461 ImGui::Checkbox(car->right_rear_wheel_model.m_name.c_str(), &car->right_rear_wheel_model.enabled);
462 ImGui::TreePop();

Callers

nothing calls this directly

Calls 1

resetViewMethod · 0.80

Tested by

no test coverage detected