Page 1 of 1

Rolling Issues

Posted: Mon Jul 04, 2016 4:57
by Major Cooke
Sprite X15AA0, as one can see from opening this file, should be rotating around the dead center of the offset pivot instead of rotating the center of the picture itself. Even giving it a hard physical canvas of 514 x 514 didn't work unfortunately.

It's only a rolling sprite too -- that part of Nash's code I didn't touch.

Summon A in console.

When I added a tiny opaque pixel on the other end of the picture where it was all blank, it began working more properly like it should -- that shouldn't have to happen though.

Re: Rolling Issues

Posted: Mon Jul 04, 2016 8:34
by Graf Zahl
Looks like the billboarding system had been broken forever:

Code: Select all

				mat.Translate(xcenter, zcenter, ycenter); // move to sprite center

				...

				mat.Translate(-xcenter, -zcenter, -ycenter); // retreat from sprite center
Of course this needs to use the pivot, not the center. I just wonder how this will affect anything older...

Re: Rolling Issues

Posted: Mon Jul 04, 2016 13:43
by Major Cooke
I could do some testing for you if you want. What would I use to get the pivots?

Also, if needed we could introduce another flag to toggle between using pivots and actual center.

Re: Rolling Issues

Posted: Mon Jul 04, 2016 16:48
by Graf Zahl
The pivot is stored in x,y,z.
Feel free to test with this. I won't be able to do anything for the next week because I am on vacation.

Re: Rolling Issues

Posted: Mon Jul 04, 2016 18:23
by Major Cooke
Well that was easier than expected. Just needed to remove the sprite center and add x/y/z to it, translate it, and then translate back once finished. This way, the billboarding is left untouched.

Code: Select all

else if (drawRollSpriteActor)
				{
					float xx = -xcenter + x;
					float yy = -zcenter + z;
					float zz = -ycenter + y;
					mat.Translate(xx, yy, zz);
					if (drawWithXYBillboard)
					{
						mat.Rotate(-sin(angleRad), 0, cos(angleRad), -GLRenderer->mAngles.Pitch.Degrees);
					}
					mat.Rotate(cos(angleRad), 0, sin(angleRad), rollDegrees);
					mat.Translate(-xx, -yy, -zz);
				}
Question is though, I can see modders using either means -- from the sprite center or the pivots -- as both are useful. Should I add a flag that switches to one, or just make it the default implementation?

Re: Rolling Issues

Posted: Mon Jul 04, 2016 18:46
by Graf Zahl
Both may be what's desired so an option would be best here.

Re: Rolling Issues

Posted: Mon Jul 04, 2016 20:05
by Major Cooke
https://github.com/coelckers/gzdoom/pull/57/files
https://github.com/rheit/zdoom/pull/715/files

Done. This also fixes pitch being backwards on flatsprites. (Yes, I know, a little ugly... but unfortunately, I tried other methods and they just didn't work out somehow.)

Re: Rolling Issues

Posted: Tue Jul 12, 2016 21:37
by Major Cooke
Also, flat sprites will now disable camera facing.

Because this is problematic.
Spoiler: Not Facing Camera
Spoiler: Facing Camera
(That's basically a straight laser beam using perfectly angled/rolled/pitched sprites, which is distorted whenever camera facing is enabled.)

Re: Rolling Issues

Posted: Tue Jul 12, 2016 22:59
by Graf Zahl
For flat sprites, camera facing is flat out wrong, as the whole concept implies a specific orientation towards the world.

Re: Rolling Issues

Posted: Wed Jul 13, 2016 0:04
by Major Cooke
Agreed. It's in my commit too. Any time someone applies +FLATSPRITE it will ignore all camera facing instructions.

Anyway, how's it look otherwise?