Switching cells in exterior works

actorid
Jason Hooks 13 years ago
parent ec94ecacaf
commit e1aba44da6

@ -133,9 +133,13 @@ void RenderingManager::waterAdded (MWWorld::Ptr::CellStore *store){
if(store->cell->data.flags & store->cell->HasWater){
if(mWater == 0)
mWater = new MWRender::Water(rend.getCamera(), store->cell);
else
mWater->changeCell(store->cell);
//else
}
else
removeWater();
}

@ -12,9 +12,9 @@ namespace MWRender {
mIsUnderwater = false;
mCamera->addListener(this);
//mCamera->addListener(this);
mWaterPlane = Ogre::Plane(Ogre::Vector3::UNIT_Y, mTop);
mWaterPlane = Ogre::Plane(Ogre::Vector3::UNIT_Y, 0);
Ogre::MeshManager::getSingleton().createPlane("water", Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, mWaterPlane, CELL_SIZE*3 + 10000, CELL_SIZE * 3 + 10000, 10, 10, true, 1, 3,5, Ogre::Vector3::UNIT_Z);
@ -27,6 +27,7 @@ namespace MWRender {
mWaterNode = mSceneManager->getRootSceneNode()->createChildSceneNode();
mWaterNode->setPosition(0, mTop, 0);
if(!(cell->data.flags & cell->Interior))
@ -40,7 +41,7 @@ namespace MWRender {
Water::~Water() {
Ogre::MeshManager::getSingleton().remove("water");
mCamera->removeListener(this);
//mCamera->removeListener(this);
mWaterNode->detachObject(mWater);
mSceneManager->destroyEntity(mWater);
@ -51,6 +52,17 @@ namespace MWRender {
Ogre::CompositorManager::getSingleton().removeCompositorChain(mViewport);
}
void Water::changeCell(const ESM::Cell* cell){
mTop = cell->water;
if(!(cell->data.flags & cell->Interior))
mWaterNode->setPosition(getSceneNodeCoordinates(cell->data.gridX, cell->data.gridY));
else
mWaterNode->setPosition(0, mTop, 0);
}
void Water::preRenderTargetUpdate(const Ogre::RenderTargetEvent& evt) {
mWater->setVisible(false);
@ -106,7 +118,7 @@ namespace MWRender {
void Water::cameraDestroyed(Ogre::Camera *cam) {
}
Ogre::Vector3 Water::getSceneNodeCoordinates(int gridX, int gridY){
Ogre::Vector3 out = Ogre::Vector3(gridX * CELL_SIZE + (CELL_SIZE / 2), 0, -gridY * CELL_SIZE - (CELL_SIZE / 2));
Ogre::Vector3 out = Ogre::Vector3(gridX * CELL_SIZE + (CELL_SIZE / 2), mTop, -gridY * CELL_SIZE - (CELL_SIZE / 2));
return out;
}

@ -40,7 +40,7 @@ namespace MWRender {
~Water();
void checkUnderwater(float y);
void changeCell(float x, float y);
void changeCell(const ESM::Cell* cell);
};

@ -218,7 +218,6 @@ namespace MWWorld
void Scene::changeToInteriorCell (const std::string& cellName, const ESM::Position& position)
{
std::cout << "Changing to interior\n";
mRendering.removeWater();
// remove active
CellStoreCollection::iterator active = mActiveCells.begin();
@ -250,7 +249,6 @@ namespace MWWorld
{
int x = 0;
int y = 0;
mRendering.removeWater();
mWorld->positionToIndex (position.pos[0], position.pos[1], x, y);

Loading…
Cancel
Save