[Bug 1.1a] EditTSCtrl's renderCircle() ConsoleMethod - RESOLVED
by Ryan Mounts · in Torque 3D Professional · 12/29/2009 (11:58 am) · 2 replies
There are several errors in the EditTSCtrl's renderCircle() ConsoleMethod, but they are easy to fix. First, it handles the special case of the normal vector being the positive z-axis, but not the negative z-axis.
The last segment is twice the angular step of the other segments, and the fill triangles are drawn opposite the normal instead of the same direction as the normal.
The last triangle of the fill triangle fan is not created, leaving a blank gap in the fill.
if(aa.angle == 0.f)
aa.axis.set(0,0,1);
if(mDot(normal, Point3F(0,0,1)) == -1) // ADD LINE!
aa.axis.set(1,0,0); // ADD LINE!The last segment is twice the angular step of the other segments, and the fill triangles are drawn opposite the normal instead of the same direction as the normal.
F32 step = M_2PI / segments;
F32 angle = 0.f;
Vector<Point3F> points;
// segments--; // REMOVE LINE!
for(U32 i = 0; i < segments; i++)
{
Point3F pnt(mCos(angle), mSin(angle), 0.f);
mat.mulP(pnt);
pnt *= radius;
pnt += pos;
points.push_front(pnt); // MODIFY LINE: change "push_back" to "push_front"
angle += step;
}The last triangle of the fill triangle fan is not created, leaving a blank gap in the fill.
// filled
if(object->mConsoleFillColor.alpha)
{
PrimBuild::color( object->mConsoleFillColor );
PrimBuild::begin( GFXTriangleFan, points.size() + 2 ); // MODIFY LINE: change "1" to "2"
// Center point
PrimBuild::vertex3fv( pos );
// Edge verts
for( int i = 0; i < points.size(); i++ )
PrimBuild::vertex3fv( points[i] );
PrimBuild::vertex3fv( points[0] ); // ADD LINE!
PrimBuild::end();
}
Full Sail QA&U Lab Intern