FLATSPRITE discussion
Moderator: Graf Zahl
-
- Developer
- Posts: 240
- Joined: Wed Mar 04, 2009 19:25
Re: FLATSPRITE discussion
...No wonder why it wasn't working! I simply forgot to perform mat.Translate(x,z,y) with mat.Translate(-x, -z, -y) after it.
As for the deleted posts, sorry about that. I thought I discovered something and then realized quickly it wasn't going to work.
As for the deleted posts, sorry about that. I thought I discovered something and then realized quickly it wasn't going to work.
-
- Developer
- Posts: 240
- Joined: Wed Mar 04, 2009 19:25
Re: FLATSPRITE discussion
Alright, roll's done.
I just need to do two more things: Insert DONTFLIP and proper ROLLCENTER support.
The latter has proven to be quite tricky and directly collides with the code used to scale the sprites in that switch statement.
--------------------------------------------------------------------------------------------------------------------------------
Also, this still doesn't fix the splicing issue no matter what way you put it:
Still affects rolling sprites and flat sprites all the same.
I just need to do two more things: Insert DONTFLIP and proper ROLLCENTER support.
The latter has proven to be quite tricky and directly collides with the code used to scale the sprites in that switch statement.
--------------------------------------------------------------------------------------------------------------------------------
Also, this still doesn't fix the splicing issue no matter what way you put it:
Still affects rolling sprites and flat sprites all the same.
Last edited by Rachael on Tue Sep 13, 2016 20:54, edited 3 times in total.
Reason: Removed [spoiler] tag on images - corrected issue with my own editing
Reason: Removed [spoiler] tag on images - corrected issue with my own editing
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: FLATSPRITE discussion
Do you really need DONTFLIP here? Can you give a link to what you are doing? I'd like to comment before you declare it ready.
-
- Developer
- Posts: 240
- Joined: Wed Mar 04, 2009 19:25
Re: FLATSPRITE discussion
https://github.com/MajorCooke/GZDoom/tree/FlatSpritesV3
It's not ready yet for certain. But it's certainly getting closer. However, the sprite offsets are proving to be a problem. That section with the //needs careful rethinking in particular.
And I suppose I could let off with DONTFLIP entirely and turn it into another flag, one that would allow my lightning rotations to be so much easier.
If you want I could make a fake pull request so you can view all the code changed thus far.
I shall pause and await your input before proceeding.
It's not ready yet for certain. But it's certainly getting closer. However, the sprite offsets are proving to be a problem. That section with the //needs careful rethinking in particular.
And I suppose I could let off with DONTFLIP entirely and turn it into another flag, one that would allow my lightning rotations to be so much easier.
If you want I could make a fake pull request so you can view all the code changed thus far.
I shall pause and await your input before proceeding.
- Nash
- Developer
- Posts: 1226
- Joined: Sun Sep 25, 2005 1:49
- Location: Kuala Lumpur, Malaysia
- Contact:
Re: FLATSPRITE discussion
Are you sure this isn't turning into the mish mash of compensations and over-convoluted-ness like what the old thing was (and basically back to square one)? I mean if the sprite splitting is happening again, looks to me that whatever is happening or being done here isn't anything new or improved. Just checking.
-
- Developer
- Posts: 240
- Joined: Wed Mar 04, 2009 19:25
Re: FLATSPRITE discussion
To be completely honest, unsure. Sometimes it feels like a guessing game -- keep trying different things until it starts to work, though thankfully I haven't had to do that most of the time.
What I do understand is the rotation and the scale so far. Now I just need to make the position actually work and respect ROLLCENTER, which is proving to be far more difficult than it sounds.
I know nothing about the slicing issue unfortunately. I don't think any of this will ever address it -- it might be more of something that needs addressing with the scissoring itself, perhaps.
What I do understand is the rotation and the scale so far. Now I just need to make the position actually work and respect ROLLCENTER, which is proving to be far more difficult than it sounds.
I know nothing about the slicing issue unfortunately. I don't think any of this will ever address it -- it might be more of something that needs addressing with the scissoring itself, perhaps.
-
- Developer
- Posts: 240
- Joined: Wed Mar 04, 2009 19:25
Re: FLATSPRITE discussion
Here's a FAKE pull request so everyone can see all the changes in one.
Graf, I'll need input from you before I can continue -- further attempts to make ROLLCENTER and non-centered positioning have not gone over well.
Also... MetaDoom is drawing a lot of attention towards this.
Graf, I'll need input from you before I can continue -- further attempts to make ROLLCENTER and non-centered positioning have not gone over well.
Also... MetaDoom is drawing a lot of attention towards this.
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: FLATSPRITE discussion
Please make a real pull request. I cannot access the necessary information from this one to merge it into my code base for testing.
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: FLATSPRITE discussion
One thing I can tell you outright:
Sorry, but no. This is dead wrong and will never work. That's why it was disabled. You cannot use face sprite projection to determine the rotation being used here.
Code: Select all
{
- // Flat sprites cannot rotate in a predictable manner.
- patch = gl_GetSpriteFrame(spritenum, thing->frame, 0, 0, &mirror);
+ patch = gl_GetSpriteFrame(spritenum, thing->frame, -1, (ang - (thing->Angles.Yaw + thing->SpriteRotation)).BAMs(), &mirror);
-
- Developer
- Posts: 240
- Joined: Wed Mar 04, 2009 19:25
Re: FLATSPRITE discussion
Reversed.
-
- Developer
- Posts: 240
- Joined: Wed Mar 04, 2009 19:25
Re: FLATSPRITE discussion
I've pushed another commit. While ROLLCENTER works, the inverse does not. Currently toying with order of rotations to achieve its old effect.
And one thing to note in case if it's more important than I realize:
I replaced the z1 and z2 with just z because I couldn't get it flat otherwise.
Code: Select all
Actor A
{
+NOINTERACTION
+ROLLSPRITE
+FLATSPRITE
+DONTFLIP
+SPRITEANGLE
+ROLLCENTER
States
{
Spawn:
HEAD A 1
{
angle += 1;
angle %= 360;
pitch = 45;
A_SetRoll(roll + 20,SPF_INTERPOLATE);
roll %= 360;
}
Loop
}
}
Code: Select all
v[0] = mat * FVector3(x1, z, y1);
v[1] = mat * FVector3(x1, z, y2);
v[2] = mat * FVector3(x2, z, y1);
v[3] = mat * FVector3(x2, z, y2);
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: FLATSPRITE discussion
Obviously for an unrotated flat sprite z must be the same in all 4 corners, so no surprise here.
-
- Developer
- Posts: 240
- Joined: Wed Mar 04, 2009 19:25
Re: FLATSPRITE discussion
Okay, I'm out of ideas. I need some help here. https://github.com/coelckers/gzdoom/pull/99
I'm attempting to offset the sprite by its offsets but this isn't working out at all.
I'm trying to make it respect the natural offsets but this is just giving me a giant headache.
I'm attempting to offset the sprite by its offsets but this isn't working out at all.
I'm trying to make it respect the natural offsets but this is just giving me a giant headache.
Code: Select all
if (!(actor->renderflags & RF_ROLLCENTER))
{
float cz = (-z + (z1 + z2) * 0.5) + (z2 - z1) * 0.5;
float cy = -y + (y1 + y2) * 0.5;
float cx = -x + (x1 + x2) * 0.5;
mat.Translate(cx, cz, cy);
mat.Rotate(0, 1, 0, actor->Angles.Yaw.Degrees);
//mat.Translate(-cx, -cz, -cy);
mat.Rotate(0, 0, 1, -actor->Angles.Pitch.Degrees);
//mat.Translate(cx, cz, cy);
mat.Rotate(0, 1, 0, actor->Angles.Roll.Degrees);
mat.Translate(-cx, -cz, -cy);
}
- Graf Zahl
- GZDoom Developer
- Posts: 7148
- Joined: Wed Jul 20, 2005 9:48
- Location: Germany
- Contact:
Re: FLATSPRITE discussion
I see one big error in here. When you calculate the initial coordinates you use leftfac and rightfac to offset x and y. But these are only the x-offset. For y you need to do the same calculations with the sprite's y-offset (think topfac and bottomfac.)
That causes the sprite to get placed incorrectly and all rotations around the pivot will fail.
That causes the sprite to get placed incorrectly and all rotations around the pivot will fail.