示例#1
0
  void preRenderTargetUpdate(const RenderTargetEvent& evt)
  {
    // Hide plane and objects below the water
    pPlaneEnt->setVisible(false);
    std::vector<Entity*>::iterator i, iend;
    iend = belowWaterEnts.end();
    for (i = belowWaterEnts.begin(); i != iend; ++i) {
      (*i)->setVisible(false);
    }
    theCam->enableReflection(reflectionPlane);

  }
示例#2
0
void ReflectionTextureListener::preRenderTargetUpdate(const RenderTargetEvent& evt)
{
    // Hide plane and objects below the water
    mWater->setVisible(false);


	/*list<Ogre::Entity*> entList = Level::getSingleton()->getEntityList();
	list<Ogre::Entity*>::iterator it;
	for (it = entList.begin();it != entList.end();it++){
		if ((*it)->isVisible()){
			Ogre::AxisAlignedBox box = (*it)->getWorldBoundingBox();
			if (box.getMinimum().y < mWater->getSceneNode()->_getDerivedPosition().y){
				(*it)->setVisible(false);
				belowWaterEnts.push_back((*it));
			}
		}
	}*/

    /*std::vector<Entity*>::iterator i, iend;
    iend = belowWaterEnts.end();
    for (i = belowWaterEnts.begin(); i != iend; ++i)
    {
        (*i)->setVisible(false);
    }*/

	Ogre::SceneManager::MovableObjectIterator it = Level::getSingleton()->getSceneManager()->getMovableObjectIterator("Entity");
	while(it.hasMoreElements()){
		Ogre::MovableObject *m = it.getNext();	
		if (m->isVisible() && m->getParentSceneNode()->_getDerivedPosition().y < mWater->getSceneNode()->_getDerivedPosition().y){
			m->setVisible(false);
			belowWaterEnts.push_back(m);
		}
	}


	Ogre::Camera* cam = Level::getSingleton()->getCurrentSegment()->getActiveCamera()->getCamera();
	cam->enableReflection(mWater->getReflectionPlane());

}