Help plz need simple examle Light SFML full
I can t build simple project
#include <SFML/Graphics.hpp>
#include <ltbl/lighting/LightSystem.h>
using namespace sf;
int main()
{
RenderWindow window;
ContextSettings contextSettings;
Event event;
Texture backgroundImage;
sf::RenderStates lightRenderStates;
Sprite backgroundSprite(backgroundImage);
sf::Sprite Lsprite;//Спрайт света.
Texture pointLightTexture,ConeLightTexture;
Texture penumbraTexture;
Shader unshadowShader, lightOverShapeShader;
ConvexShape shape1, shape2, shape3;
ltbl::LightSystem ls;
//ls._ambientColor(Color::Black);
contextSettings.antialiasingLevel = 8;
window.create(sf::VideoMode(1280, 720), "LTBL2", sf::Style::Default, contextSettings);
penumbraTexture.loadFromFile("data/penumbraTexture.png");
penumbraTexture.setSmooth(true);
pointLightTexture.loadFromFile("data/pointLightTexture.png");
pointLightTexture.setSmooth(true);
ConeLightTexture.loadFromFile("data/spotLightTexture.png");
ConeLightTexture.setSmooth(true);
backgroundImage.loadFromFile("data/background.png");
backgroundImage.setRepeated(true);
backgroundSprite.setTextureRect(sf::IntRect(0, 0, 1280 * 2, 720 * 2));
backgroundSprite.setPosition(-400.0f, -400.0f);
unshadowShader.loadFromFile("data/unshadowShader.vert", "data/unshadowShader.frag");
lightOverShapeShader.loadFromFile("data/lightOverShapeShader.vert", "data/lightOverShapeShader.frag");
ls.create(ltbl::rectFromBounds(sf::Vector2f(-1000.0f, -1000.0f), sf::Vector2f(1000.0f, 1000.0f)), window.getSize(), penumbraTexture, unshadowShader, lightOverShapeShader);
std::shared_ptr<ltbl::LightPointEmission> light = std::make_shared<ltbl::LightPointEmission>();//LightPointEmission->
light->_emissionSprite.setOrigin(sf::Vector2f(pointLightTexture.getSize().x * 0.5f, pointLightTexture.getSize().y * 0.5f));
light->_emissionSprite.setTexture(pointLightTexture);
light->_emissionSprite.setScale(sf::Vector2f(10,10));
light->_emissionSprite.setColor(sf::Color(255, 255, 255));
light->_emissionSprite.setPosition(sf::Vector2f(50, 50));
light->_sourceRadius = 10;
light->_shadowOverExtendMultiplier =1
ls.addLight(light);
std::shared_ptr<ltbl::LightPointEmission> light2 = std::make_shared<ltbl::LightPointEmission>();
light2->_emissionSprite.setOrigin(sf::Vector2f(ConeLightTexture.getSize().x * 0.5f, ConeLightTexture.getSize().y * 0.5f));
light2->_emissionSprite.setTexture(ConeLightTexture);
light2->_emissionSprite.setScale(sf::Vector2f(13, 10));
light2->_emissionSprite.setColor(sf::Color(255, 255, 255));
light2->_emissionSprite.setPosition(sf::Vector2f(440, 50));
light2->_emissionSprite.setRotation(90);
light2->_sourceRadius = 10;
ls.addLight(light2);
std::shared_ptr<ltbl::LightPointEmission> light1 = std::make_shared<ltbl::LightPointEmission>();
light1->_emissionSprite.setOrigin(sf::Vector2f(pointLightTexture.getSize().x * 0.5f, pointLightTexture.getSize().y * 0.5f));
light1->_emissionSprite.setTexture(pointLightTexture);
light1->_emissionSprite.setScale(sf::Vector2f(5, 5));
light1->_emissionSprite.setColor(sf::Color(255, 255, 255));
light1->_sourceRadius = 10;
ls.addLight(light1);
std::shared_ptr<ltbl::LightDirectionEmission> light3 = std::make_shared<ltbl::LightDirectionEmission>();
light3->_castDirection = ltbl::vectorNormalize(sf::Vector2f(-0.1f, 0.8f));
// ls.addLight(light3);
std::shared_ptr<ltbl::LightShape> lightShape = std::make_shared<ltbl::LightShape>();
lightShape->_shape.setPointCount(4);
lightShape->_shape.setPoint(0, Vector2f(0, 0));
lightShape->_shape.setPoint(1, Vector2f(80, 0));
lightShape->_shape.setPoint(2, Vector2f(80, 80));
lightShape->_shape.setPoint(3, Vector2f(0, 80));
lightShape->_renderLightOverShape = false;
lightShape->_shape.setPosition(100,100);
ls.addShape(lightShape);
std::shared_ptr<ltbl::LightShape> lightShape1 = std::make_shared<ltbl::LightShape>();
lightShape1->_shape.setPointCount(4);
lightShape1->_shape.setPoint(0, Vector2f(0, 0));
lightShape1->_shape.setPoint(1, Vector2f(200, 0));
lightShape1->_shape.setPoint(2, Vector2f(200, 80));
lightShape1->_shape.setPoint(3, Vector2f(0, 80));
lightShape1->_renderLightOverShape = false;
lightShape1->_shape.setPosition(300, 400);
ls.addShape(lightShape1);
std::shared_ptr<ltbl::LightShape> lightShape2 = std::make_shared<ltbl::LightShape>();
lightShape2->_shape.setPointCount(4);
lightShape2->_shape.setPoint(0, Vector2f(0, 0));
lightShape2->_shape.setPoint(1, Vector2f(80, 0));
lightShape2->_shape.setPoint(2, Vector2f(80, 80));
lightShape2->_shape.setPoint(3, Vector2f(0, 80));
lightShape2->_renderLightOverShape = false;
lightShape2->_shape.setPosition(400, 200);
ls.addShape(lightShape2);
shape1.setPointCount(4);
shape1.setPoint(0, Vector2f(0, 0));
shape1.setPoint(1, Vector2f(80, 0));
shape1.setPoint(2, Vector2f(80, 80));
shape1.setPoint(3, Vector2f(0, 80));
shape1.setPosition(100, 100);
shape1.setFillColor(Color::Green);
shape2.setPointCount(4);
shape2.setPoint(0, Vector2f(0, 0));
shape2.setPoint(1, Vector2f(80, 0));
shape2.setPoint(2, Vector2f(80, 80));
shape2.setPoint(3, Vector2f(0, 80));
shape2.setPosition(400, 200);
shape2.setFillColor(Color::Green);
shape3.setPointCount(4);
shape3.setPoint(0, Vector2f(0, 0));
shape3.setPoint(1, Vector2f(200, 0));
shape3.setPoint(2, Vector2f(200, 80));
shape3.setPoint(3, Vector2f(0, 80));
shape3.setPosition(300, 400);
shape3.setFillColor(Color::Green);
sf::View view = window.getDefaultView();
view.setCenter(sf::Vector2f(1280 * 0.5f, 720 * 0.5f));
while (window.isOpen())
{
Vector2i pixelPos = Mouse::getPosition(window);
Vector2f pos = window.mapPixelToCoords(pixelPos);
while (window.pollEvent(event))
{
if (event.type == sf::Event::Closed)
window.close();
}
light1->_emissionSprite.setPosition(pos);
window.clear(sf::Color::White);
window.draw(backgroundSprite);
window.draw(shape1);
window.draw(shape2);
window.draw(shape3);
//-----------------------------RENDER SUN-----------------------------------
ls.render(view, unshadowShader,lightOverShapeShader);
Lsprite.setTexture(ls.getLightingTexture());
lightRenderStates.blendMode = sf::BlendMultiply;
window.setView(window.getDefaultView());
window.draw(Lsprite, lightRenderStates);
window.setView(view);
// ---------------------------------------------------------------------------
window.display();
}
}
MY VS 2015 take it errors
>------ Сборка начата: проект: LIGHT777, Конфигурация: Debug Win32 ------
1>MAIN.obj : error LNK2019: ссылка на неразрешенный внешний символ "class sf::Rect<float> __cdecl ltbl::rectFromBounds(class sf::Vector2<float> const &,class sf::Vector2<float> const &)" (?rectFromBounds@ltbl@@YA?AV?$Rect@M@sf@@ABV?$Vector2@M@3@0@Z) в функции _main
1>MAIN.obj : error LNK2019: ссылка на неразрешенный внешний символ "class sf::Vector2<float> __cdecl ltbl::vectorNormalize(class sf::Vector2<float> const &)" (?vectorNormalize@ltbl@@YA?AV?$Vector2@M@sf@@ABV23@@Z) в функции _main
1>MAIN.obj : error LNK2019: ссылка на неразрешенный внешний символ "public: __thiscall ltbl::Quadtree::Quadtree(void)" (??0Quadtree@ltbl@@QAE@XZ) в функции "public: __thiscall ltbl::DynamicQuadtree::DynamicQuadtree(void)" (??0DynamicQuadtree@ltbl@@QAE@XZ)
1>MAIN.obj : error LNK2001: неразрешенный внешний символ ""public: virtual void __thiscall ltbl::DynamicQuadtree::add(class ltbl::QuadtreeOccupant *)" (?add@DynamicQuadtree@ltbl@@UAEXPAVQuadtreeOccupant@2@@Z)"
1>MAIN.obj : error LNK2019: ссылка на неразрешенный внешний символ "public: void __thiscall ltbl::LightSystem::create(class sf::Rect<float> const &,class sf::Vector2<unsigned int> const &,class sf::Texture const &,class sf::Shader &,class sf::Shader &)" (?create@LightSystem@ltbl@@QAEXABV?$Rect@M@sf@@ABV?$Vector2@I@4@ABVTexture@4@AAVShader@4@3@Z) в функции _main
1>MAIN.obj : error LNK2019: ссылка на неразрешенный внешний символ "public: void __thiscall ltbl::LightSystem::render(class sf::View const &,class sf::Shader &,class sf::Shader &)" (?render@LightSystem@ltbl@@QAEXABVView@sf@@AAVShader@4@1@Z) в функции _main
1>MAIN.obj : error LNK2019: ссылка на неразрешенный внешний символ "public: void __thiscall ltbl::LightSystem::addShape(class std::shared_ptr<class ltbl::LightShape> const &)" (?addShape@LightSystem@ltbl@@QAEXABV?$shared_ptr@VLightShape@ltbl@@@std@@@Z) в функции _main
1>MAIN.obj : error LNK2019: ссылка на неразрешенный внешний символ "public: void __thiscall ltbl::LightSystem::addLight(class std::shared_ptr<class ltbl::LightPointEmission> const &)" (?addLight@LightSystem@ltbl@@QAEXABV?$shared_ptr@VLightPointEmission@ltbl@@@std@@@Z) в функции _main
1>C:\000\LIGHT777\Debug\LIGHT777.exe : fatal error LNK1120: неразрешенных внешних элементов: 8
========== Сборка: успешно: 0, с ошибками: 1, без изменений: 0, пропущено: 0 ==========