MCPcopy Create free account
hub / github.com/NazaraEngine/NazaraEngine / SortForOrthographic

Method SortForOrthographic

src/Nazara/Graphics/ForwardRenderQueue.cpp:729–755  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

727 }
728
729 void ForwardRenderQueue::SortForOrthographic(const AbstractViewer * viewer)
730 {
731 Planef nearPlane = viewer->GetFrustum().GetPlane(FrustumPlane_Near);
732
733 for (auto& pair : layers)
734 {
735 Layer& layer = pair.second;
736
737 std::sort(layer.depthSortedMeshes.begin(), layer.depthSortedMeshes.end(), [&layer, &nearPlane] (std::size_t index1, std::size_t index2)
738 {
739 const Spheref& sphere1 = layer.depthSortedMeshData[index1].obbSphere;
740 const Spheref& sphere2 = layer.depthSortedMeshData[index2].obbSphere;
741
742 return nearPlane.Distance(sphere1.GetPosition()) < nearPlane.Distance(sphere2.GetPosition());
743 });
744
745 std::sort(layer.depthSortedSprites.begin(), layer.depthSortedSprites.end(), [&layer, &nearPlane] (std::size_t index1, std::size_t index2)
746 {
747 const Vector3f& pos1 = layer.depthSortedSpriteData[index1].vertices[0].position;
748 const Vector3f& pos2 = layer.depthSortedSpriteData[index2].vertices[0].position;
749
750 return nearPlane.Distance(pos1) < nearPlane.Distance(pos2);
751 });
752
753 SortBillboards(layer, nearPlane);
754 }
755 }
756
757 void ForwardRenderQueue::SortForPerspective(const AbstractViewer* viewer)
758 {

Callers

nothing calls this directly

Calls 3

beginMethod · 0.45
endMethod · 0.45
GetPositionMethod · 0.45

Tested by

no test coverage detected