|
|
|
@ -35,11 +35,13 @@ bool ExteriorCellRender::lightOutQuadInLin = false;
|
|
|
|
|
int ExteriorCellRender::uniqueID = 0;
|
|
|
|
|
|
|
|
|
|
ExteriorCellRender::ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
|
|
|
|
RenderingManager &_rendering, MWWorld::PhysicsSystem *physics)
|
|
|
|
|
: mCell(_cell), mEnvironment (environment), mRendering(_rendering), mPhysics(physics), mBase(NULL), mInsert(NULL), mAmbientMode (0)
|
|
|
|
|
OEngine::Render::OgreRenderer& renderer, Ogre::SceneNode *mwRoot,MWWorld::PhysicsSystem *physics)
|
|
|
|
|
: mCell(_cell), mEnvironment (environment), mRenderer(renderer), mPhysics(physics), mBase(NULL), mInsert(NULL), mAmbientMode (0)
|
|
|
|
|
{
|
|
|
|
|
mMwRoot = mwRoot;
|
|
|
|
|
uniqueID = uniqueID +1;
|
|
|
|
|
sg = mRendering.getMgr()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
|
|
|
|
sg = mRenderer.getScene()->createStaticGeometry( "sg" + Ogre::StringConverter::toString(uniqueID));
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -127,7 +129,7 @@ void ExteriorCellRender::insertMesh(const std::string &mesh, Ogre::Vector3 vec,
|
|
|
|
|
mNpcPart = parent->createChildSceneNode(sceneNodeName);
|
|
|
|
|
MeshPtr good2 = NifOgre::NIFLoader::load(mesh);
|
|
|
|
|
|
|
|
|
|
MovableObject *ent = mRendering.getMgr()->createEntity(mesh);
|
|
|
|
|
MovableObject *ent = mRenderer.getScene()->createEntity(mesh);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(translateFirst){
|
|
|
|
@ -215,7 +217,7 @@ void ExteriorCellRender::insertMesh(const std::string &mesh)
|
|
|
|
|
assert (mInsert);
|
|
|
|
|
|
|
|
|
|
NifOgre::NIFLoader::load(mesh);
|
|
|
|
|
Entity *ent = mRendering.getMgr()->createEntity(mesh);
|
|
|
|
|
Entity *ent = mRenderer.getScene()->createEntity(mesh);
|
|
|
|
|
|
|
|
|
|
if(!isStatic)
|
|
|
|
|
{
|
|
|
|
@ -225,7 +227,7 @@ void ExteriorCellRender::insertMesh(const std::string &mesh)
|
|
|
|
|
{
|
|
|
|
|
sg->addEntity(ent,mInsert->_getDerivedPosition(),mInsert->_getDerivedOrientation(),mInsert->_getDerivedScale());
|
|
|
|
|
sg->setRegionDimensions(Ogre::Vector3(100000,10000,100000));
|
|
|
|
|
mRendering.getMgr()->destroyEntity(ent);
|
|
|
|
|
mRenderer.getScene()->destroyEntity(ent);
|
|
|
|
|
}
|
|
|
|
|
if (mInsertMesh.empty())
|
|
|
|
|
mInsertMesh = mesh;
|
|
|
|
@ -250,7 +252,7 @@ void ExteriorCellRender::insertLight(float r, float g, float b, float radius)
|
|
|
|
|
{
|
|
|
|
|
assert (mInsert);
|
|
|
|
|
|
|
|
|
|
Ogre::Light *light = mRendering.getMgr()->createLight();
|
|
|
|
|
Ogre::Light *light = mRenderer.getScene()->createLight();
|
|
|
|
|
light->setDiffuseColour (r, g, b);
|
|
|
|
|
|
|
|
|
|
float cval=0.0f, lval=0.0f, qval=0.0f;
|
|
|
|
@ -306,7 +308,7 @@ void ExteriorCellRender::configureAmbient()
|
|
|
|
|
|
|
|
|
|
// Create a "sun" that shines light downwards. It doesn't look
|
|
|
|
|
// completely right, but leave it for now.
|
|
|
|
|
Ogre::Light *light = mRendering.getMgr()->createLight();
|
|
|
|
|
Ogre::Light *light = mRenderer.getScene()->createLight();
|
|
|
|
|
Ogre::ColourValue colour;
|
|
|
|
|
colour.setAsABGR (mCell.cell->ambi.sunlight);
|
|
|
|
|
light->setDiffuseColour (colour);
|
|
|
|
@ -323,9 +325,9 @@ void ExteriorCellRender::configureFog()
|
|
|
|
|
float high = 4500 + 9000 * (1-mCell.cell->ambi.fogDensity);
|
|
|
|
|
float low = 200;
|
|
|
|
|
|
|
|
|
|
mRendering.getMgr()->setFog (FOG_LINEAR, color, 0, low, high);
|
|
|
|
|
mRendering.getCamera()->setFarClipDistance (high + 10);
|
|
|
|
|
mRendering.getViewport()->setBackgroundColour (color);
|
|
|
|
|
mRenderer.getScene()->setFog (FOG_LINEAR, color, 0, low, high);
|
|
|
|
|
mRenderer.getCamera()->setFarClipDistance (high + 10);
|
|
|
|
|
mRenderer.getViewport()->setBackgroundColour (color);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExteriorCellRender::setAmbientMode()
|
|
|
|
@ -334,17 +336,17 @@ void ExteriorCellRender::setAmbientMode()
|
|
|
|
|
{
|
|
|
|
|
case 0:
|
|
|
|
|
|
|
|
|
|
mRendering.getMgr()->setAmbientLight(mAmbientColor);
|
|
|
|
|
mRenderer.getScene()->setAmbientLight(mAmbientColor);
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
|
|
|
|
mRendering.getMgr()->setAmbientLight(0.7f*mAmbientColor + 0.3f*ColourValue(1,1,1));
|
|
|
|
|
mRenderer.getScene()->setAmbientLight(0.7f*mAmbientColor + 0.3f*ColourValue(1,1,1));
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
|
|
|
|
mRendering.getMgr()->setAmbientLight(ColourValue(1,1,1));
|
|
|
|
|
mRenderer.getScene()->setAmbientLight(ColourValue(1,1,1));
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -352,7 +354,7 @@ void ExteriorCellRender::setAmbientMode()
|
|
|
|
|
void ExteriorCellRender::show()
|
|
|
|
|
{
|
|
|
|
|
// FIXME: this one may be the bug
|
|
|
|
|
mBase = mRendering.getRoot()->createChildSceneNode();
|
|
|
|
|
mBase = mMwRoot->createChildSceneNode();
|
|
|
|
|
|
|
|
|
|
configureAmbient();
|
|
|
|
|
configureFog();
|
|
|
|
@ -401,14 +403,14 @@ void ExteriorCellRender::destroy()
|
|
|
|
|
{
|
|
|
|
|
destroyAllAttachedMovableObjects(mBase);
|
|
|
|
|
mBase->removeAndDestroyAllChildren();
|
|
|
|
|
mRendering.getMgr()->destroySceneNode(mBase);
|
|
|
|
|
mRenderer.getScene()->destroySceneNode(mBase);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mBase = 0;
|
|
|
|
|
|
|
|
|
|
if (sg)
|
|
|
|
|
{
|
|
|
|
|
mRendering.getMgr()->destroyStaticGeometry (sg);
|
|
|
|
|
mRenderer.getScene()->destroyStaticGeometry (sg);
|
|
|
|
|
sg = 0;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -435,21 +437,21 @@ void ExteriorCellRender::toggleLight()
|
|
|
|
|
void ExteriorCellRender::enable (const std::string& handle)
|
|
|
|
|
{
|
|
|
|
|
if (!handle.empty())
|
|
|
|
|
mRendering.getMgr()->getSceneNode (handle)->setVisible (true);
|
|
|
|
|
mRenderer.getScene()->getSceneNode (handle)->setVisible (true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExteriorCellRender::disable (const std::string& handle)
|
|
|
|
|
{
|
|
|
|
|
if (!handle.empty())
|
|
|
|
|
mRendering.getMgr()->getSceneNode (handle)->setVisible (false);
|
|
|
|
|
mRenderer.getScene()->getSceneNode (handle)->setVisible (false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ExteriorCellRender::deleteObject (const std::string& handle)
|
|
|
|
|
{
|
|
|
|
|
if (!handle.empty())
|
|
|
|
|
{
|
|
|
|
|
Ogre::SceneNode *node = mRendering.getMgr()->getSceneNode (handle);
|
|
|
|
|
Ogre::SceneNode *node = mRenderer.getScene()->getSceneNode (handle);
|
|
|
|
|
node->removeAndDestroyAllChildren();
|
|
|
|
|
mRendering.getMgr()->destroySceneNode (node);
|
|
|
|
|
mRenderer.getScene()->destroySceneNode (node);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|