performance(Drawable): Rework for IterateDrawablesInRegion Functions for both GameClient and W3DView to be more Efficient#2044
Conversation
xezon
left a comment
There was a problem hiding this comment.
I glanced over it and I see it does add quite a bit of complexity and GameClient is now at the mercy of other systems properly registering and unregistering drawables. The first question here is, does the Game (and WorldBuilder?) still work normal? The second question is, how big are the performance gains here? If you can, please provide frame ms time comparison.
Code needs cleaning. No commented and compiled out code should be left.
| normalizedRegion.lo.x = (INT_TO_REAL(screenRegion->lo.x - m_originX) / INT_TO_REAL(getWidth())) * 2.0f - 1.0f; | ||
| normalizedRegion.lo.y = -((INT_TO_REAL(screenRegion->hi.y - m_originY) / INT_TO_REAL(getHeight())) * 2.0f - 1.0f); | ||
| normalizedRegion.hi.x = (INT_TO_REAL(screenRegion->hi.x - m_originX) / INT_TO_REAL(getWidth())) * 2.0f - 1.0f; | ||
| normalizedRegion.hi.y = -((INT_TO_REAL(screenRegion->lo.y - m_originY) / INT_TO_REAL(getHeight())) * 2.0f - 1.0f); |
|
The code is tested playing against multiple AIs in Skirmish on both Vanilla and Contra Mod with both Saving and Loading, so it should be fine in game. I haven't tested on WorldBuilder, but it should not have any issues. Moving the camera or Adjusting the Positions should account whether an object is within the screen region for iteration. I will have to check for the performance gains, but I do notice it being a bit lag-free during the testing sessions. |
To use the features, RETAIL_COMPATIBLE_DRAWUPDATE must be set to 0. The feature is Retail Xfer Compatible, but might require checking. RETAIL_COMPATIBLE_DRAWUPDATE can be removed once the check is done.
Above directly addresses the Issue - #1502