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

Function ComputeDistanceSortKey

Source/Engine/Graphics/RenderTools.h:137–141  ·  view source on GitHub ↗

Computes the sorting key for depth value (quantized) Reference: http://aras-p.info/blog/2014/01/16/rough-sorting-by-depth/

Source from the content-addressed store, hash-verified

135 /// Reference: http://aras-p.info/blog/2014/01/16/rough-sorting-by-depth/
136 /// </summary>
137 FORCE_INLINE static uint32 ComputeDistanceSortKey(float distance)
138 {
139 const uint32 distanceI = *((uint32*)&distance);
140 return ((uint32)(-(int32)(distanceI >> 31)) | 0x80000000) ^ distanceI;
141 }
142
143 // Calculates the update frequency and phrase for the given cached data (eg. cascaded shadow map or global sdf cascade contents). Lower data indices are updated first and more frequent.
144 static void ComputeCascadeUpdateFrequency(int32 cascadeIndex, int32 cascadeCount, int32& updateFrequency, int32& updatePhrase, int32 updateMaxCountPerFrame = 1);

Callers 2

CalculateSortKeyFunction · 0.85
DrawEmitterCPUFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected