I do so...
I make "goto" in c++ and replace code execution on the create Irrlicht device line. And replase path in create node mesh place. Further, collision creating too, according to the rest of the program. Irrlicht create new device and run it with my new scene. All working. But device old windows is remain. Seems old windows not working becouse old scene immobilized. But it all incorrectly.
How correctly replace Node Mesh and update collision manadger for this new mesh?
Code: Select all
LevelRun:
int screenW=GetSystemMetrics(SM_CXSCREEN);//Получить ширину экрана
int screenH=GetSystemMetrics(SM_CYSCREEN);//Получить высоту экрана
IrrlichtDevice* device = createDevice(video::EDT_DIRECT3D9,
core::dimension2d<u32>(screenW,screenH),32, false, true);
device->getCursorControl()->setVisible(false);
video::IVideoDriver* driver = device->getVideoDriver();
scene::ISceneManager* scenemgr = device->getSceneManager();
lstr = "media/";
lstr+=LevelX;
lstr+="/Scene.3ds";
scene::IAnimatedMeshSceneNode* node = scenemgr->addAnimatedMeshSceneNode(
scenemgr->getMesh(lstr));
if (node)
{
node->setMaterialType(video::EMT_LIGHTMAP_LIGHTING);
node->setMaterialFlag(video::EMF_LIGHTING, false);
}
scene::IAnimatedMeshSceneNode* ComboBox = scenemgr->addAnimatedMeshSceneNode(
scenemgr->getMesh("media/ComboBox.3ds"));
ComboBox->setMaterialType(video::EMT_TRANSPARENT_ADD_COLOR);
scene::IAnimatedMeshSceneNode* LevelUP = scenemgr->addAnimatedMeshSceneNode(
scenemgr->getMesh("media/LevelUP.3ds"));
LevelUP->setMaterialType(video::EMT_LIGHTMAP_LIGHTING);
LevelUP->setMaterialFlag(video::EMF_LIGHTING, false);
LevelUP->setPosition(core::vector3df(10000, 0, 0));
LevelUP->setVisible(false);
irr::scene::ICameraSceneNode* camera = scenemgr->addCameraSceneNodeFPS(0,150.0f,3.5f,-1,0,0,false,5.0f,false,true);
camera->render();
scene::ITriangleSelector* selector = scenemgr->createTriangleSelector(node);
node->setTriangleSelector(selector);
selector->drop();
scene::ISceneCollisionManager* collMan = scenemgr->getSceneCollisionManager();
scene::ISceneNodeAnimator* anim = scenemgr->createCollisionResponseAnimator(selector, ComboBox, core::vector3df(1, 1, 1), core::vector3df(0, 0, 0));
selector->drop();
ComboBox->addAnimator(anim);
anim->drop();
video::ITexture* stexture = driver->addTexture(core::dimension2d<u32>(1,1), "texture", video::ECF_A8R8G8B8);
s32* p = (s32*)stexture->lock();
p[0] = video::SColor(255,255,0,0).color;
stexture->unlock();
MyEventReceiver* receiver = new MyEventReceiver();
device->setEventReceiver(receiver);
while(device->run())
...
goto LevelRun;
...