Torque 2D Primitives 1.1
by Matthew "Ashteth" Kee · 08/30/2005 (1:38 am) · 14 comments
Download Code File
Works with the current version of Torque 2D 1.0.2
Includes the following files:
t2dDraw - A C++ only singleton that does all the actual drawing. Using this class
allows common drawing routines to be shared.
Status: 80% complete
t2dRoundedQuad - A rectangle in which the four corners may be toggled into rounded circles.
There is no gradient effect for this class. The outline may optionally be displayed
in a different colour.
Status: Complete
t2dQuad - A rectangle. May be rendered as a solid colour or blended with each corner
assigned a seperate color. A border may optionally be displayed. The border has
its own colour settings.
Status: Complete
t2dTriangle - A triangle. May be rendered as a solid colour or blended with each of
the three vertices using a seperate colour. Triangle vertices may be assigned to
any of the four corners of the t2dSceneObject bounding box. They may also be assigned
to positions half way between any two adjacent points on the bounding box's outer
parameter. In other words, you have 8 points to chose from to assign vertices to.
A border may optionally be displayed. The border has its own colour settings.
Status: Complete
t2dEllipse - A disk / circle / ellipse rendering class. May be rendered as a solid
or blended with an inner and outer colour. The ellipse is automatically sized
to the size of the t2dSceneObject bounding box. Optionally, an inner radius
may be assigned. The width of the inner radius will not be rendered.
Currenty if an inner radius is assigned, the ellipse displays as a circle with
its radius as the smaller of the width/height of the bounding box. This was done to
make life simpler for the programmer, but eventually should be changed.
Status: 90% complete
t2dProgressBar - A quad in which the bounding box is filled a percent of completion (from zero to 1).
Status: 90% complete
t2dArc - Render a portion (or all) of a circle with an inner and outer radius.
May be rendered as a solid colour or blended with an inner and outer colour.
Status: 90% complete
t2dPolygon - An Arbitrary set of points that may be rendered with an optional border.
Status: 25% complete
t2dLine - A line. May be solid coloured or blended. Works but uses actual GL lines... yuck.
Status: 25% complete
Works with the current version of Torque 2D 1.0.2
Includes the following files:
t2dDraw - A C++ only singleton that does all the actual drawing. Using this class
allows common drawing routines to be shared.
Status: 80% complete
t2dRoundedQuad - A rectangle in which the four corners may be toggled into rounded circles.
There is no gradient effect for this class. The outline may optionally be displayed
in a different colour.
Status: Complete
t2dQuad - A rectangle. May be rendered as a solid colour or blended with each corner
assigned a seperate color. A border may optionally be displayed. The border has
its own colour settings.
Status: Complete
t2dTriangle - A triangle. May be rendered as a solid colour or blended with each of
the three vertices using a seperate colour. Triangle vertices may be assigned to
any of the four corners of the t2dSceneObject bounding box. They may also be assigned
to positions half way between any two adjacent points on the bounding box's outer
parameter. In other words, you have 8 points to chose from to assign vertices to.
A border may optionally be displayed. The border has its own colour settings.
Status: Complete
t2dEllipse - A disk / circle / ellipse rendering class. May be rendered as a solid
or blended with an inner and outer colour. The ellipse is automatically sized
to the size of the t2dSceneObject bounding box. Optionally, an inner radius
may be assigned. The width of the inner radius will not be rendered.
Currenty if an inner radius is assigned, the ellipse displays as a circle with
its radius as the smaller of the width/height of the bounding box. This was done to
make life simpler for the programmer, but eventually should be changed.
Status: 90% complete
t2dProgressBar - A quad in which the bounding box is filled a percent of completion (from zero to 1).
Status: 90% complete
t2dArc - Render a portion (or all) of a circle with an inner and outer radius.
May be rendered as a solid colour or blended with an inner and outer colour.
Status: 90% complete
t2dPolygon - An Arbitrary set of points that may be rendered with an optional border.
Status: 25% complete
t2dLine - A line. May be solid coloured or blended. Works but uses actual GL lines... yuck.
Status: 25% complete
#2
08/30/2005 (2:38 pm)
The zip file won't download. :(
#3
08/30/2005 (2:55 pm)
Awesome!
#4
Great work putting this together, Matthew. Keep plugging on t2dLine! :)
I haven't looked but I assume I can specifiy border thickness and border color for everything, including the line?
I assume various types of curves are also on the to-do list?
Thanks again!
08/30/2005 (11:02 pm)
I'm excited to try this but the download just redirects me back to this page. Anyone else?Great work putting this together, Matthew. Keep plugging on t2dLine! :)
I haven't looked but I assume I can specifiy border thickness and border color for everything, including the line?
I assume various types of curves are also on the to-do list?
Thanks again!
#5
08/30/2005 (11:11 pm)
funny how Josh rated it an "Awesome!" 5 even though the download is obviously broken :P
#6
08/31/2005 (6:47 am)
Those blended triangles would work well as quick & easy faked light effects. Can't wait to give this a whirl! Although, the download still seems to be b0rked.
#7
but you pretty much dropped the ball on this one. Vaporware!
09/01/2005 (7:18 pm)
sorry Matthew Kee, I think you are a cool guy, and super, super smart....but you pretty much dropped the ball on this one. Vaporware!
#8
09/05/2005 (1:40 pm)
Sorry about that guys, I posted the resource and before Garage Games approved it, I went on vacation for a week. Try it now and let me know what you think...
#9
and it doesn't compile, maybe I'm doing something wrong?
I got this errors...
t2dTriangle.cc
E:\jtech\T2D\engine\T2D\./t2dDraw.h(351) : error C2258: illegal pure syntax, must be '= 0'
E:\jtech\T2D\engine\T2D\./t2dDraw.h(351) : error C2252: 's_fMaxCircleAngleIncrement' : pure specifier can only be specified for functions
E:\jtech\T2D\engine\T2D\./t2dDraw.h(352) : error C2258: illegal pure syntax, must be '= 0'
E:\jtech\T2D\engine\T2D\./t2dDraw.h(352) : error C2252: 's_fNearZero' : pure specifier can only be specified for functions
some ideas??
Regards.
10/04/2005 (4:04 pm)
Hi Matthew, I've tried your resource using VC++ 6and it doesn't compile, maybe I'm doing something wrong?
I got this errors...
t2dTriangle.cc
E:\jtech\T2D\engine\T2D\./t2dDraw.h(351) : error C2258: illegal pure syntax, must be '= 0'
E:\jtech\T2D\engine\T2D\./t2dDraw.h(351) : error C2252: 's_fMaxCircleAngleIncrement' : pure specifier can only be specified for functions
E:\jtech\T2D\engine\T2D\./t2dDraw.h(352) : error C2258: illegal pure syntax, must be '= 0'
E:\jtech\T2D\engine\T2D\./t2dDraw.h(352) : error C2252: 's_fNearZero' : pure specifier can only be specified for functions
some ideas??
Regards.
#10
remove line 351 and line 352 from t2dDraw.h
in t2dDraw.cc, near the top, add these lines:
#ifndef s_fNearZero
#define s_fNearZero 0.000001f
#endif // s_fNearZero
#ifndef s_fMaxCircleAngleIncrement
#define s_fMaxCircleAngleIncrement 0.000001f
#endif // s_fMaxCircleAngleIncrement
It is possible that this code will have additional errors caused by your older compiler. If you have additional problems, either upgrade your compiler or e-mail me (address in my profile) and I will attempt to help you work through them, provided the issues are not too severe.
10/05/2005 (3:24 pm)
What this means is that you are using an older compiler that does not support all the features of the latest C++ standard. Here is a hack you can do to get around this:remove line 351 and line 352 from t2dDraw.h
in t2dDraw.cc, near the top, add these lines:
#ifndef s_fNearZero
#define s_fNearZero 0.000001f
#endif // s_fNearZero
#ifndef s_fMaxCircleAngleIncrement
#define s_fMaxCircleAngleIncrement 0.000001f
#endif // s_fMaxCircleAngleIncrement
It is possible that this code will have additional errors caused by your older compiler. If you have additional problems, either upgrade your compiler or e-mail me (address in my profile) and I will attempt to help you work through them, provided the issues are not too severe.
#12
01/02/2006 (5:28 am)
Just what I needed... :) Thanks.
#13
T2D Primitives
01/02/2006 (1:55 pm)
The version below will work with T2D alpha 1.1. It also includes t2dLineStrip that you can use to draw one or more line segments in a single scene object. Everything *should* work with 1.1 alpha, but the version I tested with has some custom functions, so if anything doesn't work right be sure and let me know. Also, there isn't a demo for the t2dLineStrip class yet, its fairly simple though, just use addPoint() to add as many points as you need. This version also includes one or two fixes. I didn't update the download above because I assume that not everyone is using the Alpha version of T2D.T2D Primitives
#14
01/02/2006 (3:30 pm)
cool, that rocks Matthew :) 
Associate Anthony Rosenbaum