void update2D(int node, int ini, int fin, long long val){ if(ini > f2 || fin < f1)return; if(ini >= f1 && fin <= f2)return update1D(node, 1, 0, m - 1, val, 1); update2D(v1, ini, me, val); update2D(v2, me + 1, fin, val); return update1D(node, 1, 0, m - 1, val, 0); }
void runMainLoop(int val) { double currentTime = glutGet(GLUT_ELAPSED_TIME); nbFrames++; if (currentTime - lastTime >= 1000.0) { // If last prinf() was more than 1 sec ago // printf and reset timer fps = nbFrames * 1000.0 / (currentTime - lastTime); lastTime = currentTime; nbFrames = 0; std::stringstream c; c << "Collision Test FPS: " << fps; glutSetWindowTitle(c.str().c_str()); } //Frame logic if (mode) { update(); render(); } else { update2D(); render2D(); } //Run frame one more time glutTimerFunc(1000 / SCREEN_FPS, runMainLoop, val); }
void StereoConfig::updateComputedState() { // Need to compute all of the following: // - Aspect Ratio // - FOV // - Projection offsets for 3D // - Distortion XCenterOffset // - Update 2D // - Initialize EyeRenderParams // Compute aspect ratio. Stereo mode cuts width in half. Aspect = float(FullView.w) / float(FullView.h); Aspect *= (Mode == Stereo_None) ? 1.0f : 0.5f; Aspect *= AspectMultiplier; updateDistortionOffsetAndScale(); // Compute Vertical FOV based on distance, distortion, etc. // Distance from vertical center to render vertical edge perceived through the lens. // This will be larger then normal screen size due to magnification & distortion. // // This percievedHalfRTDistance equation should hold as long as the render target // and display have the same aspect ratios. What we'd like to know is where the edge // of the render target will on the perceived screen surface. With NO LENS, // the answer would be: // // halfRTDistance = (VScreenSize / 2) * aspect * // DistortionFn_Inverse( DistortionScale / aspect ) // // To model the optical lens we eliminates DistortionFn_Inverse. Aspect ratios // cancel out, so we get: // // halfRTDistance = (VScreenSize / 2) * DistortionScale // if (Mode == Stereo_None) { YFov = DegreeToRad(80.0f); } else { float percievedHalfRTDistance = (HMD.VScreenSize / 2) * Distortion.Scale; YFov = 2.0f * atan(percievedHalfRTDistance/HMD.EyeToScreenDistance); } updateProjectionOffset(); update2D(); updateEyeParams(); DirtyFlag = false; }
void REV_preProcess() { WPAD_ScanPads(); PAD_ScanPads(); keyboardProcess(); //Update time updateTime(); HTCAMERA * htc = mainRoot->fstHTC; for(u8 i = 0; i < 4; i++) { wmData[i] = WPAD_Data(i); } update2D(); while(htc)//Update Head-Tracking cameras's point of view { htc->updateEye(); htc = htc->nextHTC; } }
/* * iterate2D() * * Performs a single cycle of fit improvement with equal x, y width. * */ void iterate2D() { update2D(); calcErr(); }