forked from mirror/openmw-tes3mp
very experimental: static geometry.
This commit is contained in:
parent
0d9dde0fcf
commit
41d283a3aa
2 changed files with 26 additions and 4 deletions
|
@ -31,8 +31,21 @@ float ExteriorCellRender::lightQuadraticRadiusMult = 1;
|
||||||
|
|
||||||
bool ExteriorCellRender::lightOutQuadInLin = false;
|
bool ExteriorCellRender::lightOutQuadInLin = false;
|
||||||
|
|
||||||
// start inserting a new reference.
|
ExteriorCellRender::ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||||
|
MWScene &_scene)
|
||||||
|
: mCell(_cell), mEnvironment (environment), mScene(_scene), mBase(NULL), mInsert(NULL), mAmbientMode (0)
|
||||||
|
{
|
||||||
|
//char a = mCell.cell->name;
|
||||||
|
//char *rand1;
|
||||||
|
srand (150);
|
||||||
|
//itoa(rand(),rand1,10);
|
||||||
|
int a;
|
||||||
|
Ogre::StringConverter::toString(rand());
|
||||||
|
sg = Ogre::Root::getSingleton().getSceneManagerIterator().getNext()->createStaticGeometry( Ogre::StringConverter::toString(a));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// start inserting a new reference.
|
||||||
void ExteriorCellRender::insertBegin (ESM::CellRef &ref)
|
void ExteriorCellRender::insertBegin (ESM::CellRef &ref)
|
||||||
{
|
{
|
||||||
assert (!mInsert);
|
assert (!mInsert);
|
||||||
|
@ -202,9 +215,12 @@ void ExteriorCellRender::insertMesh(const std::string &mesh)
|
||||||
assert (mInsert);
|
assert (mInsert);
|
||||||
|
|
||||||
NIFLoader::load(mesh);
|
NIFLoader::load(mesh);
|
||||||
MovableObject *ent = mScene.getMgr()->createEntity(mesh);
|
Entity *ent = mScene.getMgr()->createEntity(mesh);
|
||||||
mInsert->attachObject(ent);
|
mInsert->attachObject(ent);
|
||||||
|
|
||||||
|
/*sg->addEntity(ent,mInsert->_getDerivedPosition(),mInsert->_getDerivedOrientation(),mInsert->_getDerivedScale());
|
||||||
|
sg->setRegionDimensions(Ogre::Vector3(100000,10000,100000));*/
|
||||||
|
|
||||||
if (mInsertMesh.empty())
|
if (mInsertMesh.empty())
|
||||||
mInsertMesh = mesh;
|
mInsertMesh = mesh;
|
||||||
}
|
}
|
||||||
|
@ -333,6 +349,8 @@ void ExteriorCellRender::show()
|
||||||
configureFog();
|
configureFog();
|
||||||
|
|
||||||
insertCell(mCell, mEnvironment);
|
insertCell(mCell, mEnvironment);
|
||||||
|
|
||||||
|
sg->build();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExteriorCellRender::hide()
|
void ExteriorCellRender::hide()
|
||||||
|
@ -350,6 +368,8 @@ void ExteriorCellRender::destroy()
|
||||||
}
|
}
|
||||||
|
|
||||||
mBase = NULL;
|
mBase = NULL;
|
||||||
|
std::cout << "destroy";
|
||||||
|
Ogre::Root::getSingleton().getSceneManagerIterator().getNext()->destroyStaticGeometry(sg);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Switch through lighting modes.
|
// Switch through lighting modes.
|
||||||
|
|
|
@ -57,6 +57,9 @@ namespace MWRender
|
||||||
std::string mInsertMesh;
|
std::string mInsertMesh;
|
||||||
Ogre::SceneNode *mNpcPart;
|
Ogre::SceneNode *mNpcPart;
|
||||||
|
|
||||||
|
//the static geometry
|
||||||
|
Ogre::StaticGeometry *sg;
|
||||||
|
|
||||||
// 0 normal, 1 more bright, 2 max
|
// 0 normal, 1 more bright, 2 max
|
||||||
int mAmbientMode;
|
int mAmbientMode;
|
||||||
|
|
||||||
|
@ -95,8 +98,7 @@ namespace MWRender
|
||||||
public:
|
public:
|
||||||
|
|
||||||
ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||||
MWScene &_scene)
|
MWScene &_scene);
|
||||||
: mCell(_cell), mEnvironment (environment), mScene(_scene), mBase(NULL), mInsert(NULL), mAmbientMode (0) {}
|
|
||||||
|
|
||||||
virtual ~ExteriorCellRender() { destroy(); }
|
virtual ~ExteriorCellRender() { destroy(); }
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue