MCPcopy Create free account
hub / github.com/RenderKit/embree / displayFunc

Method displayFunc

tutorials/common/tutorial/tutorial.cpp:881–985  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

879 }
880
881 void TutorialApplication::displayFunc()
882 {
883 double t0 = getSeconds();
884 const float time = g_motion_blur ? float(t0-time0) : (animate ? 0.5 * sinf(fabsf(float(t0-time0))) + 0.5 : render_time);
885
886 /* update camera */
887 camera.move(moveDelta.x*speed, moveDelta.y*speed, moveDelta.z*speed);
888
889 /* update animated camera */
890 if (animated_camera)
891 camera = Camera(animated_camera->get(time),camera.handedness);
892
893 ISPCCamera ispccamera = camera.getISPCCamera(width,height);
894 if (print_camera)
895 std::cout << camera.str() << std::endl;
896
897 /* render image using ISPC */
898 initRayStats();
899 render(pixels,width,height,time,ispccamera);
900 double dt0 = getSeconds()-t0;
901 if (ispccamera.render_time != 0.0) dt0 = ispccamera.render_time;
902 avg_render_time.add(dt0);
903 double mrayps = double(getNumRays())/(1000000.0*dt0);
904 avg_mrayps.add(mrayps);
905
906 /* draw pixels to screen */
907 glRasterPos2i(-1,1);
908 glPixelZoom(1.0f,-1.0f);
909 glDrawPixels(width,height,GL_RGBA,GL_UNSIGNED_BYTE,pixels);
910
911 // Start the Dear ImGui frame
912 ImGui_ImplOpenGL2_NewFrame();
913 ImGui_ImplGlfw_NewFrame();
914 ImGui::NewFrame();
915
916 ImGuiWindowFlags window_flags = 0;
917 window_flags |= ImGuiWindowFlags_NoTitleBar;
918 //window_flags |= ImGuiWindowFlags_NoScrollbar;
919 //window_flags |= ImGuiWindowFlags_MenuBar;
920 //window_flags |= ImGuiWindowFlags_NoMove;
921 //window_flags |= ImGuiWindowFlags_NoResize;
922 //window_flags |= ImGuiWindowFlags_NoCollapse;
923 //window_flags |= ImGuiWindowFlags_NoNav;
924
925 //ImGui::GetStyle().WindowBorderSize = 0.0f;
926 //ImGui::SetNextWindowPos(ImVec2(width-200,0));
927 //ImGui::SetNextWindowSize(ImVec2(200,height));
928 ImGui::SetNextWindowBgAlpha(0.3f);
929 ImGui::Begin("Embree", nullptr, window_flags);
930 drawGUI();
931
932 double render_dt = avg_render_time.get();
933 double render_fps = render_dt != 0.0 ? 1.0f/render_dt : 0.0;
934 ImGui::Text("Render: %3.2f fps",render_fps);
935
936 double total_dt = avg_frame_time.get();
937 double total_fps = total_dt != 0.0 ? 1.0f/total_dt : 0.0;
938 ImGui::Text("Total: %3.2f fps",total_fps);

Callers 1

displayFuncFunction · 0.80

Calls 11

getSecondsFunction · 0.85
CameraClass · 0.85
renderFunction · 0.85
ImGui_ImplGlfw_NewFrameFunction · 0.85
moveMethod · 0.80
getISPCCameraMethod · 0.80
getMethod · 0.45
strMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected