| 361 | } |
| 362 | |
| 363 | void TextRender::Draw(RenderContext& renderContext) |
| 364 | { |
| 365 | if (renderContext.View.Pass == DrawPass::GlobalSDF) |
| 366 | return; // TODO: Text rendering to Global SDF |
| 367 | if (renderContext.View.Pass == DrawPass::GlobalSurfaceAtlas) |
| 368 | return; // TODO: Text rendering to Global Surface Atlas |
| 369 | if (_isDirty) |
| 370 | UpdateLayout(); |
| 371 | Matrix world; |
| 372 | renderContext.View.GetWorldMatrix(_transform, world); |
| 373 | GEOMETRY_DRAW_STATE_EVENT_BEGIN(_drawState, world); |
| 374 | |
| 375 | const DrawPass drawModes = DrawModes & renderContext.View.Pass & renderContext.View.GetShadowsDrawPassMask(ShadowsMode); |
| 376 | if (_vb.Data.Count() > 0 && drawModes != DrawPass::None) |
| 377 | { |
| 378 | // Flush buffers |
| 379 | if (_buffersDirty) |
| 380 | { |
| 381 | _buffersDirty = false; |
| 382 | _ib.Flush(); |
| 383 | _vb.Flush(); |
| 384 | } |
| 385 | |
| 386 | // Setup draw call |
| 387 | DrawCall drawCall; |
| 388 | drawCall.World = world; |
| 389 | drawCall.ObjectPosition = drawCall.World.GetTranslation(); |
| 390 | drawCall.ObjectRadius = (float)_sphere.Radius; |
| 391 | drawCall.Surface.GeometrySize = _localBox.GetSize(); |
| 392 | drawCall.Surface.PrevWorld = _drawState.PrevWorld; |
| 393 | drawCall.PerInstanceRandom = GetPerInstanceRandom(); |
| 394 | drawCall.SetStencilValue(_layer); |
| 395 | drawCall.Geometry.IndexBuffer = _ib.GetBuffer(); |
| 396 | drawCall.Geometry.VertexBuffers[0] = _vb.GetBuffer(); |
| 397 | drawCall.InstanceCount = 1; |
| 398 | |
| 399 | // Submit draw calls |
| 400 | for (const auto& e : _drawChunks) |
| 401 | { |
| 402 | const DrawPass chunkDrawModes = drawModes & e.Material->GetDrawModes(); |
| 403 | if (chunkDrawModes == DrawPass::None) |
| 404 | continue; |
| 405 | drawCall.Draw.IndicesCount = e.IndicesCount; |
| 406 | drawCall.Draw.StartIndex = e.StartIndex; |
| 407 | drawCall.Material = e.Material; |
| 408 | renderContext.List->AddDrawCall(renderContext, chunkDrawModes, GetStaticFlags(), drawCall, true, SortOrder); |
| 409 | } |
| 410 | } |
| 411 | |
| 412 | GEOMETRY_DRAW_STATE_EVENT_END(_drawState, world); |
| 413 | } |
| 414 | |
| 415 | #if USE_EDITOR |
| 416 |
nothing calls this directly
no test coverage detected