|
|
|
@ -60,14 +60,14 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b
|
|
|
|
|
MWWorld::Fallback* fallback)
|
|
|
|
|
: mRendering(_rend)
|
|
|
|
|
, mFallback(fallback)
|
|
|
|
|
, mObjects(mRendering)
|
|
|
|
|
, mActors(mRendering, this)
|
|
|
|
|
, mPlayerAnimation(NULL)
|
|
|
|
|
, mAmbientMode(0)
|
|
|
|
|
, mSunEnabled(0)
|
|
|
|
|
, mPhysicsEngine(engine)
|
|
|
|
|
, mTerrain(NULL)
|
|
|
|
|
{
|
|
|
|
|
mActors = new MWRender::Actors(mRendering, this);
|
|
|
|
|
mObjects = new MWRender::Objects(mRendering);
|
|
|
|
|
// select best shader mode
|
|
|
|
|
bool openGL = (Ogre::Root::getSingleton ().getRenderSystem ()->getName().find("OpenGL") != std::string::npos);
|
|
|
|
|
bool glES = (Ogre::Root::getSingleton ().getRenderSystem ()->getName().find("OpenGL ES") != std::string::npos);
|
|
|
|
@ -162,8 +162,8 @@ RenderingManager::RenderingManager(OEngine::Render::OgreRenderer& _rend, const b
|
|
|
|
|
mRootNode = mRendering.getScene()->getRootSceneNode();
|
|
|
|
|
mRootNode->createChildSceneNode("player");
|
|
|
|
|
|
|
|
|
|
mObjects.setRootNode(mRootNode);
|
|
|
|
|
mActors.setRootNode(mRootNode);
|
|
|
|
|
mObjects->setRootNode(mRootNode);
|
|
|
|
|
mActors->setRootNode(mRootNode);
|
|
|
|
|
|
|
|
|
|
mCamera = new MWRender::Camera(mRendering.getCamera());
|
|
|
|
|
|
|
|
|
@ -201,6 +201,8 @@ RenderingManager::~RenderingManager ()
|
|
|
|
|
delete mCompositors;
|
|
|
|
|
delete mWater;
|
|
|
|
|
delete mVideoPlayer;
|
|
|
|
|
delete mActors;
|
|
|
|
|
delete mObjects;
|
|
|
|
|
delete mFactory;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -210,10 +212,10 @@ MWRender::SkyManager* RenderingManager::getSkyManager()
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
MWRender::Objects& RenderingManager::getObjects(){
|
|
|
|
|
return mObjects;
|
|
|
|
|
return *mObjects;
|
|
|
|
|
}
|
|
|
|
|
MWRender::Actors& RenderingManager::getActors(){
|
|
|
|
|
return mActors;
|
|
|
|
|
return *mActors;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OEngine::Render::Fader* RenderingManager::getFader()
|
|
|
|
@ -223,8 +225,8 @@ OEngine::Render::Fader* RenderingManager::getFader()
|
|
|
|
|
|
|
|
|
|
void RenderingManager::removeCell (MWWorld::Ptr::CellStore *store)
|
|
|
|
|
{
|
|
|
|
|
mObjects.removeCell(store);
|
|
|
|
|
mActors.removeCell(store);
|
|
|
|
|
mObjects->removeCell(store);
|
|
|
|
|
mActors->removeCell(store);
|
|
|
|
|
mDebugging->cellRemoved(store);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -240,7 +242,7 @@ void RenderingManager::toggleWater()
|
|
|
|
|
|
|
|
|
|
void RenderingManager::cellAdded (MWWorld::Ptr::CellStore *store)
|
|
|
|
|
{
|
|
|
|
|
mObjects.buildStaticGeometry (*store);
|
|
|
|
|
mObjects->buildStaticGeometry (*store);
|
|
|
|
|
sh::Factory::getInstance().unloadUnreferencedMaterials();
|
|
|
|
|
mDebugging->cellAdded(store);
|
|
|
|
|
waterAdded(store);
|
|
|
|
@ -254,8 +256,8 @@ void RenderingManager::addObject (const MWWorld::Ptr& ptr){
|
|
|
|
|
|
|
|
|
|
void RenderingManager::removeObject (const MWWorld::Ptr& ptr)
|
|
|
|
|
{
|
|
|
|
|
if (!mObjects.deleteObject (ptr))
|
|
|
|
|
mActors.deleteObject (ptr);
|
|
|
|
|
if (!mObjects->deleteObject (ptr))
|
|
|
|
|
mActors->deleteObject (ptr);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RenderingManager::moveObject (const MWWorld::Ptr& ptr, const Ogre::Vector3& position)
|
|
|
|
@ -295,9 +297,9 @@ RenderingManager::updateObjectCell(const MWWorld::Ptr &old, const MWWorld::Ptr &
|
|
|
|
|
parent->removeChild(child);
|
|
|
|
|
|
|
|
|
|
if (MWWorld::Class::get(old).isActor()) {
|
|
|
|
|
mActors.updateObjectCell(old, cur);
|
|
|
|
|
mActors->updateObjectCell(old, cur);
|
|
|
|
|
} else {
|
|
|
|
|
mObjects.updateObjectCell(old, cur);
|
|
|
|
|
mObjects->updateObjectCell(old, cur);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -315,7 +317,7 @@ void RenderingManager::rebuildPtr(const MWWorld::Ptr &ptr)
|
|
|
|
|
if(ptr.getRefData().getHandle() == "player")
|
|
|
|
|
anim = mPlayerAnimation;
|
|
|
|
|
else if(MWWorld::Class::get(ptr).isActor())
|
|
|
|
|
anim = dynamic_cast<NpcAnimation*>(mActors.getAnimation(ptr));
|
|
|
|
|
anim = dynamic_cast<NpcAnimation*>(mActors->getAnimation(ptr));
|
|
|
|
|
if(anim)
|
|
|
|
|
{
|
|
|
|
|
anim->rebuild();
|
|
|
|
@ -380,8 +382,8 @@ void RenderingManager::update (float duration, bool paused)
|
|
|
|
|
if(paused)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
mActors.update (duration);
|
|
|
|
|
mObjects.update (duration);
|
|
|
|
|
mActors->update (duration);
|
|
|
|
|
mObjects->update (duration);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
mSkyManager->update(duration);
|
|
|
|
@ -657,7 +659,7 @@ void RenderingManager::requestMap(MWWorld::Ptr::CellStore* cell)
|
|
|
|
|
{
|
|
|
|
|
assert(mTerrain);
|
|
|
|
|
|
|
|
|
|
Ogre::AxisAlignedBox dims = mObjects.getDimensions(cell);
|
|
|
|
|
Ogre::AxisAlignedBox dims = mObjects->getDimensions(cell);
|
|
|
|
|
Ogre::Vector2 center(cell->mCell->getGridX() + 0.5, cell->mCell->getGridY() + 0.5);
|
|
|
|
|
dims.merge(mTerrain->getWorldBoundingBox(center));
|
|
|
|
|
|
|
|
|
@ -667,7 +669,7 @@ void RenderingManager::requestMap(MWWorld::Ptr::CellStore* cell)
|
|
|
|
|
mLocalMap->requestMap(cell, dims.getMinimum().z, dims.getMaximum().z);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
mLocalMap->requestMap(cell, mObjects.getDimensions(cell));
|
|
|
|
|
mLocalMap->requestMap(cell, mObjects->getDimensions(cell));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RenderingManager::preCellChange(MWWorld::Ptr::CellStore* cell)
|
|
|
|
@ -677,13 +679,13 @@ void RenderingManager::preCellChange(MWWorld::Ptr::CellStore* cell)
|
|
|
|
|
|
|
|
|
|
void RenderingManager::disableLights(bool sun)
|
|
|
|
|
{
|
|
|
|
|
mObjects.disableLights();
|
|
|
|
|
mObjects->disableLights();
|
|
|
|
|
sunDisable(sun);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void RenderingManager::enableLights(bool sun)
|
|
|
|
|
{
|
|
|
|
|
mObjects.enableLights();
|
|
|
|
|
mObjects->enableLights();
|
|
|
|
|
sunEnable(sun);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -859,7 +861,7 @@ void RenderingManager::processChangedSettings(const Settings::CategorySettingVec
|
|
|
|
|
|
|
|
|
|
if (rebuild)
|
|
|
|
|
{
|
|
|
|
|
mObjects.rebuildStaticGeometry();
|
|
|
|
|
mObjects->rebuildStaticGeometry();
|
|
|
|
|
if (mTerrain)
|
|
|
|
|
mTerrain->applyMaterials(Settings::Manager::getBool("enabled", "Shadows"),
|
|
|
|
|
Settings::Manager::getBool("split", "Shadows"));
|
|
|
|
@ -976,13 +978,13 @@ void RenderingManager::setupExternalRendering (MWRender::ExternalRendering& rend
|
|
|
|
|
|
|
|
|
|
Animation* RenderingManager::getAnimation(const MWWorld::Ptr &ptr)
|
|
|
|
|
{
|
|
|
|
|
Animation *anim = mActors.getAnimation(ptr);
|
|
|
|
|
Animation *anim = mActors->getAnimation(ptr);
|
|
|
|
|
|
|
|
|
|
if(!anim && ptr.getRefData().getHandle() == "player")
|
|
|
|
|
anim = mPlayerAnimation;
|
|
|
|
|
|
|
|
|
|
if (!anim)
|
|
|
|
|
anim = mObjects.getAnimation(ptr);
|
|
|
|
|
anim = mObjects->getAnimation(ptr);
|
|
|
|
|
|
|
|
|
|
return anim;
|
|
|
|
|
}
|
|
|
|
|