Ejemplo n.º 1
0
///// zoomFit /////////////////////////////////////////////////////////////////
void GLView::zoomFit(const bool update)
/// Calculates zPos so that the scene fits in the current window
/// It uses the result of boundingSphereRadius, a pure virtual
{
  ///// determine the radius of the bounding sphere
  maxRadius = boundingSphereRadius();
  ///// calculate the camera position
  if(baseParameters.perspectiveProjection)
  {
    if(width() > height())
      zPos = maxRadius/tan(fieldOfView)/1.5f;
    else
      zPos = maxRadius/tan(fieldOfView)/1.5f * static_cast<float>(height())/static_cast<float>(width());
    if(zPos < 0.1f)
      zPos = 0.1f;
  }
  else
  {
    zPos = 1.0f;
    resizeGL(width(), height());
  }

  ///// update the scene
  updateFog(maxRadius);
  if(update)
    updateGL();
  setModified();
}
Ejemplo n.º 2
0
void State::updateAll(void)
{
	updateMatrices();
	updateMaterial();
	updateLight();
	updateTexture();
	updateFog();
}