void Genetic_AlgorithmApp::updateIHM() { if (m_ihmStats->isVisible()) { m_ihmStats->clear(); m_ihmStats->addText(std::string("FPS :") + std::to_string(getAverageFps())); if (m_isStarted && !m_isPaused) { m_ihmStats->addText("Start"); m_ihmStats->addText("Algo FPS : " + std::to_string(m_computeFPS)); m_ihmStats->addText("Compute Height FPS : " + std::to_string(m_computeHeightFPS)); } else if (m_isPaused) { m_ihmStats->addText("Pause"); } else { m_ihmStats->addText("Stop"); } } m_ihmParam->draw(); }
void fsExperiments::update() { GlobalData& data = GlobalData::get(); data.mHeadRotation = data.mFaceShift.getRotation(); data.mLeftEyeRotation = data.mFaceShift.getLeftEyeRotation(); data.mRightEyeRotation = data.mFaceShift.getRightEyeRotation(); data.mLeftEyeRef->setOrientation( data.mLeftEyeRotation ); data.mRightEyeRef->setOrientation( data.mRightEyeRotation ); mEffects[ mCurrentEffect ]->update(); mFps = getAverageFps(); }
void SimpleParticlesApp::update() { mFps = getAverageFps(); mEmitterController.getForceRef( mForceRepulsionId )->mMagnitude = GlobalSettings::get().mEmitterRepulsion; mEmitterController.update(); /* if ( mTorrentRef ) { for ( auto peer: mTorrentRef->getPeers() ) { std::static_pointer_cast< PeerCircle >( peer )->update(); } } */ }
void GesturesDemo::update() { field.SetTime(ci::app::getElapsedSeconds()); field.UpdatePerformanceInfo(getAverageFps(), getFrameRate()); processGestures(); field.SetWindowSize(getWindowWidth(), getWindowHeight()); field.Update(); if (mouseIsDown) { ci::Vec2i cur = getMousePos(); ci::Vec3f diff(cur[0]-static_cast<float>(lastMousePos[0]), cur[1]-static_cast<float>(lastMousePos[1]), 0.0f); diff[0] /= static_cast<float>(getWindowWidth()); diff[1] /= static_cast<float>(getWindowHeight()); field.Translate(0, diff); lastMousePos = cur; } else { ci::Vec3f diff(0, 0, 0); field.Translate(0, diff); } }
void ReymentaHapPlayerApp::update() { getWindow()->setTitle("(" + toString(floor(getAverageFps())) + " fps) Reymenta Hap" + toString(mLoopVideo)); }
void ReymentaServerApp::update() { if (mFirstLaunch) { CI_LOG_V("update begin"); CI_LOG_V(getElapsedFrames()); } mParameterBag->iFps = getAverageFps(); mParameterBag->sFps = toString(floor(mParameterBag->iFps)); getWindow()->setTitle("(" + mParameterBag->sFps + " fps) Server"); if (mParameterBag->iGreyScale) { mParameterBag->controlValues[1] = mParameterBag->controlValues[2] = mParameterBag->controlValues[3]; mParameterBag->controlValues[5] = mParameterBag->controlValues[6] = mParameterBag->controlValues[7]; } mParameterBag->iChannelTime[0] = getElapsedSeconds(); mParameterBag->iChannelTime[1] = getElapsedSeconds() - 1; mParameterBag->iChannelTime[3] = getElapsedSeconds() - 2; mParameterBag->iChannelTime[4] = getElapsedSeconds() - 3; // if (mParameterBag->mUseTimeWithTempo) { mParameterBag->iGlobalTime = mParameterBag->iTempoTime*mParameterBag->iTimeFactor; } else { mParameterBag->iGlobalTime = getElapsedSeconds(); } mParameterBag->iGlobalTime *= mParameterBag->iSpeedMultiplier; if (ui::GetDrawData() != NULL) { if (mBatchass->isRemoteClientActive()) { // Count int cmd_count = 0; int vtx_count = 0; for (int n = 0; n < ui::GetDrawData()->CmdListsCount; n++) { const ImDrawList * cmd_list = ui::GetDrawData()->CmdLists[n]; const ImDrawVert * vtx_src = cmd_list->VtxBuffer.begin(); cmd_count += cmd_list->CmdBuffer.size(); vtx_count += cmd_list->VtxBuffer.size(); } // Send static int sendframe = 0; if (sendframe++ >= 240) // every 2 frames, @TWEAK { sendframe = 0; if (cmd_count > 0 || vtx_count > 0) { mBatchass->preparePacketFrame(cmd_count, vtx_count); // Add all drawcmds Cmd cmd; for (int n = 0; n < ui::GetDrawData()->CmdListsCount; n++) { const ImDrawList* cmd_list = ui::GetDrawData()->CmdLists[n]; const ImDrawCmd* pcmd_end = cmd_list->CmdBuffer.end(); for (const ImDrawCmd* pcmd = cmd_list->CmdBuffer.begin(); pcmd != pcmd_end; pcmd++) { cmd.Set(*pcmd); mBatchass->Write(cmd); } } // Add all vtx Vtx vtx; for (int n = 0; n < ui::GetDrawData()->CmdListsCount; n++) { const ImDrawList* cmd_list = ui::GetDrawData()->CmdLists[n]; const ImDrawVert* vtx_src = cmd_list->VtxBuffer.begin(); int vtx_remaining = cmd_list->VtxBuffer.size(); while (vtx_remaining-- > 0) { vtx.Set(*vtx_src++); mBatchass->Write(vtx); } } // Send mBatchass->SendPacket(); } } } ImGuiIO& io = ImGui::GetIO(); // Setup resolution (every frame to accommodate for window resizing) int w, h; int display_w, display_h; // Setup time step static double time = 0.0f; const double current_time = getElapsedSeconds(); io.DeltaTime = (float)(current_time - time); time = current_time; } // @RemoteImgui begin /*ImGui::RemoteUpdate(); ImGui::RemoteInput input; if (ImGui::RemoteGetInput(input)) { ImGuiIO& io = ImGui::GetIO(); for (int i = 0; i < 256; i++) io.KeysDown[i] = input.KeysDown[i]; io.KeyCtrl = input.KeyCtrl; io.KeyShift = input.KeyShift; io.MousePos = input.MousePos; io.MouseDown[0] = (input.MouseButtons & 1); io.MouseDown[1] = (input.MouseButtons & 2) != 0; io.MouseWheel = (float)input.MouseWheel; } else*/ // @RemoteImgui end { // Setup inputs // (we already got mouse wheel, keyboard keys & characters from glfw callbacks polled in glfwPollEvents()) //double mouse_x, mouse_y; //glfwGetCursorPos(window, &mouse_x, &mouse_y); //mouse_x *= (float)display_w / w; // Convert mouse coordinates to pixels //mouse_y *= (float)display_h / h; //io.MousePos = ImVec2((float)mouse_x, (float)mouse_y); // Mouse position, in pixels (set to -1,-1 if no mouse / on another screen, etc.) //io.MouseDown[0] = mousePressed[0] || glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_LEFT) != 0; // If a mouse press event came, always pass it as "mouse held this frame", so we don't miss click-release events that are shorter than 1 frame. //io.MouseDown[1] = mousePressed[1] || glfwGetMouseButton(window, GLFW_MOUSE_BUTTON_RIGHT) != 0; } mBatchass->update(); mProg->uniform("iGlobalTime", static_cast<float>(getElapsedSeconds())); //mProg->uniform("iMouse", mMouseCoord); //mProg->uniform("iChannel0", 0); if (mFirstLaunch) { CI_LOG_V("update end"); } }