Example #1
0
void TerrainEntity::changed(const Eris::StringSet &s) {
  Eris::StringSet::const_iterator I = s.begin();
  Eris::StringSet::const_iterator Iend = s.end();
  while (I != Iend) {
    if (*I == "terrain") updateTerrain();
    ++I;
  }
} 
Example #2
0
//--------------------------------------------------------------------
// animate the view
BOOL Landscape::appViewAnimate(
  double now,                       // current time (ms)
  double since)                     // milliseconds since last pass
{
  // construct eye matrix
  m_eyeMatrix.loadIdentity();
  if (m_mapView)
  {
    m_eyeMatrix.rotateZDeg(m_eyeRotZ);
    m_eyeMatrix.rotateYDeg(m_eyeRotY);
  }
  else
  {
    m_eyeMatrix.rotateZDeg(m_eyeRotZ);
    m_eyeMatrix.rotateYDeg(m_eyeRotY);
    m_eyeMatrix.rotateXDeg(m_eyeRotX);
  }

  // update position
  BOOL changed = updateMovement(now, since);

  // update vertical position of eye based on landscape
  if (changed)
  {
    double ht = Terrain::heightAtPt(m_eyePt.x, m_eyePt.z);
    ht = max(ht, WATER_LEVEL);

    m_eyePt.y = max(m_eyePt.y, ht + MIN_HEIGHT);
  }

  // mark changed if mouse moved
  changed |= m_eyeChanged;
  m_eyeChanged = false;

  // animate the sky
  changed |= m_sky->animate(now, since);

  // update the terrain after movement
  changed |= updateTerrain();

  if (m_ui != NULL)
    changed |= m_ui->animate(now, since);

  return changed;
}