The ring theory part two
Based on this:
http://www.wowinterface.com/forums/s...ght=discokugel http://www.wowinterface.com/forums/s...ad.php?t=45817 Today after finishing my config I had some time to think about stuff. What really got me is that no-one has ever used scrollFrames to do stuff. I set up an experiment that I may try to prove if I have time. I made the following graphics: Basic ring setup: We put a scrollFrame with an inline texture into ring segment 1: This will happen if we change the setpoint of the scrollFrame and the setpoint of the texture inside the scrollFrame: This is what is going to happen if we only adjust the size of the scrollframe: What about rotation? Let's see. Hmm the offset does not fit. So this is what happens if we correct the offset. What we are doing in the last screenshot. We rotate the scrollFrame right while adjusting the setpoint properly. Additionally we rotate the ringTexture inside the scrollFrame in opposite direction. *edit* Ahhh...got an even better idea. Why would you rotate the scrollFrame at all? We can just leave as it is and just rotate the texture inside. This is what will happen: The pink thingy is the alpha layer of the ring texture. Now if we rotate the texture inside the scrollFrame it will adjust on it's own. This should make it very simple to create any kind of rings. Just set up 4 scrollFrames and throw in any ring texture you want. The number of rings per scrollFrames is unlimited. Each ring texture can be rotated individually. Only one limitation. Start and end point of a ring segment can only be in one segment if at least one point is at 0° or 90°. It even should be possible to do full half-rings with only 2 scrollFrames. Your ring texture would span 180° then. |
Tripped out :)
|
Hmm...actually I set down to prove the concept.
It works! Addon: http://www.wowinterface.com/download...rTestRing.html SVN: http://code.google.com/p/rothui/sour...5.0/rTestRing/ Free your mind. If I look at how simple that actually is I want back my time when I did rRingThing. Damnit. |
Quote:
|
This is superb.
There are just some major drawbacks to the texture rotation: It only works for mono-color and symmetrical textures. Otherwise, the illusion fails. |
Looks great, zork. I love your ideas. Your 'scroll frame revelation' made me laugh :p
It actually inspired me to try and use a scroll frame myself for some to-do list I'm working on. Sliding panel with transparent frames (so no lazy moving behind the parent frame) \o/ The possibilities... they are endless. Edit: You could also make a pretty cool experience bar with it. A full circle represents one level. You have a segment for the current experience, then a second segment starting at the end of the first one representing rested experience. If you make the second one semi-transparent, you could see how far it overlaps into the next level as well, something which traditional experience bars can't do. |
@Haleth
Nice one. @humfras You can cheat alot more if you have to. Atleast it's a huge improvement of what we currently had to do. The texture can use blending and gradients are possible aswell. Additonally you can use overlays or backgrounds. You can recolor on value change. You can even position another texture (spark) ontop of the ring. Lua Code:
On that note...I have not tested frame rotation which should be possible via animationgroups. Thus some could try to stack textures on a frame and rotate the full frame inside the scrollFrame. Another big plus is the ability of AnimationGroups. Sth like Animation > SetSmoothing is just nice to have. Quote:
|
Quote:
Dynamische Texturen (hier: sich verwindente Doppelstränge) brauchen zur Darstellung eine vorlaufende Sichtgrenze. Sollte ja möglich sein. Problematisch wird es, wenn dynamische Schattenverläufe nötig sind. Oder ist dies mit Overlay-Texturen möglich ('MaskTexture')? |
Lol...SetRotation has a bug. It does sth to my ring texture.
To get it to work properly I had to use the SQRT trick posted by Saiket here: http://www.wowinterface.com/forums/s...ad.php?t=36679 My code is: Lua Code:
Maybe it has sth to do with the mysterious 1px I read about. Going to try to snip out 1px of my ring. Afaik I read sth about it in Iriels ring theory. Thus every texture with a transparent outer edge needs to stay away from the texture edge by atleast 1px. Gonna try that. I think they did that to determine matching background colors or the like. Loooool. That worked. I stripped the outer pixel and BÄÄÄM. So when working with Texture:SetRotation() you have to make sure to do these:
|
The reason for the first bug you mentioned is just the way WoW decides to render the out of bounds area of a texture's image. It tends to duplicate the last pixel out past the bounds of the image in order to fill the rendering area of the texture. This has nothing to do with texture:SetRotation() and will show up if you use texture:SetTexCoord() with coordinates that extend out of bounds.
The problem in which the SQRT method fixes is that Blizzard chose to have a texture shrink so the corners of an image fit in it at a 45 degree angle whenever texture:SetRotation() is used. If you manually calculate the coordinates of the corners and set the texcoord yourself, this doesn't apply. Although it's probably easier and more efficient to just multiply the intended size of the texture object with SQRT(2) as shown by your code example. |
Thanks for the insight SDPhantom.
I'm on the way of creating an oUF layout from this. I really wanted to do this for a long time. Now I'm finally able to make it work properly. I'm currently setting up the orb templates in my GFX program. Currently I have two templates in mind that I want to bring to life. Outer ring templates It can be combined with an orb in the center. Thanks to SetPortraitToTexture() [http://wowprogramming.com/docs/api/S...raitToTexture] it is even possible to work with circular icon symbols. It may not seem that the icon is circular but in fact it is. Lua Code:
Result: So a template-idea can be adding a circular cast icon inside a circular castbar and ring unitframes. *edit* I made the code of the stuff above available via SVN: http://code.google.com/p/rothui/sour...5.0/rTestRing2 |
Love what I'm seeing here :)
|
|
The second layout I want to do is a revival of my oUF_Orbs mod (http://www.wowinterface.com/download...-oUF_Orbs.html).
The problem is the castbar icon. I think I have to put it somewhere else. |
*swoons* :o
|
Why not have the castbar circle the healthbar which circles the mana bar?
|
Looks amazing. :D
|
The bright colors and round shapes remind me of poké balls from Pokémon.
|
You get that those are only examples showing the technique behind the scenes right? I'm just showing options. Everything else is personal preference. Do whatever you want. You have the freedom to do so.
You can use any color. You can do quarter, half, full-rings. You can use any ring-width and so on ... |
Quote:
That looks kind of okay to me. |
Btw...when you are building your ring segments with non-transparent areas inside your ring the following texture will be enough to display all the rings you will ever need.
You do not have to care about ring-width at all. Clever overlaying and frame-stacking is all you need to create the illusion. Layer 1: (needs two scrollFrames of same color) Layer 2: Layer 3: Handling ring-width is an annoying topic. If you don't have to fiddle with it just don't. The last step is another layer ontop containing highlight/border textures. But I remommend to delay that step until the layout is finished. It is tedious to create it if you are still working on your layout and change sizes around all the time. One thing I still need to check out is the effect of the different BlendModes. |
Here's a link to a good explanation to how BlendModes work.
http://www.wowpedia.org/AlphaMode |
Just some more links on that topic:
http://en.wikipedia.org/wiki/Circular_motion http://cnx.org/content/m42177/latest...ol11406/latest http://www.wowinterface.com/forums/s...ad.php?t=45091 |
Working on it if I have time to spare. Currently doing the basic setup.
http://imgur.com/a/s1uAA#0 Currently setting everything up. The main problem atm is getting the frame stacking right. This included frames for border and highlight effects later on. Basic setup is done. Including a spark texture. Each ring can sit on 1-4 ring segments. A segement can handle rings for castbar, health and power. Each ring can have its own radius. Each ring consists of a background, ring and a spark texture. Code will be released under oUF_Donut. |
What did you decide for where to indicate the spell for a castbar ring?
|
Quote:
I made a fix like that: Code:
local ULx, ULy, LLx, LLy, URx, URy, LRx, LRy = texture:GetTexCoord(); |
SDPanthom wrote an explanation on that here aswell: http://www.wowinterface.com/forums/s...7&postcount=10
Regarding your fix. Does the function only has to be called once per texture prior to any SetRotation calls? If you have to call it after every SetRotation you will be screwed. What if you rotate the texture in a way that your math. prefixed (+-) are wrong because points have switched places. |
Quote:
But the version you said, seems intresting too, to cut the edges after every rotation, and you can change the -+ values based on the rotation degree, i might try to code it later. |
Okay i came up with something like that:
Code:
if (aura.textaura ~= true) then |
I don't really understand the hassle. Just cut out a 1px border of your texture's alpha layer. If that pixel is black the texture will be transparent thus the bug will not appear.
Blizzard uses the outmost 1 pixel for background color multiplication calculations which can be quite useful in some scenarios. |
Quote:
The fix meant to work when the user loads a cusom texture, or a texture from wow. I mostly have problems with ingame icons, i got a thread about it here: http://www.wowinterface.com/forums/s...81&postcount=5 |
I'm getting near alpha state.
Including pet and targettarget (showing a second ring layout template) I decided to add a templating engine for ring setups. Thus it is possible to setup different ring types and use them for specific units. The update and value change functions are done. A ring can use 1,2,3 or all 4 segments. A ring can rotate clockwise or counter-clockwise. Lua Code:
More shots: http://imgur.com/a/786JI#0 *edit* I released oUF_Donut: http://www.wowinterface.com/download...oUF_Donut.html |
|
The bottom image is much easier to process than the first.
|
Maybe...but it has to be tested by actually using it.
The castbar will be hidden most of the time for melee players and against melee targets. Additionally I added an optional attribute to the powerring configuration that allows hiding of the powerring if the unit does not even have power. The good: Testing out ring settings is really easy. It only requires an adjustment on the following variables to change the whole appearance: Lua Code:
http://code.google.com/p/rothui/sour...default.lua#34 Basically you can adjust the radius of a ring. Second you can adjust the texture layers. Last you set how many ring segments should be used, where the ring should start and how it should fill up. That way you can shuffle your rings around in no time and try out new setups. I really like adding class/combo and altpowerbar to the ring template idea. It just fits the the concept. The problem on that is that my 16texture layers will be no more enough to hold all the layers per scrollFrame. Easy enough though. A texture drawlayer is capable of handling a sublevel and a strata. This gives us space for up to 80 textures per scrollFrame. That should be enough >_<. So I need to add the texture strata to the ring template. New ring elements will be "classring" and "altring". As posted above changing the whole appearance can be done easily by changing some variables. Why not use the comboring as an outer ring? Etc. |
Released rCompassCastbar that is using the technique.
http://www.wowinterface.com/download...ssCastbar.html |
I wanted to post here because I came up with a technique based on the one outlined in this topic which can be applied to any source texture, rather than relying on semi-circles.
You start by arranging 4 textures in a grid, setting their texture coordinates so they look like a single copy of the original image. Now our goal is to drain (or fill) each quarter by slicing the original texture from its center to one of its edges. We can use a rotation animation to get the angle we want, but of course this also rotates our texture so it doesn't line up with the rest of the image. However, we can use SetTexCoord to rotate our texture in the opposite direction to the rotation animation to correct its orientation. Here's an animation to illustrate the basic concept: http://gfycat.com/BriefShowyElephantseal The red square is where the scrollframe would normally be used to clip the edges of our rotating texture. And this picture shows the finished design with various fill directions: http://gfycat.com/RealisticBaggyDarklingbeetle I'll leave the script I wrote here. Lua Code:
|
Quote:
But it's good to see that the idea wasn't bad at all :) |
Semlar that is fucking brilliant!
|
While it has to start or end at a 90 degree angle, you can still create arbitrary arcs using transparent textures and adjusting your value to compensate for the offsets.
Here's an example: http://gfycat.com/VioletJauntyGelding This is the source image: |
Hmmm...semlar what happens if one wants multiple rings per segment? (Like mana and life)
They both need their own spinner right? Is overlaying a problem? From my work with orbs I can tell that frame stacking is a pain in the but. In the system that is working with only two scrollframes (two halfrings) one can position multiple textures inside the scrollchild. Textures can be stacked amazingly well thanks to texture drawLayer. To get frame stacking right on my orbs I have to parent each frame after another. Quote:
Just to save it from dying. I recoverd my blogpost from elitistjerks from 2009 and brought it to github. https://github.com/zorker/rothui/tre...chive/rRingMod https://web.archive.org/web/20110208.../362-ring.html |
Quote:
I want each spinner to be treated as one unit and separate from any other spinners that you create. |
I want to play around with semlars function this week. Currently collecting some ideas and links.
http://wowwiki.wikia.com/wiki/SetTex...ransformations https://github.com/tomrus88/Blizzard...L/Util.lua#L31 I have not grasped how it is possible to rotate the wedge texture via animation rotation and correct that rotation via SetTexCoord. Like you rotate it to the right by 45° but then you call SetTexCoord to rotate it left by -45°. How is it keeping the clipping? Oh. It is the other way around isn't it? You do SetTexCoord first and then rotate. |
The order of the rotations is irrelevant, they're rotated in opposite directions to keep the picture level while the animation creates the desired angle. I thought of all of this immediately after seeing this image in your original post:
The yellow square is the slice/wedge texture; its corner is attached to the center of the image and an animation widget is being used to rotate it around in a circle to create the (green) angle that we want. I'll make some illustrations to hopefully clarify what's going on. Here's what we're starting with: First, we rotate our image using an animation. This gives us our angle, but of course it also rotates the image. We'll apply a rotation in the opposite direction to correct its orientation using SetTexCoord. It's upright, but not quite the effect we're going for, so let's shift it to the left (actually halfway down and halfway to the right, we want it to be centered on one of its corners so it lines up with the image). This translation is done along with the rotation in one matrix transformation to generate the coordinates for SetTexCoord, but I'm showing both steps separately here. Finally, we'll put it in a scrollframe to clip anything outside of the quarter of the image we actually want to be displayed. That's it, the rest of the image is just 3 copies of the original texture shifted halfway to the center to make up each quarter. Here's our final product: |
Thanks a ton. What blew me is that you can adjust the SetTexCoord of a texture and keep the clipping that is set by the animation rotation.
Basically the texture is clipped twice. By the animationgroup and by the scrollframe. There are huge benefits being able to do it this way because the ring texture can be of any shape. Is the outcome any different when using this instead of the animationgroup? http://wowprogramming.com/docs/widge...re/SetRotation |
A few weeks ago semlar allowed me to use the code he posted to use it in an addon.
Its far from finished, here are the first results. First picture is Health and mana with red and blue Spinners (called so because thats the word semlar used in his example :) ) There is an animation there below the spinner but of course that isn't visible in this picture :rolleyes: Second picture is the health Spinner in action. Third and fourth pictures are the same as the first two but have different textures applied. Also the "eye" in the middle is animated. Early january I got the inspiration for an animated heath/mana bar. Found Zork's addon called Diso Kugel 2. But couldn''t get the result I wanted :mad: Then came semlar's post. Spinners (name for the addon I am using) is a combination of the code semlar posted and the inspiration I got after seeing Disco Kugel 2 :D Might be a few weeks before I will release a Beta version (progress is limited by time and skill). But so far I am happy with it. Any suggestions for improvements are most welcome. |
Quote:
|
Quote:
Since the animation rotates the entire physical texture object, it means SetTexCoord is no longer limited to cutting off the texture at 90 degree angles (the sides of the texture), because now the side of the texture is at whatever angle we rotated it to. You can think of a texture object like a scroll frame. You can move its contents around using SetTexCoord, but you can only ever "clip" it at its edges, which are always 90 degrees. Now imagine that you could apply a rotation animation to a scroll frame. You're no longer limited to 90 degree angles because the edges aren't straight up and down, they're at the angle you set the rotation to. The animation still isn't clipping anything in that example, the scroll frame is, it's just changing the angle that the scroll frame is clipping its contents at. |
Hmmm. When working with textures that use an aspect of 1 (square), is the following condensed Transform function correct?
Lua Code:
|
Quote:
If you'd rather work with degrees instead of radians, I believe the blizzard functions sin and cos are degree-based instead of the radian-based math.sin and math.cos, so you don't even have to convert between them if you use those instead. |
Not sure if you noticed it. The wierd bug that you fixed in the demo with a OnUpdate function that you call onPlay and disable it thereafter can be fixed by just calling :Pause() after :Play().
What cannot be removed though is the delay. No clue why it does not animate without it. Lua Code:
|
The delay makes sure you have some time before the animation ends. Otherwise, the animation stops and snaps back to the original position before you get a chance to pause it. I'm not entirely sure if AnimationGroup:SetLooping("REPEAT") would crash the game with a zero duration or if it would apply at all, but that might be a possibility.
|
SDPhantom the thing is that we never need that delay. If we do not set it the API will not rotate the texture.
I sat down and wrote myself a small test addon for the ring. Super cool indeed. That the new technique allows texture stretching makes it even better. http://imgur.com/a/fGZpG https://github.com/zorker/rothui/tre.../wow6.0/rRingo What is missing is the ability to select another start segment and to pick the number of frames to be used. So many use cases. You could use it to create small squares that emulate a cooldown spiral. Lua Code:
By far the coolest thing in a long time. I would not use the animation system later on for smooth animation progress. What oUF_Smooth does is more than fine. All one needs is a SmoothBar module for all the value updates. Sth like this: https://github.com/zorker/rothui/blo...oUF_Smooth.lua |
Quote:
Your own testing provides this answer, I'm just explaining it so you can understand what might be going on and why. |
Thanks. Maybe it is just me but I find it wierd that the animation has to be played and then paused to be able to use :SetRadians().
On top of that you cannot play/pause the animation itself. It has to be the group. |
Hello
Thanks Zork to point me there. It is a very nice concept from semlar. Cheers Sigg |
Quote:
|
Would it be possible to create animated pie charts with this method with relatively small cost?
I'm looking for something like that in the future. |
Quote:
Most of the processing is from performing the matrix transformation for the texture coordinates which requires a decent number of math operations, but even doing this with a number of different textures probably isn't going to cause a noticeable impact on most, if any, computers capable of running the game in the first place. edit: I tested 1200 spinners (all using the same texture) and went from 100 fps to around 80-85, animating them OnUpdate. |
I was actually more interested in data relating to the additional impact of having paused animations continuously rendering. An earlier version of my custom flight HUD used a bounce looping method on rotating textures and paused whenever the loop state changed. I scrapped the method since it not only had its own problems to deal with, but the entire addon as a whole was eating up a considerable chunk of processing power when the game really needed it. It wasn't the worst part of the old code, but I did consider it to be contributing factor.
|
All times are GMT -6. The time now is 12:14 PM. |
vBulletin © 2024, Jelsoft Enterprises Ltd
© 2004 - 2022 MMOUI