Closed sihengz02 closed 1 year ago
One possible way to do this is changing the renderloop::renderRecordsForSystem()
function in src/code/engine/RenderLoop.cpp
at around L14. This is the function that is called by the visualization bash command. The render loop at around line 56 is the control logic for rendering the frames from the loaded folder.
L80 currentFrame = std::min(currentFrame+1, N-1);
is selecting the frame to play from the folder. And currently it automatically goes to the next frame in the new iteration of the loop with currentFrame+1
, and you want to change this so that currentFrame only +1
when the space key is pressed.
To do this:
spacePressed = true;
(opengl detects space key pressed at current render loop iteration)currentFrame = spacePressed ? std::min(currentFrame+1, N-1) : currentFrame;
build
folder with make
This should do the job.
Thanks for your timely answer and explanation for the control logic.
I think this should also reset spacePressed = false;
after currentFrame = spacePressed ? std::min(currentFrame+1, N-1) : currentFrame;
to work.
Thanks again!
Hi, Yifei, thanks for your awesome work and the release of the code! I notice that when visualizing my generated
.obj
files by the bash command you provide, the viewer will automatically begin and if and only if I press[space]
, it will stay at the beginning frame. So I'm wondering can I play it frame by frame, such as whenever I press the->
button, it will show next frame; when I do not press any button, the viewer just stay at the current frame, so it's convenient for me to check whether the simulation is within my expectation? Thanks for your reply!