Plan for Pat Wilson
by Pat Wilson · 08/24/2001 (4:33 pm) · 4 comments
The HUD is working...that's the good news. I've extended much of it greatly, and am much happier with the way the inheritance works then I was when we started. The HUD will be in the next v12 update.
The current project is extending the HudBarDisplayCtrl HUD object. It (currently) displays percentage information in the form of a horizontal or vertical bar graph. From the original I added the ability to make vertical graphs, and the ability to start filling from either end of the graph. I also put in gradients and text shadows. Right now I'm working on making curved bar graphs possible. I'm doing this with a Bezier curve, and the OpenGL primitive GL_QUAD_STRIP. The current problem is getting the second set of points without doing the calculations for a second curve. I'm quite sure there is a simple solution I am missing. Right now I scale each point, then transform it so the second curve is contained in the first one. (Calculus flashbacks...) The problem here, is that the scale value needs to change dependant on the size of the curve, and I'm having trouble getting my head around just the best way to do this.
I think I'm going to think of the set of control points as a polygon, get the center of the polygon, transform it to (0,0), scale it, transform it to the location I want it inside the other curve, then do the calculations for the second curve. I'm using de Casteljau's algorithm and it's not very expensive at all, and it's gotta be less expensive then the trig I was using to try to get it rendering with a triangle strip.
EDIT: The problem WAS in fact that I wasn't transforming the whold damn thing to (0,0) before applying the scale.
The current project is extending the HudBarDisplayCtrl HUD object. It (currently) displays percentage information in the form of a horizontal or vertical bar graph. From the original I added the ability to make vertical graphs, and the ability to start filling from either end of the graph. I also put in gradients and text shadows. Right now I'm working on making curved bar graphs possible. I'm doing this with a Bezier curve, and the OpenGL primitive GL_QUAD_STRIP. The current problem is getting the second set of points without doing the calculations for a second curve. I'm quite sure there is a simple solution I am missing. Right now I scale each point, then transform it so the second curve is contained in the first one. (Calculus flashbacks...) The problem here, is that the scale value needs to change dependant on the size of the curve, and I'm having trouble getting my head around just the best way to do this.
I think I'm going to think of the set of control points as a polygon, get the center of the polygon, transform it to (0,0), scale it, transform it to the location I want it inside the other curve, then do the calculations for the second curve. I'm using de Casteljau's algorithm and it's not very expensive at all, and it's gotta be less expensive then the trig I was using to try to get it rendering with a triangle strip.
EDIT: The problem WAS in fact that I wasn't transforming the whold damn thing to (0,0) before applying the scale.
About the author
#2
Also, maybe you can use a Quad list cache for calculating the quads and then storing them (rather than re-calculating every frame, which seems very wasteful).
Just some suggestions.
Phil.
08/25/2001 (8:42 am)
Just thought Pat, please use a second curve! :)) the controls I'd like to do are based around 2 different curves.. so it'd be useful to have a second curve in there anyway.Also, maybe you can use a Quad list cache for calculating the quads and then storing them (rather than re-calculating every frame, which seems very wasteful).
Just some suggestions.
Phil.
#3
08/25/2001 (8:48 am)
Actually, the easiest way to do that (if I understand what you want me to do) is polygon strippling (sp?). You provide a bit array of the pattern you want, and you can do things like a dashed line, for example. (That's line strippling) So I think that the easiest way to do that broken-up bar graph look would be the strippling.
#4
BTW, check your ICQ so we don't have to use the comments to communicate hehe.
08/25/2001 (8:50 am)
2 curves? Ok that can be done. And what I've been thinking is that calculating two curves is probably less expensive then what I have to do to translate and scale the points, because to do that, I have to construct a polygon whos vertices are the control points, break that polygon up into triangles that share a common vertex, take the area of each trigangle, find the center point of each triangle, then do a weighted average of the center points to find the center point for the polgyon, translslate...scale, translate.BTW, check your ICQ so we don't have to use the comments to communicate hehe.

Torque 3D Owner Phil Carlisle
One thing, did you implement a bitmap button class? (basically a button with 5 states each one having a bitmap image).
As for the curved bar graphs, I was about to implement that myself. (Although I wasnt interested in beziers, I was going to use elipses). One thing I'd like to see (in your bargraphctrl) is the ability to have parts of it non continous, pretty much like any speedo in a game. Its easy enough by just setting every even quad's alpha to zero i guess.
Anyway, if your changing the inheretance for the GUI controls, I'll leave all that to you (I'm quite happy to get on with the other things :))
Phil.