3 #include <BLIB/Render.hpp>
14 constexpr
float IntroLength = 1.6f;
15 bool pipelineCreated =
false;
16 constexpr std::array<glm::vec4, 6> BarColors = {glm::vec4(235.f, 64.f, 52.f, 255.f) / 255.f,
17 glm::vec4(38.f, 168.f, 34.f, 255.f) / 255.f,
18 glm::vec4(240.f, 185.f, 77.f, 255.f) / 255.f,
19 glm::vec4(39.f, 86.f, 217.f, 255.f) / 255.f,
20 glm::vec4(219.f, 219.f, 9.f, 255.f) / 255.f,
21 glm::vec4(219.f, 9.f, 202.f, 255.f) / 255.f};
23 struct FragmentUniform {
30 using Bindings = bl::rc::ds::Bindings<bl::rc::ds::GlobalUniformBuffer<FragmentUniform>>;
31 using Factory = bl::rc::ds::GenericDescriptorSetFactory<Bindings, VK_SHADER_STAGE_FRAGMENT_BIT>;
32 using Instance = bl::rc::ds::GenericDescriptorSetInstance<Bindings>;
45 if (!pipelineCreated) {
46 pipelineCreated =
true;
48 bl::rc::vk::PipelineParameters params;
49 params.withSimpleDepthStencil(
false)
50 .withPrimitiveType(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST)
51 .addDescriptorSet<bl::rc::ds::Scene2DFactory>()
52 .addDescriptorSet<bl::rc::ds::Object2DFactory>()
53 .addDescriptorSet<Factory>()
54 .withShaders(bl::rc::Config::ShaderIds::Vertex2D,
55 "Resources/Shaders/Battle/wildIntro.frag.spv");
60 auto overlay = engine.renderer().getObserver().getOrCreateSceneOverlay();
64 background.addToSceneWithCustomPipeline(
67 Instance& set = overlay->getDescriptorSet<Instance>();
68 FragmentUniform& uni = set.getBindingPayload<FragmentUniform>();
70 uni.colors = BarColors;
78 constexpr
float ShuffleTime = 0.085f;
83 FragmentUniform* u =
static_cast<FragmentUniform*
>(uniform);
84 const sf::Vector2u ws = e->window().getSfWindow().getSize();
85 u->progress = time / IntroLength;
86 u->windowSize.x =
static_cast<float>(ws.x);
87 u->windowSize.y =
static_cast<float>(ws.y);
89 if (shuffleTime >= ShuffleTime) {
90 u->base = (u->base + 1) % BarColors.size();
std::array< glm::vec4, 6 > colors
Parent namespace for all functionality unique to the game.
static sf::Vector2f WindowSize()
static constexpr std::uint32_t WildIntroPipelineId
virtual void start(bl::engine::Engine &engine) override
virtual void update(float dt) override
virtual bool finished() const override