void ossimQuadTreeWarp::updateLockFlag(ossimQuadTreeWarpVertex* v)
{
   std::vector<ossimQuadTreeWarpNode*> nodeList;
   
   findAllNodes(nodeList,
                v->getPosition());

   if(nodeList.size() != v->theSharedNodeList.size())
   {
      if(isOnEdge(theTree, v->getPosition()))
      {
         v->theLockedFlag = false;
      }
      else
      {
         v->theLockedFlag = true;
      }
   }
   else
   {
      v->theLockedFlag = false;
   }

   // if the original was not locked
   // then we need to make sure we change the delta
   // along the locked edge so to produce no artifacts
   //
   if(v->theLockedFlag)
   {
      updateDelta(v);
   }
}
Exemple #2
0
SimpleCam::SimpleCam(const unsigned int width, const unsigned int height, const float fov, const float nearPlane, const float farPlane)
: m_position(0,0,0)
, m_rotation(0,0,0)
, m_forward(0,0,0)
, m_up(0,0,0)
, m_right(0,0,0)
, m_projMat()
, m_viewMat()
{
	m_projMat = glm::perspective(fov, (float)width / (float)height, nearPlane, farPlane);
	
	// Build initial view matrix.
	updateDelta(glm::value_ptr(m_position), glm::value_ptr(m_rotation));
}
Exemple #3
0
void Core::renderLoop() {
	LOG(info) << "Core_t.renderLoop()";

	while(!quit) {
		updateDelta();
		updateFpsLog();
		updateControls();

		renderer->render();

		SDL_GL_SwapWindow(window);
	} //while

	LOG(info) << "Core_t.renderLoop() done";
}
Exemple #4
0
void updateScene() {	

	// Wait until at least 16ms passed since start of last frame (Effectively caps framerate at ~60fps)
	static DWORD  last_time = 0;
	DWORD  curr_time = timeGetTime();
	//	deltaTimeTime = float (curr_time - last_time);
	float delta = (curr_time - last_time) * 0.1f;
	if (delta > 0.3f){
		delta = 0.3f;
		//	deltaTimeTime = 0.03f;
	}
	last_time = curr_time;
	updateDelta(delta);
	// Draw the next frame
	glutPostRedisplay();
}
Exemple #5
0
/*!

  Track the line in the image I.

  \param I : Image in which the line appears.
*/
void
vpMeLine::track(const vpImage<unsigned char> &I)
{
  vpCDEBUG(1) <<"begin vpMeLine::track()"<<std::endl ;

  //  1. On fait ce qui concerne les droites (peut etre vide)
  {
  }
  //  2. On appelle ce qui n'est pas specifique
  {
    vpMeTracker::track(I) ;
  }

  // 3. On revient aux droites
  {
    // supression des points rejetes par les ME
    suppressPoints() ;
    setExtremities() ;


    // Estimation des parametres de la droite aux moindres carre
    try
    {
      leastSquare() ;
    }
    catch(...)
    {
      vpERROR_TRACE("Error caught") ;
      throw ;
    }


    // recherche de point aux extremite de la droites
    // dans le cas d'un glissement
    seekExtremities(I) ;

    setExtremities() ;
    try
    {
      leastSquare() ;
    }
    catch(...)
    {
      vpERROR_TRACE("Error caught") ;
      throw ;
    }

    // suppression des points rejetes par la regression robuste
    suppressPoints() ;
    setExtremities() ;

    //reechantillonage si necessaire
    reSample(I) ;

    // remet a jour l'angle delta pour chaque  point de la liste

    updateDelta() ;

    // Remise a jour de delta dans la liste de site me
    if (vpDEBUG_ENABLE(2))
    {
      display(I,vpColor::red) ;
      vpMeTracker::display(I) ;
      vpDisplay::flush(I) ;
    }


  }

  computeRhoTheta(I) ;

  vpCDEBUG(1) <<"end vpMeLine::track()"<<std::endl ;
}
Exemple #6
0
int Sci1SongIterator::nextCommand(byte *buf, int *result) {

	if (!_initialised) {
		//printf("[iterator] DEBUG: Initialising for %d\n", _deviceId);
		_initialised = true;
		if (initSong())
			return SI_FINISHED;
	}


	if (_delayRemaining) {
		int delay = _delayRemaining;
		_delayRemaining = 0;
		return delay;
	}

	int retval = 0;
	do {	 /* All delays must be processed separately */
		int chan = getCommandIndex();

		if (chan == COMMAND_INDEX_NONE) {
			return SI_FINISHED;
		}

		if (chan == COMMAND_INDEX_PCM) {

			if (_samples.begin()->announced) {
				/* Already announced; let's discard it */
				Audio::AudioStream *feed = getAudioStream();
				delete feed;
			} else {
				int delay = _samples.begin()->delta;

				if (delay) {
					updateDelta(delay);
					return delay;
				}
				/* otherwise we're touching a PCM */
				_samples.begin()->announced = true;
				return SI_PCM;
			}
		} else { /* Not a PCM */

			retval = processMidi(buf, result,
			                     &(_channels[chan]),
			                     PARSE_FLAG_LOOPS_UNLIMITED);

			if (retval == SI_LOOP) {
				_numLoopedChannels++;
				_channels[chan].state = SI_STATE_PENDING;
				_channels[chan].delay = 0;

				if (_numLoopedChannels == _numActiveChannels) {
					int i;

					/* Everyone's ready: Let's loop */
					for (i = 0; i < _numChannels; i++)
						if (_channels[i].state == SI_STATE_PENDING)
							_channels[i].state = SI_STATE_DELTA_TIME;

					_numLoopedChannels = 0;
					return SI_LOOP;
				}
			} else if (retval == SI_FINISHED) {
#ifdef DEBUG
				fprintf(stderr, "FINISHED some channel\n");
#endif
			} else if (retval > 0) {
				int sd ;
				sd = getSmallestDelta();

				if (noDeltaTime() && sd) {
					/* No other channel is ready */
					updateDelta(sd);

					/* Only from here do we return delta times */
					return sd;
				}
			}

		} /* Not a PCM */

	} while (retval > 0);

	return retval;
}