void
SimInterior::RenderImage::render( TSRenderContext &rc )
{
   //
   ITRMetrics.render.reset();
   ITRMetrics.numRenderedInteriors++;
   rc.getCamera()->pushTransform(transform);
   
   // Select the detail level we will be drawing at.  This is a function of the
   //  bounding box for the highest level of detail, and the radius of the minimum
   //  level in the current state.
   //  - If camera is inside object's bounding box, draw highest detail level.
   //  - else check the projected radius of the lowest level of detail...
   //
   Point3F cameraCoord = rc.getCamera()->getCC();
   Box3F   bbox        = instance->getHighestBoundingBox();

   // We only set the detail by the pixels iff we're outside the interior, it's
   //  not a linked interior, and we're not rendering it through a link.  Otherwise,
   //  the highest detail is drawn...
   //
   if (bbox.contains(cameraCoord) == false) {
      float projPixels = rc.getCamera()->
         transformProjectRadius(instance->getLowestCenterPt(),
            instance->getLowestRadius());
		projPixels *= 2.0f * rc.getCamera()->getPixelScale();
      instance->setDetailByPixels(projPixels);
   } else {
      // If we're inside or rendering through a link,
      //  we draw at the highest detail level...
      //
      instance->setDetailLevel(0);
   }

   rend.render(rc, instance);

   // Draw the bounding box if the flag is set...
   //
   if (g_drawSimInteriorBBox == true) {
      TS::PointArray* pArray = rc.getPointArray();
      Point3F bboxPts[8];
      bboxPts[0].set(bbox.fMin.x, bbox.fMin.y, bbox.fMin.z);
      bboxPts[1].set(bbox.fMin.x, bbox.fMax.y, bbox.fMin.z);
      bboxPts[2].set(bbox.fMin.x, bbox.fMax.y, bbox.fMax.z);
      bboxPts[3].set(bbox.fMin.x, bbox.fMin.y, bbox.fMax.z);
      bboxPts[4].set(bbox.fMax.x, bbox.fMin.y, bbox.fMin.z);
      bboxPts[5].set(bbox.fMax.x, bbox.fMax.y, bbox.fMin.z);
      bboxPts[6].set(bbox.fMax.x, bbox.fMax.y, bbox.fMax.z);
      bboxPts[7].set(bbox.fMax.x, bbox.fMin.y, bbox.fMax.z);
      
      int start = pArray->addPoints(8, bboxPts);
      
      pArray->drawLine(start + 0, start + 1, 253);
      pArray->drawLine(start + 1, start + 2, 253);
      pArray->drawLine(start + 2, start + 3, 253);
      pArray->drawLine(start + 3, start + 0, 253);
      pArray->drawLine(start + 4, start + 5, 253);
      pArray->drawLine(start + 5, start + 6, 253);
      pArray->drawLine(start + 6, start + 7, 253);
      pArray->drawLine(start + 7, start + 4, 253);
      pArray->drawLine(start + 0, start + 4, 253);
      pArray->drawLine(start + 1, start + 5, 253);
      pArray->drawLine(start + 2, start + 6, 253);
      pArray->drawLine(start + 3, start + 7, 253);
   }

   rc.getCamera()->popTransform();
}