コード例 #1
0
//-----------------------------------------------------------------------------
void SceneManagerPortals::extractVisibleActors(ActorCollection& list, const Camera* camera)
{
  if (cullingEnabled())
  {
    Sector* start = computeStartingSector(camera);
    if (!start)
      extractActors(list);
    else
    {
      ++mVisitTick;
      mTempActors.clear();
      mFrustumStack.clear();

      mFrustumStack.push_back(camera->frustum());
      start->executeCallbacks(camera,this,NULL);
      visitSector(NULL, start, camera->modelingMatrix().getT(), camera);

      // remove duplicates
      std::sort(mTempActors.begin(), mTempActors.end());
      std::vector< ref<Actor> >::iterator new_end = std::unique(mTempActors.begin(), mTempActors.end());
      for(std::vector< ref<Actor> >::iterator it = mTempActors.begin(); it != new_end; ++it)
        list.push_back(it->get());
    }
  }
  else
    extractActors(list);
}
コード例 #2
0
//-----------------------------------------------------------------------------
void SceneManagerPortals::extractVisibleActors(ActorCollection& list, const Camera* camera)
{
  if (cullingEnabled())
  {
    Sector* start = computeStartingSector(camera);
    if (!start)
      extractActors(list);
    else
    {
      ++mVisitTick;
      mTempActors.clear();
      mFrustumStack.clear();

      mFrustumStack.push_back(camera->frustum());
      start->executeCallbacks(camera,this,NULL);
      visitSector(NULL, start, camera->modelingMatrix().getT(), camera);

      // insert portal actors
      if (showPortals())
      {
        for(std::map<Portal*, ref<Actor> >::const_iterator it = mPortalActorMap.begin(); it != mPortalActorMap.end(); ++it)
          mTempActors.push_back(it->second);
      }

      // mic fixme: isn't quicker to use sets instead of sort()+unique()?
      // avoid reporting duplicates
      std::sort(mTempActors.begin(), mTempActors.end());
      std::vector< ref<Actor> >::iterator new_end = std::unique(mTempActors.begin(), mTempActors.end());
      for(std::vector< ref<Actor> >::iterator it = mTempActors.begin(); it != new_end; ++it)
        list.push_back(it->get());
    }
  }
  else
    extractActors(list);
}
//-----------------------------------------------------------------------------
void ActorTreeAbstract::extractActors(ActorCollection& list)
{
  for(int i=0; i<actors()->size(); ++i)
    list.push_back(actors()->at(i));
  for(int i=0; i<childrenCount(); ++i)
    if (child(i))
      child(i)->extractActors(list);
}
 virtual void extractActors(ActorCollection& queue)
 {
   int actor_rank = mActorRenderRankStart;
   for(int i=0; i<vectorGraphicObjects()->size(); ++i)
   {
     for(int j=0; j<vectorGraphicObjects()->at(i)->actors()->size(); ++j)
     {
       vectorGraphicObjects()->at(i)->actors()->at(j)->setRenderRank( actor_rank++ );
       queue.push_back( vectorGraphicObjects()->at(i)->actors()->at(j) );
     }
   }
 }
//-----------------------------------------------------------------------------
void ActorTreeAbstract::extractVisibleActors(ActorCollection& list, const Camera* camera, unsigned enable_mask)
{
  // try to cull the whole node
  if ( !camera->frustum().cull(aabb()) )
  {
    // cull Actor by Actor
    for(int i=0; i<actors()->size(); ++i)
    {
      if (enable_mask & actors()->at(i)->enableMask())
      {
        VL_CHECK(actors()->at(i)->lod(0))
        actors()->at(i)->computeBounds();
        if ( !camera->frustum().cull( actors()->at(i)->boundingSphere() ) )
          list.push_back(actors()->at(i));
      }
    }
    for(int i=0; i<childrenCount(); ++i)
      if (child(i))
        child(i)->extractVisibleActors(list, camera);
  }
}
コード例 #6
0
//-----------------------------------------------------------------------------
void SceneManagerPortals::extractActors(ActorCollection& list)
{
  for(unsigned i=0; i<mSectors.size(); ++i)
    for(int j=0; j<mSectors[i]->actors()->size(); ++j)
      list.push_back( mSectors[i]->actors()->at(j) );
}