Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix sprite sizes #1604

Closed
wants to merge 2 commits into from
Closed

Fix sprite sizes #1604

wants to merge 2 commits into from

Conversation

ghost
Copy link

@ghost ghost commented Sep 27, 2017

HLE sprite sizes were 1pixel smaller than LLE sprite sizes when not in copy mode.
Fixes #936

Edit: I made a mistake while testing yesterday. A second commit was necessary.

S2S added 2 commits September 27, 2017 23:40
Subtracting 1 might not be accurate, but it is done anyway in the rest of the code regarding sprites. Just for the record, implementing correct texture coordinate handling for sprites might need reverting this.
@olivieryuyu
Copy link

olivieryuyu commented Sep 28, 2017

The g[s]SPObjRectangle GBI draws texture for the rectangle area defined by the upper left hand corner screen coordinate (objX, objY), and lower right hand corner screen coordinate (objX+imageW/scaleW-1, objY+imageH/scaleH-1). The drawn texture region will be defined by upper left hand corner (0,0) and lower right hand corner (imageW-1, imageH-1). If scaleW and scaleH are 1 << 10, texture will be drawn with equal proportions, without scaling.

the texture for the rectangle is -1.

https://level42.ca/projects/ultra64/Documentation/man/pro-man/pro25/index25.5.html

@ghost
Copy link
Author

ghost commented Sep 28, 2017

@olivieryuyu Yes, however OpenGL takes the coordinate on the right side of the pixel which is (imageW, imageH), which is handled in gSPDrawObjRect(). Shifting rectangle position by approximately 0.5 almost gives correct results with (imageW, imageH) coordinates, but there are precision errors that make it impossible with current code.

@gonetz
Copy link
Owner

gonetz commented Sep 28, 2017

I put this fix to 'fix_sprite_size' branch. It needs testing. I foresee regressions in 2D games. Good if I'm wrong.

@gonetz
Copy link
Owner

gonetz commented Sep 28, 2017

@AmbientMalice
Copy link
Contributor

AmbientMalice commented Sep 28, 2017

Appears to fix Magical Tetris Challenge #246:

Before:
gliden64_magical_tetris_001

After:
gliden64_magical_tetris_002

LLE is broken in a different way:
gliden64_magical_tetris_003

@olivieryuyu
Copy link

done some tests and if regresssion there is, it is not obvious.

@gonetz
Copy link
Owner

gonetz commented Sep 29, 2017

I'll include it to next WIP build. May be somebody will find something wrong. Otherwise it will be put to master.

@gonetz
Copy link
Owner

gonetz commented Oct 4, 2017

Merged: 8940622

@gonetz gonetz closed this Oct 4, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants