Jump to content

post_filter_selection not working on generic nodes


photo

Recommended Posts

I use this code in plugin to add glow to selected nodes in the world.

        auto obj = Unigine::checked_ptr_cast<Unigine::Object>(node);
        for (int i = 0; i < obj->getNumSurfaces(); i++)        {            

            obj->setMaterialState("auxiliary", 1, i);
            obj->setMaterialParameterFloat4("auxiliary_color", color, i);
        }

with the generic initialization being

        Unigine::Console::run("render_auxiliary 1");
        Unigine::Render::setPostMaterials("post_filter_selection");


This works in the initial world loaded, as editor is started, but it does not work after another world is loaded like this...

    auto resu=World::loadWorld(world_name);
 

    auto pl = PlayerSpectator::create();
    pl->setPosition(Math::Vec3(0.0f, 3.401f, 1.5f));
    
        
    
    Game::setPlayer(pl);
    pl->setMainPlayer(1);
    Game::setEnabled(1);

 

 

 I know this is demonstrated in post_selection demo, but the loadWorld somehow breaks it.

Edited by david.sanda
Link to comment

Anyway, if instead of

World::loadWorld("xy");

I use

Console::run("world_load xy");

the post_selection works as in your examples. Not sure what difference is there between these two methods of world loading, but as the problem is solved, you can close it.

Edited by david.sanda
Link to comment
×
×
  • Create New...