MCPcopy Create free account
hub / github.com/PacktPublishing/3D-Graphics-Rendering-Cookbook / mainLoop

Method mainLoop

shared/vkFramework/VulkanApp.cpp:216–241  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

214}
215
216void VulkanApp::mainLoop()
217{
218 double timeStamp = glfwGetTime();
219 float deltaSeconds = 0.0f;
220
221 do
222 {
223 update(deltaSeconds);
224
225 const double newTimeStamp = glfwGetTime();
226 deltaSeconds = static_cast<float>(newTimeStamp - timeStamp);
227 timeStamp = newTimeStamp;
228
229 fpsCounter_.tick(deltaSeconds);
230
231 bool frameRendered = drawFrame(ctx_.vkDev,
232 [this](uint32_t img) { this->updateBuffers(img); },
233 [this](auto cmd, auto img) { ctx_.composeFrame(cmd, img); }
234 );
235
236 fpsCounter_.tick(deltaSeconds, frameRendered);
237
238 glfwPollEvents();
239
240 } while (!glfwWindowShouldClose(window_));
241}
242
243void CameraApp::handleKey(int key, bool pressed)
244{

Callers 8

mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80
mainFunction · 0.80

Calls 4

tickMethod · 0.80
composeFrameMethod · 0.80
drawFrameFunction · 0.70
updateBuffersMethod · 0.45

Tested by

no test coverage detected