Topic: Problem with multiple sceneLayers

I have three scenes:
         -Sky
         -World
         -GUI

I need the three scenes to be shown as layers at once in this way: World is the Sky layer and GUI is the World layer, meaning Sky is in the background, World in the middle and GUI is in front. but the engine only allows the rendering of two layers, what can I do?

Re: Problem with multiple sceneLayers

Hi,

In a c++ plugin you can customize MGame::update() and MGame::draw() to handle multiple scenes.

MScene *scenes[3]
scenes[0] = getSceneByName("Sky");
scenes[1] = getSceneByName("World");
scenes[2] = getSceneByName("GUI");

in update replace current scene update by:

for (i = 0; i < 3; i++) {
   scenes[i]->updateObjectsBehaviors();
   scenes[i]->update();
   if (i == 1) scenes[i]->updatePhysics();
   scenes[i]->updateObjectsMatrices();
}

in draw something like:

for (i = 0; i < 3; i++) {
   MOCamera * camera = scenes[i]->getCurrentCamera();

   render->setClearColor(camera->getClearColor());

   if (i == 0)
      render->clear(M_BUFFER_COLOR | M_BUFFER_DEPTH);
   else
      render->clear(M_BUFFER_DEPTH);

   camera->enable();
   if (i == 1) camera->updateListener();
   scenes[i]->draw(camera);
   scenes[i]->drawObjectsBehaviors();
}

Re: Problem with multiple sceneLayers

Thanks, it worked perfectly smile