bool Render::Initialize(int width, int height) { m_bufferWidth = width; m_bufferHeight = height; UpdateViewHeightFromBuffer(); std::unique_ptr<Shader> overdraw(new Shader()); overdraw->AddDynamicMeshCommonSubShaders(); if(!overdraw->LoadFromFileDerivedNames("OverdrawRainbow")) { return false; } m_pOverdrawQuaxol = overdraw.release(); std::unique_ptr<Shader> sliced(new Shader()); sliced->AddDynamicMeshCommonSubShaders(); if(!sliced->LoadFromFileDerivedNames("Sliced")) { return false; } m_pSlicedQuaxol = sliced.release(); std::unique_ptr<Shader> compose(new Shader()); if(!compose->LoadFromFile( "Compose", "data/uivCompose.glsl", "data/uifCompose.glsl")) { return false; } m_pComposeRenderTargets = compose.release(); if(!ResizeRenderTargets(width, height)) return false; if(!InitializeComposeVerts()) return false; return true; }
namespace impl { static auto letters(int amount) { return "ABCDEFGHIJKLMNOPQRSTUVWXYZ"s.substr(0, amount); } static auto spaces_after(int amount) { return irange(0, amount) | transformed(construct<string>(_1, ' ')); } static auto spaces_before(int amount) { return spaces_after(amount) | reversed; } static auto concat(const SpacesAndLetter& spaces_and_letter) { return fold(spaces_and_letter, string{""}, _1 + _2); } static const auto mirror_vertical = [](const auto& lines) { return lines | transformed(_1 + construct<string>(rbegin(_1) + 1, rend(_1))); }; static const auto mirror_horizontal = [](const auto& lines) { return join(lines, lines | sliced(0, size(lines) - 1) | reversed); }; static auto all_lines(int amount) { return mirror_horizontal(mirror_vertical(Diamond::lines(amount))); } }