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

Method AddDrawCall

Source/Engine/Renderer/RenderList.cpp:659–698  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657}
658
659void RenderList::AddDrawCall(const RenderContext& renderContext, DrawPass drawModes, StaticFlags staticFlags, DrawCall& drawCall, bool receivesDecals, int8 sortOrder)
660{
661#if ENABLE_ASSERTION_LOW_LAYERS
662 // Ensure that draw modes are non-empty and in conjunction with material draw modes
663 auto materialDrawModes = drawCall.Material->GetDrawModes();
664 ASSERT_LOW_LAYER(drawModes != DrawPass::None && ((uint32)drawModes & ~(uint32)materialDrawModes) == 0);
665#endif
666
667 // Finalize draw call initialization
668 drawCall.WorldDeterminant = drawCall.World.RotDeterminant() < 0 ? 1 : 0;
669 CalculateSortKey(renderContext, drawCall, sortOrder);
670
671 // Append draw call data
672 const int32 index = DrawCalls.Add(drawCall);
673
674 // Add draw call to proper draw lists
675 if ((drawModes & DrawPass::Depth) != DrawPass::None)
676 {
677 DrawCallsLists[(int32)DrawCallsListType::Depth].Indices.Add(index);
678 }
679 if ((drawModes & (DrawPass::GBuffer | DrawPass::GlobalSurfaceAtlas)) != DrawPass::None)
680 {
681 if (receivesDecals)
682 DrawCallsLists[(int32)DrawCallsListType::GBuffer].Indices.Add(index);
683 else
684 DrawCallsLists[(int32)DrawCallsListType::GBufferNoDecals].Indices.Add(index);
685 }
686 if ((drawModes & DrawPass::Forward) != DrawPass::None)
687 {
688 DrawCallsLists[(int32)DrawCallsListType::Forward].Indices.Add(index);
689 }
690 if ((drawModes & DrawPass::Distortion) != DrawPass::None)
691 {
692 DrawCallsLists[(int32)DrawCallsListType::Distortion].Indices.Add(index);
693 }
694 if ((drawModes & DrawPass::MotionVectors) != DrawPass::None && (staticFlags & StaticFlags::Transform) == StaticFlags::None)
695 {
696 DrawCallsLists[(int32)DrawCallsListType::MotionVectors].Indices.Add(index);
697 }
698}
699
700void RenderList::AddDrawCall(const RenderContextBatch& renderContextBatch, DrawPass drawModes, StaticFlags staticFlags, ShadowsCastingMode shadowsMode, const BoundingSphere& bounds, DrawCall& drawCall, bool receivesDecals, int8 sortOrder)
701{

Callers 7

DrawEmitterCPUFunction · 0.80
DrawEmittersGPUFunction · 0.80
DrawMethod · 0.80
DrawMethod · 0.80
DrawMethod · 0.80
DrawMethod · 0.80
DrawMethod · 0.80

Calls 9

CalculateSortKeyFunction · 0.85
SquareFunction · 0.85
RotDeterminantMethod · 0.80
GetDrawModesMethod · 0.45
AddMethod · 0.45
GetMethod · 0.45
IntersectsMethod · 0.45
CountMethod · 0.45

Tested by

no test coverage detected