Level and screen projections (now with resize handling)
Forum rules
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
The Projects forums are only for projects. If you are asking questions about a project, either find that project's thread, or start a thread in the General section instead.
Got a cool project idea but nothing else? Put it in the project ideas thread instead!
Projects for any Doom-based engine (especially 3DGE) are perfectly acceptable here too.
Please read the full rules for more details.
-
-
- Posts: 17454
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
-
-
- Posts: 596
- Joined: Thu Jul 05, 2007 6:13 pm
- Location: my laboratory
Re: Level and screen projections (now with resize handling)
Hmhmhm... that fixes the issue. I've made adjustments so no minus signs are necessary anywhere. Reorient is supposed to store a view basis, so sign business should not be needed. I updated the file.
I've made an amusing mistake in the opengl one. The vector supposed to point right was pointing left, but I did it correctly for software. Maybe I had my brain on airplane mode.
Aside from that, I'm happy to see several mods making use of this. I'm especially satisfied the ease of use is noted. I was a little afraid the ceremony with the cache resolution, fov, orient would be a bit out there, but I see that hiding all the maths business did the trick well enough.
I worked about 5 times as long making this usable than making it work. x]
I've made an amusing mistake in the opengl one. The vector supposed to point right was pointing left, but I did it correctly for software. Maybe I had my brain on airplane mode.
If there's greater interest.m8f wrote:Will there be a git repository for libeye? One may want to submodule it.
Aside from that, I'm happy to see several mods making use of this. I'm especially satisfied the ease of use is noted. I was a little afraid the ceremony with the cache resolution, fov, orient would be a bit out there, but I see that hiding all the maths business did the trick well enough.
I worked about 5 times as long making this usable than making it work. x]
-
-
- Posts: 17454
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: Level and screen projections (now with resize handling)
There's room for improvements for sure, maybe you could group all of those calls into a single function that takes in the necessary arguments to pass to the various subfunctions?KeksDose wrote:I was a little afraid the ceremony with the cache resolution, fov, orient would be a bit out there
Anyway, current system is fine, don't mistake that as a request. :) I'd settle with whatever we already have now, it's damn easy to use already as it is. =P Good work, and thanks for this amazing library again!
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Level and screen projections (now with resize handling)
Yes, a git would be very nice.
If there's something I would love, is the ability to scale a projection based on distance like regular sprites. Is there any good way to do that with your code?
If there's something I would love, is the ability to scale a projection based on distance like regular sprites. Is there any good way to do that with your code?
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Level and screen projections (now with resize handling)
Bug report: Saves fail due to cvar_renderer not being transient.
-
-
- Posts: 596
- Joined: Thu Jul 05, 2007 6:13 pm
- Location: my laboratory
Re: Level and screen projections (now with resize handling)
I'll fix that later, since it's just an example. The projector has a function Distance for the distance of the position you passed in, to your viewpoint. Scale based on that like so:
Use your wits in determining whether distance can be 0 and proceed with care.
Code: Select all
proj.ProjectWorldPos((x, y, z));
let scale = 300.0 / proj.Distance();
// Draw stuff, but you gotta know how to scale it yourself.
-
-
- Posts: 596
- Joined: Thu Jul 05, 2007 6:13 pm
- Location: my laboratory
Re: Level and screen projections (now with resize handling)
Made a small update.
1. There's a new function for projectors.
2. There's now OrientForRenderUnderlay. It does the same thing as for RenderOverlay, but it has a more fitting name, now that RenderUnderlay is a thing (and who knows what can happen that makes future me thank myself for adding a new function).
You may use the strangely named RenderUnderlay to draw things below the hud.
edit: Forgot about software mode. Made an update just now.
1. There's a new function for projectors.
Code: Select all
// ProjectActorPos (Actor, offset, fraction of tic)
// ProjectActorPosPortal (same thing, but is portal aware)
// Example:
override void RenderOverlay (RenderEvent event) {
proj.OrientForRenderOverlay(event);
proj.BeginProjection();
proj.ProjectActorPos(target, (0, 0, 0.5 * target.height), event.fractic);
let draw_pos = proj.ToScreen();
// etc.
}
// This projects the actor's interpolated position, so the appearance is smoothed
// when the actor moves. By default, offset is (0, 0, 0), t is 1.
You may use the strangely named RenderUnderlay to draw things below the hud.
edit: Forgot about software mode. Made an update just now.
-
-
- Posts: 17454
- Joined: Mon Oct 27, 2003 12:07 am
- Location: Kuala Lumpur, Malaysia
Re: Level and screen projections (now with resize handling)
Thanks for the update! Importing into my project right away. :D
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Level and screen projections (now with resize handling)
Don't think too hard on it. The name implies going underneath the layer of huds.KeksDose wrote:strangely named RenderUnderlay
-
-
- Posts: 596
- Joined: Thu Jul 05, 2007 6:13 pm
- Location: my laboratory
Re: Level and screen projections (now with resize handling)
Maybe you'd like to a little harder think about why I called it strangely named, given it has "under" in the name. What other on screen element remains that RenderUnderlay draws over? That's what makes it strangely named.
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Level and screen projections (now with resize handling)
None. Because it's the very bottom. Hence "underlay". Theoretically you could count the game world itself but I don't.
-
-
- Posts: 596
- Joined: Thu Jul 05, 2007 6:13 pm
- Location: my laboratory
Re: Level and screen projections (now with resize handling)
On topic: For those who haven't seen it, consider taking a look at the innards of the Sandman from the Guncaster addon (warning, volume). It's the reason this library exists after all, and is a pretty thorough and practical example of implementing a Smart Gun as seen in Aliens, though it's obviously powered up a great deal hmhm
@MC: That'd be nigh useless. Try to think why the name RenderUnderlay forces you to confirm whether it draws above or below weapons. Far from a big deal (even if everybody I talked to about this was surprised it draws over weapons, still), but then again, all I'm saying is "Under" isn't precise enough. I'll have to ask you to take it elsewhere now cuz I'm not willing to go on this worthless tangent any longer.
@MC: That'd be nigh useless. Try to think why the name RenderUnderlay forces you to confirm whether it draws above or below weapons. Far from a big deal (even if everybody I talked to about this was surprised it draws over weapons, still), but then again, all I'm saying is "Under" isn't precise enough. I'll have to ask you to take it elsewhere now cuz I'm not willing to go on this worthless tangent any longer.
-
- Posts: 8193
- Joined: Sun Jan 28, 2007 3:55 pm
- Preferred Pronouns: He/Him
- Location: QZDoom Maintenance Team
Re: Level and screen projections (now with resize handling)
I stopped caring about the naming stuff after my last post anyway.
So this includes the interpolation we discussed? And, think you're going to put this on github anytime soon? That way viewing the changes is easier.
So this includes the interpolation we discussed? And, think you're going to put this on github anytime soon? That way viewing the changes is easier.
-
- Posts: 1606
- Joined: Mon Jun 12, 2017 12:57 am
Re: Level and screen projections (now with resize handling)
Please add license terms in original post aka "can I use/modify/share it".
And also more comments to code, so users can "poke it with greasy fingers" more freely.
And also more comments to code, so users can "poke it with greasy fingers" more freely.
-
-
- Posts: 596
- Joined: Thu Jul 05, 2007 6:13 pm
- Location: my laboratory
Re: Level and screen projections (now with resize handling)
mc thats why i posted the update
@Apeirogon: There aren't any terms except a gentlemen's agreement to leave a note with a text image intact. You may do whatever you like with it then.
If you're unsure about something, feel free to ask here. I can't hope to cover every possible question with comments.
@Apeirogon: There aren't any terms except a gentlemen's agreement to leave a note with a text image intact. You may do whatever you like with it then.
If you're unsure about something, feel free to ask here. I can't hope to cover every possible question with comments.