Exemplo n.º 1
0
void SGNode::render(const G3MRenderContext* rc,
                    const GLState& parentState,
                    bool renderNotReadyShapes) {
  const GLState* myState = createState(rc, parentState);
  const GLState* state;
  if (myState == NULL) {
    state = &parentState;
  }
  else {
    state = myState;
  }

  prepareRender(rc);

  rawRender(rc, *state);

  const int childrenCount = _children.size();
  for (int i = 0; i < childrenCount; i++) {
    SGNode* child = _children[i];
    child->render(rc, *state, renderNotReadyShapes);
  }

  cleanUpRender(rc);
  
  delete myState;
}
Exemplo n.º 2
0
void Tile::render(const G3MRenderContext* rc,
                  const TileRenderContext* trc,
                  const GLState& parentState,
                  std::list<Tile*>* toVisitInNextIteration,
                  const Planet* planet,
                  const Vector3D& cameraNormalizedPosition,
                  double cameraAngle2HorizonInRadians,
                  const Frustum* cameraFrustumInModelCoordinates) {

  const float verticalExaggeration =  trc->getVerticalExaggeration();
  if (verticalExaggeration != _verticalExaggeration) {
    // TODO: verticalExaggeration changed, invalidate tileExtent, Mesh, etc.

    _verticalExaggeration = trc->getVerticalExaggeration();
  }

  TilesStatistics* statistics = trc->getStatistics();
  statistics->computeTileProcessed(this);

  if (isVisible(rc, trc, planet,
                cameraNormalizedPosition,
                cameraAngle2HorizonInRadians,
                cameraFrustumInModelCoordinates)) {
    setIsVisible(true, trc->getTexturizer());

    statistics->computeVisibleTile(this);

    const bool isRawRender = (
                              (toVisitInNextIteration == NULL) ||
                              meetsRenderCriteria(rc, trc)     ||
                              (trc->getParameters()->_incrementalTileQuality && !_textureSolved)
                              );

    if (isRawRender) {
      rawRender(rc, trc, parentState);
      if (trc->getParameters()->_renderDebug) {
        debugRender(rc, trc, parentState);
      }

      statistics->computeTileRendered(this);

      prune(trc->getTexturizer(),
            trc->getElevationDataProvider());
      //TODO: AVISAR CAMBIO DE TERRENO
    }
    else {
      const Geodetic2D lower = _sector._lower;
      const Geodetic2D upper = _sector._upper;

      const Angle splitLongitude = Angle::midAngle(lower._longitude,
                                                   upper._longitude);

      const Angle splitLatitude = trc->getLayerTilesRenderParameters()->_mercator
      /*                               */ ? MercatorUtils::calculateSplitLatitude(lower._latitude,
                                                                                  upper._latitude)
      /*                               */ : Angle::midAngle(lower._latitude,
                                                            upper._latitude);

      std::vector<Tile*>* subTiles = getSubTiles(splitLatitude, splitLongitude);
      if (_justCreatedSubtiles) {
        trc->getLastSplitTimer()->start();
        statistics->computeSplitInFrame();
        _justCreatedSubtiles = false;
      }

      const int subTilesSize = subTiles->size();
      for (int i = 0; i < subTilesSize; i++) {
        Tile* subTile = subTiles->at(i);
        toVisitInNextIteration->push_back(subTile);
      }
    }
  }
  else {
    setIsVisible(false, trc->getTexturizer());

    prune(trc->getTexturizer(),
          trc->getElevationDataProvider());
    //TODO: AVISAR CAMBIO DE TERRENO
  }
}
Exemplo n.º 3
0
 void render(const G3MRenderContext* rc,
             const GLState* parentGLState) const {
   if (_enable) {
     rawRender(rc, parentGLState);
   }
 }
Exemplo n.º 4
0
void AbstractMesh::rawRender(const G3MRenderContext* rc,
                             const GLState* parentGLState) const{
  _glState->setParent(parentGLState);
  rawRender(rc);
}