Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UPBGE: Cache polygon center for polygon sort.
Previously during polygon sort, centers of polygon (triangles actually) were computed by the summary of triangle vertices position. But this operation was repeated for each polygon sort. To optimize polygon sort we cache the polygon centers into a the list m_polygonCenters owned by the RAS_IDisplayArray, this list is cleared through a call to InvalidatePolygonCenters each time vertices are moved and that polygons centers are invalid, so the function SortPolygons check if cache size is equivalent to polygons count, if not the cache is regenerated. After this cache check the polygon centers are used as before in a temporary struct which hold the dot product with the camera near plane plus the index of the first vertices in the polygon tested. Tested with one material and 73000 polygons: Rasterizer time: previous: 7.4ms current: 5.6ms
- Loading branch information
1 parent
c24d294
commit 6817669
Showing
8 changed files
with
93 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters