MCPcopy Create free account
hub / github.com/FlaxEngine/FlaxEngine / Draw

Method Draw

Source/Engine/UI/TextRender.cpp:363–413  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

361}
362
363void 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

Callers

nothing calls this directly

Calls 9

GetStaticFlagsFunction · 0.85
AddDrawCallMethod · 0.80
GetWorldMatrixMethod · 0.45
CountMethod · 0.45
FlushMethod · 0.45
GetSizeMethod · 0.45
SetStencilValueMethod · 0.45
GetBufferMethod · 0.45
GetDrawModesMethod · 0.45

Tested by

no test coverage detected