| 398 | } |
| 399 | |
| 400 | void Renderer::DrawLines2D() |
| 401 | { |
| 402 | SetBlendMode(BlendMode::Opaque); |
| 403 | SetDepthState(DepthState::Read); |
| 404 | SetCullMode(CullMode::None); |
| 405 | |
| 406 | _shaders.Bind(Shader::Solid); |
| 407 | auto worldMatrix = Matrix::CreateOrthographicOffCenter(0, _screenWidth, _screenHeight, 0, _viewport.MinDepth, _viewport.MaxDepth); |
| 408 | |
| 409 | _context->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_LINELIST); |
| 410 | |
| 411 | _primitiveBatch->Begin(); |
| 412 | |
| 413 | for (const auto& line : _lines2DToDraw) |
| 414 | { |
| 415 | auto vertex0 = Vertex{}; |
| 416 | vertex0.Position.x = line.Origin.x; |
| 417 | vertex0.Position.y = line.Origin.y; |
| 418 | vertex0.Position.z = 1.0f; |
| 419 | vertex0.Color = VectorColorToRGBA_TempToVector4(line.Color); |
| 420 | |
| 421 | auto vertex1 = Vertex{}; |
| 422 | vertex1.Position.x = line.Target.x; |
| 423 | vertex1.Position.y = line.Target.y; |
| 424 | vertex1.Position.z = 1.0f; |
| 425 | vertex1.Color = VectorColorToRGBA_TempToVector4(line.Color); |
| 426 | |
| 427 | vertex0.Position = Vector3::Transform(vertex0.Position, worldMatrix); |
| 428 | vertex1.Position = Vector3::Transform(vertex1.Position, worldMatrix); |
| 429 | vertex0.Position.z = 0.5f; |
| 430 | vertex1.Position.z = 0.5f; |
| 431 | |
| 432 | _numLinesDrawCalls++; |
| 433 | _numDrawCalls++; |
| 434 | } |
| 435 | |
| 436 | _primitiveBatch->End(); |
| 437 | |
| 438 | SetBlendMode(BlendMode::Opaque); |
| 439 | SetCullMode(CullMode::CounterClockwise); |
| 440 | } |
| 441 | |
| 442 | void Renderer::DrawSpiders(RenderView& view, RendererPass rendererPass) |
| 443 | { |
nothing calls this directly
no test coverage detected