forked from mirror/openmw-tes3mp
new insertBegin()
This commit is contained in:
parent
c2181d2091
commit
d49a02abe5
2 changed files with 19 additions and 7 deletions
|
@ -4,12 +4,25 @@
|
||||||
using namespace MWRender;
|
using namespace MWRender;
|
||||||
|
|
||||||
void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
|
void Objects::insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_){
|
||||||
ptr.getRefData().setBaseNode(mBase);
|
Ogre::SceneNode* root = rend.getScene()->getRootSceneNode();
|
||||||
assert (!mInsert);
|
Ogre::SceneNode* cellnode;
|
||||||
|
if(cellSceneNodes.find(ptr.getCell()) == cellSceneNodes.end())
|
||||||
|
{
|
||||||
|
//Create the scenenode and put it in the map
|
||||||
|
cellnode = root->createChildSceneNode();
|
||||||
|
cellSceneNodes[ptr.getCell()] = cellnode;
|
||||||
|
assert(!cellnode->getChildIterator()->begin()); //Is this right?
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
cellnode = (cellSceneNodes.find(ptr.getCell()))->second;
|
||||||
|
}
|
||||||
|
Ogre::SceneNode* insert = cellnode->createChildSceneNode();
|
||||||
|
|
||||||
|
ptr.getRefData().setBaseNode(insert);
|
||||||
isStatic = static_;
|
isStatic = static_;
|
||||||
|
|
||||||
// Create and place scene node for this object
|
|
||||||
mInsert = mBase->createChildSceneNode();
|
|
||||||
}
|
}
|
||||||
void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh){
|
void Objects::insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh){
|
||||||
|
|
||||||
|
|
|
@ -8,11 +8,10 @@ namespace MWRender{
|
||||||
class Objects{
|
class Objects{
|
||||||
private:
|
private:
|
||||||
OEngine::Render::OgreRenderer &rend;
|
OEngine::Render::OgreRenderer &rend;
|
||||||
Ogre::SceneNode *mBase;
|
std::map<MWWorld::Ptr::CellStore *, Ogre::SceneNode *> cellSceneNodes;
|
||||||
Ogre::SceneNode *mInsert;
|
|
||||||
bool isStatic;
|
bool isStatic;
|
||||||
public:
|
public:
|
||||||
Objects(OEngine::Render::OgreRenderer& _rend): rend(_rend){mBase = rend.getScene()->getRootSceneNode(); }
|
Objects(OEngine::Render::OgreRenderer& _rend): rend(_rend){}
|
||||||
~Objects(){}
|
~Objects(){}
|
||||||
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
void insertBegin (const MWWorld::Ptr& ptr, bool enabled, bool static_);
|
||||||
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);
|
void insertMesh (const MWWorld::Ptr& ptr, const std::string& mesh);
|
||||||
|
|
Loading…
Reference in a new issue