| 341 | } |
| 342 | |
| 343 | std::optional<Geometry> tryLoadGeometry() |
| 344 | { |
| 345 | // Check if geometry shaders are supported |
| 346 | if (!sf::Shader::isGeometryAvailable()) |
| 347 | return std::nullopt; |
| 348 | |
| 349 | // Load the logo texture |
| 350 | sf::Texture logoTexture; |
| 351 | if (!logoTexture.loadFromFile("resources/logo.png")) |
| 352 | return std::nullopt; |
| 353 | |
| 354 | logoTexture.setSmooth(true); |
| 355 | |
| 356 | // Load the shader |
| 357 | sf::Shader shader; |
| 358 | if (!shader.loadFromFile("resources/billboard.vert", "resources/billboard.geom", "resources/billboard.frag")) |
| 359 | return std::nullopt; |
| 360 | |
| 361 | shader.setUniform("texture", sf::Shader::CurrentTexture); |
| 362 | |
| 363 | // Set the render resolution (used for proper scaling) |
| 364 | shader.setUniform("resolution", sf::Vector2f(800, 600)); |
| 365 | |
| 366 | return std::make_optional<Geometry>(std::move(logoTexture), std::move(shader)); |
| 367 | } |
| 368 | |
| 369 | } // namespace |
| 370 |
no test coverage detected