| 360 | } |
| 361 | |
| 362 | Primitive::Ptr Renderer::CreateTriangle( const sf::Vector2f& point0, const sf::Vector2f& point1, const sf::Vector2f& point2, const sf::Color& color ) { |
| 363 | auto primitive = std::make_shared<Primitive>( 3 ); |
| 364 | |
| 365 | PrimitiveVertex vertex0; |
| 366 | PrimitiveVertex vertex1; |
| 367 | PrimitiveVertex vertex2; |
| 368 | |
| 369 | vertex0.position = point0; |
| 370 | vertex1.position = point1; |
| 371 | vertex2.position = point2; |
| 372 | |
| 373 | vertex0.color = color; |
| 374 | vertex1.color = color; |
| 375 | vertex2.color = color; |
| 376 | |
| 377 | vertex0.texture_coordinate = sf::Vector2f( 0.f, 0.f ); |
| 378 | vertex1.texture_coordinate = sf::Vector2f( 0.f, 1.f ); |
| 379 | vertex2.texture_coordinate = sf::Vector2f( 1.f, 0.f ); |
| 380 | |
| 381 | primitive->AddVertex( vertex0 ); |
| 382 | primitive->AddVertex( vertex1 ); |
| 383 | primitive->AddVertex( vertex2 ); |
| 384 | |
| 385 | AddPrimitive( primitive ); |
| 386 | |
| 387 | return primitive; |
| 388 | } |
| 389 | |
| 390 | Primitive::Ptr Renderer::CreateSprite( const sf::FloatRect& rect, PrimitiveTexture::Ptr texture, const sf::FloatRect& subrect, int rotation_turns ) { |
| 391 | auto offset = texture->offset; |
no test coverage detected