Code Monkey home page Code Monkey logo

Comments (2)

omegaiota avatar omegaiota commented on July 21, 2024

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:

  • At line 65 insert spacePressed = true; (opengl detects space key pressed at current render loop iteration)
  • Change the control logic at L80:
    currentFrame = spacePressed ? std::min(currentFrame+1, N-1) : currentFrame;
  • Recompile the cpp code from the build folder with make

This should do the job.

from diffcloth.

sihengz02 avatar sihengz02 commented on July 21, 2024

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!

from diffcloth.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.