// Remove the quads out of view and create new's in the finish tunnel
void Game::rebuildMap() const{

	int lastInvalid = 0;
	for (int i=0; i<sA; i++){
		if((objCamera.mPos.z) < buffer[i].z){
			lastInvalid = i;
		}
		else{
			if (lastInvalid > 0)
				break;
		}
	}

	if (lastInvalid > 0){
		int c = 0;
		for (int i=lastInvalid; i<sA; i++){
		
			buffer[c] = buffer[i];
			color[c] = color[i];
			c++;
		}

		for (int i=c; i<sA; i++){
			generateRing(i);
		}
	}
}
Beispiel #2
0
SpiralIterator::SpiralIterator(const grid_map::GridMap& gridMap, const Eigen::Vector2d& center,
                               const double radius)
    : center_(center),
      radius_(radius),
      distance_(0)
{
  radiusSquare_ = radius_ * radius_;
  mapLength_ = gridMap.getLength();
  mapPosition_ = gridMap.getPosition();
  resolution_ = gridMap.getResolution();
  bufferSize_ = gridMap.getSize();
  gridMap.getIndex(center_, indexCenter_);
  nRings_ = std::ceil(radius_ / resolution_);
  if (checkIfIndexWithinRange(indexCenter_, bufferSize_)) pointsRing_.push_back(indexCenter_);
  else generateRing();
}
Beispiel #3
0
SpiralIterator& SpiralIterator::operator ++()
{
  pointsRing_.pop_back();
  if (pointsRing_.empty() && !isPastEnd()) generateRing();
  return *this;
}
void Game::generateMap()  const{

	for (int i=0; i<sA; i++){
		generateRing(i);
	}
}