Extend custom shader in Demo

Extend custom shader in Demo

Postby lukaszml » Thu Nov 16, 2017 8:34 pm

Hello :),
How to extend numbers of light on exampe 'Custom shader and render' and how to add colors.

I try something like this:
Code: Select all
void apply(Material* prev) override
        IVideoDriver* driver = IVideoDriver::instance;

        Vector2 light = getStage()->getDescendant("light")->getPosition();
      Vector2 light2 = getStage()->getDescendant("light2")->getPosition();

        driver->setUniform("light", &light, 1);
      driver->setUniform("light2", &light, 2);
        driver->setUniform("mat", &STDMaterial::instance->getRenderer()->getViewProjection());

        driver->setTexture(1, _normal.getDiffuse().base);

        driver->setState(IVideoDriver::STATE_BLEND, 0);
        driver->setBlendFunc(IVideoDriver::BT_ONE, IVideoDriver::BT_ONE_MINUS_SRC_ALPHA);
        driver->setBlendFunc(IVideoDriver::BT_SRC_ALPHA, IVideoDriver::BT_ONE_MINUS_SRC_ALPHA);

And init new light bulb (( end of TestUserShader2() function ))
Code: Select all
light = new Sprite;
light->setAnchor(0.5f, 0.5f);
light->setPosition(getSize() / 2);


but doesn't work :(
I can navigate bulb but only one emit light.

Also, how to limit range of light, currently rage seems like infinity
Posts: 59
Joined: Mon Jul 04, 2016 2:49 pm

Return to oxygine-framework

Who is online

Users browsing this forum: No registered users and 1 guest