WoWInterface

WoWInterface (https://www.wowinterface.com/forums/index.php)
-   General Authoring Discussion (https://www.wowinterface.com/forums/forumdisplay.php?f=20)
-   -   My Next Addon (https://www.wowinterface.com/forums/showthread.php?t=52280)

Digital_Utopia 05-06-15 07:18 PM

My Next Addon
 
http://i.imgur.com/Gv339aQ.png

Wolfenstein 3-D

The screenshot itself is from a raycaster test I did a ways back - nice enough performance, but the original Wolf source code had a lot of assembly in it - something I know nothing of. But then, the other day - I noticed that they released the "source" to their javascript browser port (probably a while ago I guess, no HTML5 in sight). Now, that is something I can work with. :D

Amusing thing is, their "draw" for that port, is all DoM based - easily replicable with Frames and Textures, with probably a lot better performance.

Resike 05-07-15 11:08 AM

How can you transform textures like that?

semlar 05-07-15 11:52 AM

By drawing a separate texture for every horizontal line at different scales you can create perspective, I used the same technique to show what path oregorger was going to take in an addon for my guild.


SDPhantom 05-07-15 12:46 PM

You could use trapezoid-shaped texcoords to do the same thing. That would use one texture for Semlar's example instead of anywhere between a few dozen to hundreds depending on the size of the output.

Code:

texture:SetTexCoord(ULx,ULy,LLx,LLy,URx,URy,LRx,LRy)
http://wow.gamepedia.com/API_Texture_SetTexCoord

This is the function we had to use to rotate textures before they gave us texture:SetRotation() and the animation system.



Edit: Nevermind. Although it would work good in theory, the graphics engine doesn't quite support this.

Digital_Utopia 05-07-15 12:50 PM

Quote:

Originally Posted by semlar (Post 308666)
By drawing a separate texture for every horizontal line at different scales you can create perspective, I used the same technique to show what path oregorger was going to take in an addon for my guild.


Exactly. In this case it's every vertical line, but the technique is the same. Since there can only be one wall per line, you just have to take the appropriate wall texture, and use texcoords to get the appropriate horizontal section you want to display.

In the case of multiple textures per vertical line (i.e. Doom), you'd have to have a separate line for each wall/ceiling/floor texture.

Digital_Utopia 05-07-15 01:08 PM

Quote:

Originally Posted by SDPhantom (Post 308668)
You could use trapezoid-shaped texcoords to do the same thing. That would use one texture for Semlar's example instead of anywhere between a few dozen to hundreds depending on the size of the output.

Code:

texture:SetTexCoord(ULx,ULy,LLx,LLy,URx,URy,LRx,LRy)
http://wow.gamepedia.com/API_Texture_SetTexCoord

This is the function we had to use to rotate textures before they gave us texture:SetRotation() and the animation system.

That's certainly an option as well. In that case, the first and the last hits for a particular wall, as well as which point(s) along the wall were hit, and with the distance, you could use texcoords to draw the visible portion of the wall at once.

I'll probably go over it again, once the porting is complete.

semlar 05-07-15 01:23 PM

Quote:

Originally Posted by SDPhantom (Post 308668)
You could use trapezoid-shaped texcoords to do the same thing.

No, you can't produce the same transformations using SetTexCoord on a single texture.

You can see why from this post - http://wowinterface.com/forums/showp...73&postcount=2

SDPhantom 05-07-15 02:02 PM

I forgot I came across that before a while ago. I did a bunch of testing following up my previous post and it's because of how the game engine draws textures. The game draws them internally as 2 triangles positioned top-left and bottom-right. Each triangle uses 3 points from the texcoords to render the image.

I'll just bring this image back from the other post...


In this example, the bottom 2 texcoord points were widened past the bounds of the image. The bottom-right triangle stretched properly while the top-left one merely skewed the image. I'm assuming if the top points were widened instead, the situation would be reversed.

Resike 05-07-15 03:51 PM

Quote:

Originally Posted by semlar (Post 308666)
By drawing a separate texture for every horizontal line at different scales you can create perspective, I used the same technique to show what path oregorger was going to take in an addon for my guild.


So you draw a different version of the same texture for every vertical line? And how does that transition looks like line by line?

Tonyleila 05-07-15 07:57 PM

Quote:

Originally Posted by semlar (Post 308666)
By drawing a separate texture for every horizontal line at different scales you can create perspective, I used the same technique to show what path oregorger was going to take in an addon for my guild.

Oh man, you can't show us this gif without uploading the addon for it :D

SDPhantom 05-07-15 07:57 PM

Quote:

Originally Posted by Resike (Post 308673)
So you draw a different version of the same texture for every vertical line? And how does that transition looks like line by line?

I suppose he's taking 2 points and using SetTexCoord to take a proposed line of pixels. My guess is the internal line thickness would always be 1 pixel even if you reuse the points between UL/LL and UR/LR respectively.



Quote:

Originally Posted by Tonyleila (Post 308680)
Oh man, you can't show us this gif without uploading the addon for it :D

It doesn't look that hard to make a library for. I've done a lot of vector calculations in some of my experimental addons.

Torhal 05-07-15 08:18 PM

Quote:

Originally Posted by Tonyleila (Post 308680)
Oh man, you can't show us this gif without uploading the addon for it :D

Semlar has a history of non-publishing. I try to shame him as much as possible.

SDPhantom 05-07-15 08:36 PM

Most of my stuff is non-published. Mostly because I keep starting projects and never finish them. :p

semlar 05-07-15 10:09 PM

Quote:

Originally Posted by Torhal (Post 308683)
Semlar has a history of non-publishing. I try to shame him as much as possible.

tries to calm torhal down

Digital_Utopia 05-07-15 10:24 PM

Other than the front end (titles, menus) the UI layout is done, including all the in-game visuals, shy of the actual raycasting/sprites. Now I can start on the main porting.

http://i.imgur.com/pW7MmvR.jpg

10leej 05-07-15 11:33 PM

Quote:

Originally Posted by semlar (Post 308666)
By drawing a separate texture for every horizontal line at different scales you can create perspective, I used the same technique to show what path oregorger was going to take in an addon for my guild.


I thought we couldn't do that anymore...

SDPhantom 05-08-15 01:15 AM

Quote:

Originally Posted by 10leej (Post 308687)
I thought we couldn't do that anymore...

There's nothing stopping us from it. It's a nasty hack to work around functionality that should work, but is fundamentally bugged. Note this isn't using a custom model and rotating it. He's manually drawing every horizontal line of pixels. This would require a lot of CPU time to perform and I would not suggest doing this.

semlar 05-08-15 08:18 AM

Quote:

Originally Posted by SDPhantom (Post 308688)
There's nothing stopping us from it. It's a nasty hack to work around functionality that should work, but is fundamentally bugged. Note this isn't using a custom model and rotating it. He's manually drawing every horizontal line of pixels. This would require a lot of CPU time to perform and I would not suggest doing this.

It's actually not as resource intensive as you might think to draw the same texture even hundreds of times on the screen once it's been loaded into memory, it has a fairly minor impact on performance.

I think 10leej has the impression that I'm drawing on the game world like AVR, and that's completely unrelated.

Resike 05-08-15 08:47 AM

Quote:

Originally Posted by Digital_Utopia (Post 308686)
Other than the front end (titles, menus) the UI layout is done, including all the in-game visuals, shy of the actual raycasting/sprites. Now I can start on the main porting.

http://i.imgur.com/pW7MmvR.jpg

I see you have upgraded to ZPerl. Good.

Resike 05-08-15 08:48 AM

Quote:

Originally Posted by semlar (Post 308693)
It's actually not as resource intensive as you might think to draw the same texture even hundreds of times on the screen once it's been loaded into memory, it has a fairly minor impact on performance.

I think 10leej has the impression that I'm drawing on the game world like AVR, and that's completely unrelated.

Show us some code master!


All times are GMT -6. The time now is 03:16 PM.

vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI