mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-19 20:23:54 +00:00
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;
|
||||
|
||||
// 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)
|
||||
{
|
||||
assert (!mInsert);
|
||||
|
@ -202,9 +215,12 @@ void ExteriorCellRender::insertMesh(const std::string &mesh)
|
|||
assert (mInsert);
|
||||
|
||||
NIFLoader::load(mesh);
|
||||
MovableObject *ent = mScene.getMgr()->createEntity(mesh);
|
||||
Entity *ent = mScene.getMgr()->createEntity(mesh);
|
||||
mInsert->attachObject(ent);
|
||||
|
||||
/*sg->addEntity(ent,mInsert->_getDerivedPosition(),mInsert->_getDerivedOrientation(),mInsert->_getDerivedScale());
|
||||
sg->setRegionDimensions(Ogre::Vector3(100000,10000,100000));*/
|
||||
|
||||
if (mInsertMesh.empty())
|
||||
mInsertMesh = mesh;
|
||||
}
|
||||
|
@ -333,6 +349,8 @@ void ExteriorCellRender::show()
|
|||
configureFog();
|
||||
|
||||
insertCell(mCell, mEnvironment);
|
||||
|
||||
sg->build();
|
||||
}
|
||||
|
||||
void ExteriorCellRender::hide()
|
||||
|
@ -350,6 +368,8 @@ void ExteriorCellRender::destroy()
|
|||
}
|
||||
|
||||
mBase = NULL;
|
||||
std::cout << "destroy";
|
||||
Ogre::Root::getSingleton().getSceneManagerIterator().getNext()->destroyStaticGeometry(sg);
|
||||
}
|
||||
|
||||
// Switch through lighting modes.
|
||||
|
|
|
@ -57,6 +57,9 @@ namespace MWRender
|
|||
std::string mInsertMesh;
|
||||
Ogre::SceneNode *mNpcPart;
|
||||
|
||||
//the static geometry
|
||||
Ogre::StaticGeometry *sg;
|
||||
|
||||
// 0 normal, 1 more bright, 2 max
|
||||
int mAmbientMode;
|
||||
|
||||
|
@ -95,8 +98,7 @@ namespace MWRender
|
|||
public:
|
||||
|
||||
ExteriorCellRender(ESMS::CellStore<MWWorld::RefData> &_cell, MWWorld::Environment& environment,
|
||||
MWScene &_scene)
|
||||
: mCell(_cell), mEnvironment (environment), mScene(_scene), mBase(NULL), mInsert(NULL), mAmbientMode (0) {}
|
||||
MWScene &_scene);
|
||||
|
||||
virtual ~ExteriorCellRender() { destroy(); }
|
||||
|
||||
|
|
Loading…
Reference in a new issue