vanilla-wow-addons – Blame information for rev 1

Subversion Repositories:
Rev:
Rev Author Line No. Line
1 office 1 StatRings - Proof of concept ring indicators
2 ---------------------------------------------------------------------------
3 v0.3 - 2005-10-19 (Antiarc)
4 * Gave a bunch of functionality to the template frames, so you can just set max value/current value and it flows between them nicely.
5 * Added target health and combo point rings
6 * Prettied it up a bit
7  
8 v0.2 - 2005-10-17
9 * Split template code into its own files
10 * Much commenting in template LUA file
11 * Added SetRingTextures method
12 * Scaled rings a bit more appropriately for normal setups.
13 * Linked to WorldFrame instead of UIParent
14 * Updated ring colors to match player frame colors
15  
16 v0.1 - 2005-10-16
17 * First release
18  
19 APPROACH DOCUMENT
20 ---------------------------------------------------------------------------
21 So I sat down to figure out how to draw a partial ring within WoW, and
22 ended up a with a much nicer solution than the angled mask
23 approach. I'll be releasing some example code with it in once I finish
24 it off and clean it up, but I figured I'd explain what I came up with.
25  
26 This approach requires two texture files, and six texture objects.
27  
28 File 1: A ring quadrant
29 File 2: A 45 degree sliced square.
30  
31 It's easiest to explain this with just a single quadrant, so let's
32 consider the top right quadrant of the ring, and an angle A, where 0
33 is no visible ring, and it increases from the top down to the right
34 (Like a clock).
35  
36 The top left hand corner of this quadrant (the 'noon' position), we'll
37 call N (Nx,Ny)
38  
39 The line from the center of the ring at angle A hits the inner edge of
40 the ring at point I (Ix,Iy), and the outer edge of the ring at point O
41 (Ox, Oy).
42  
43 For a ring of inner and outer radius IR, and OR, those points are:
44  
45 Nx = 0, Ny = OR
46 Ix = IR * sin(A), Iy = IR * cos(A)
47 Ox = OR * sin(A), Oy = OR * cos(A)
48  
49 ANGLES FROM 0-45 DEGREES
50 First draw the rectangular subset of the ring from the top left
51 corner, down to point I, the intersection with the inner edge of the
52 ring. This is your desired ring segment with a triangularish section
53 chopped off the end to the right.
54  
55 Next draw the rectangular 'chip' from the top right corner of the
56 piece you just drew, down to point O, the outer edge of the ring. This
57 fills in the curved outer edge that was missing.
58  
59 This leaves a missing triangular section that represents where the
60 angle slices across the ring. Stretch the 45 degree slice texture
61 across that between points I and O.
62  
63 So, to summarize:
64 * Draw ring subset N=(Nx, Ny) to I=(Ix, Iy)
65 * Draw ring subset (Ix, Ny) to O=(Ox, Oy)
66 * Stretch slice between I=(Ix, Iy) and O=(Ox, Oy)
67  
68 ANGLES FROM 45-90 DEGREES
69  
70 (This is different simply to keep the first rendered piece as
71 significant as possible.)
72  
73 First draw the rectangular subset of the ring from the top left
74 corner, down to point O, the intersection with the outer edge of the
75 ring. This is your desired ring segment with a triangularish section
76 chopped off the end to the bottom.
77  
78 Next draw the rectangular 'chip' from the bottom left corner of the
79 piece you just drew, over to point I, the inner edge of the ring. This
80 fills in the curved inner edge that was missing.
81  
82 This leaves a missing triangular section that represents where the
83 angle slices across the ring. Stretch the 45 degree slice texture
84 across that between points I and O.
85  
86 So, to summarize:
87 * Draw ring subset N=(Nx, Ny) to O=(Ox, Oy)
88 * Draw ring subset (Nx, Oy) to I=(Ix, Iy)
89 * Stretch slice between I=(Ix, Iy) and O=(Ox, Oy)
90  
91  
92 COMPLETING THE CIRCLE
93 ---------------------
94  
95 This can be applied to the other quadrants by mirroring and/or
96 swapping the X and Y coordinates, and textures. For a full circle
97 subset you need 6 texture objects, the three discussed here for the
98 active quadrant, and then three more (all set to the ring texture) for
99 the three other 'full' quadrants for a full ring.
100  
101 An arbitrary ring subset (rather than starting at the noon position)
102 would require an adittional two or three textures (one more chip, one
103 more slice, and possibly one more ring subset, if the ring angle is
104 able to be larger than 270 degrees)