Level and screen projections (now with resize handling)

Post your example zscripts/ACS scripts/etc here.

Re: Level and screen projections (now with resize handling)

Postby Nash » Sat Jun 01, 2019 5:33 am

I think roll may be inverted in LibEye... consider the following:



Current behaviour VS fixed behaviour:




Seems like using a positive roll value in OrientForRenderOverlay/Player fixes it.
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Level and screen projections (now with resize handling)

Postby KeksDose » Sat Jun 01, 2019 8:48 am

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.

m8f wrote:Will there be a git repository for libeye? One may want to submodule it.

If there's greater interest.

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]
User avatar
KeksDose
Praise Mima and the Moon
 
Joined: 06 Jul 2007

Re: Level and screen projections (now with resize handling)

Postby Nash » Sat Jun 01, 2019 11:28 am

KeksDose wrote:I was a little afraid the ceremony with the cache resolution, fov, orient would be a bit out there


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?

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!
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Level and screen projections (now with resize handling)

Postby Major Cooke » Sun Jun 23, 2019 2:33 pm

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?
User avatar
Major Cooke
d = klabs(wall[wall[wall[sector[dasect].wallptr].point2].point2].x-s->x)...
 
Joined: 28 Jan 2007

Re: Level and screen projections (now with resize handling)

Postby Major Cooke » Mon Jun 24, 2019 6:45 am

Bug report: Saves fail due to cvar_renderer not being transient.
User avatar
Major Cooke
d = klabs(wall[wall[wall[sector[dasect].wallptr].point2].point2].x-s->x)...
 
Joined: 28 Jan 2007

Re: Level and screen projections (now with resize handling)

Postby KeksDose » Tue Jun 25, 2019 2:12 pm

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:

Code: Select allExpand view
proj.ProjectWorldPos((x, y, z));
let scale = 300.0 / proj.Distance();

// Draw stuff, but you gotta know how to scale it yourself.   

Use your wits in determining whether distance can be 0 and proceed with care.
User avatar
KeksDose
Praise Mima and the Moon
 
Joined: 06 Jul 2007

Re: Level and screen projections (now with resize handling)

Postby KeksDose » Sat Jul 27, 2019 11:35 am

Made a small update.

1. There's a new function for projectors.

Code: Select allExpand view
// 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.     


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.
User avatar
KeksDose
Praise Mima and the Moon
 
Joined: 06 Jul 2007

Re: Level and screen projections (now with resize handling)

Postby Nash » Sat Jul 27, 2019 5:11 pm

Thanks for the update! Importing into my project right away. :D
User avatar
Nash
 
 
 
Joined: 27 Oct 2003
Location: Kuala Lumpur, Malaysia
Github ID: nashmuhandes

Re: Level and screen projections (now with resize handling)

Postby Major Cooke » Sat Jul 27, 2019 8:35 pm

KeksDose wrote:strangely named RenderUnderlay


Don't think too hard on it. The name implies going underneath the layer of huds.
User avatar
Major Cooke
d = klabs(wall[wall[wall[sector[dasect].wallptr].point2].point2].x-s->x)...
 
Joined: 28 Jan 2007

Re: Level and screen projections (now with resize handling)

Postby KeksDose » Sun Jul 28, 2019 5:37 am

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.
User avatar
KeksDose
Praise Mima and the Moon
 
Joined: 06 Jul 2007

Re: Level and screen projections (now with resize handling)

Postby Major Cooke » Mon Jul 29, 2019 11:03 am

None. Because it's the very bottom. Hence "underlay". Theoretically you could count the game world itself but I don't.
User avatar
Major Cooke
d = klabs(wall[wall[wall[sector[dasect].wallptr].point2].point2].x-s->x)...
 
Joined: 28 Jan 2007

Re: Level and screen projections (now with resize handling)

Postby KeksDose » Tue Jul 30, 2019 7:57 am

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.
User avatar
KeksDose
Praise Mima and the Moon
 
Joined: 06 Jul 2007

Re: Level and screen projections (now with resize handling)

Postby Major Cooke » Tue Jul 30, 2019 11:25 am

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.
User avatar
Major Cooke
d = klabs(wall[wall[wall[sector[dasect].wallptr].point2].point2].x-s->x)...
 
Joined: 28 Jan 2007

Re: Level and screen projections (now with resize handling)

Postby Apeirogon » Tue Jul 30, 2019 11:59 am

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.
User avatar
Apeirogon
I have a strange sense of humour
 
Joined: 12 Jun 2017

Re: Level and screen projections (now with resize handling)

Postby KeksDose » Sat Aug 03, 2019 7:34 am

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.
User avatar
KeksDose
Praise Mima and the Moon
 
Joined: 06 Jul 2007

PreviousNext

Return to Script Library

Who is online

Users browsing this forum: No registered users and 1 guest