Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Yuri

Pages: [1]
1
SFML projects / Re: Let There Be Light 2
« on: May 27, 2020, 03:09:11 pm »
Hello

I have problem thats my light point emmision is only a half of circle and i dont know how to fix it :/
I use fallowing code with Alia5 LTBL2:

Code: [Select]
#include "ltbl/lighting/LightSystem.hpp"
#include <SFML/Graphics.hpp>
#include <iostream>


int main() {
    sf::RenderTexture normal_texture_;
    sf::RenderTexture specular_texture_;
    sf::RenderWindow window{sf::VideoMode{800,600}, "LightShow"};
    ltbl::LightSystem lightSystem{normal_texture_,specular_texture_,true};
    lightSystem.create({ -1000.f, -1000.f, 1000.f, 1000.f }, window.getSize());


    sf::Texture pointLightTexture;
    pointLightTexture.loadFromFile("resources/pointLightTexture.png");
    pointLightTexture.setSmooth(true);


    auto* light = lightSystem.createLightPointEmission();
    light->setTexture(pointLightTexture);
    light->setOrigin(pointLightTexture.getSize().x / 2.f, pointLightTexture.getSize().y / 2.f);
    light->setScale(10.f,10.f);


    while (window.isOpen()) {
        sf::Event event;
        while (window.pollEvent(event)) {
            if (event.type == sf::Event::Closed) {
                window.close();
            }
        }
        sf::Vector2f pos(sf::Mouse::getPosition(window));
        light->setPosition(pos);


        window.clear(sf::Color::White);
        lightSystem.render(window);
        window.display();
    }
    return 0;
}
any tips?

edit: dummy me
 ltbl::LightSystem lightSystem{normal_texture_,specular_texture_,FALSE};

Pages: [1]