HackerN64 / HackerN64/HackerSM64

Optimize surface collision checks and `break` when upperY/lowerY is out of bounds

Open
#174 4 comments 0 reactions 0 assignees View on GitHub
enhancement monkaS needs verification performance
Dominant language
C
Stars
529
Forks
209
Avg merge
1d 12h
Merged PRs (30d)
1

Description

Right now collision checks will continue after finding a floor or ceil to be very certain that a another tri shouldn't have been hit instead.

In `find_floor_from_list`, it seems that having `if (floor && surf->upperY < floor->lowerY) break;` at the top of the loop could improve performance. This is a good check because it insures that you have found a floor, and that the current floors highest point is lower than the previously collided floor's lowest point. And because of sort order, there's no reason to continue checking after this point.

The same but reversed could be done for ceilings.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.