Slight improvement to world editor axis gizmo
by Orion Elenzil · 06/07/2007 (11:11 am) · 3 comments
this is based on TGE 1.3.5, but is probably pretty similar thru 1.5+.
worldEditor.cc:
in WorldEditor::renderAxisGizmo(),
find the line "ColorI selectColor( 0x00, 0xff, 0xff ); // Bright teal", and insert the following after it.
all done!

worldEditor.cc:
in WorldEditor::renderAxisGizmo(),
find the line "ColorI selectColor( 0x00, 0xff, 0xff ); // Bright teal", and insert the following after it.
//----------------------------------
// render axes all the way out.
S32 widths[] = {6 , 1 };
S32 alphas[] = {0.3f, 0.3f };
bool depths[] = {true, false};
glEnable(GL_LINE_STIPPLE);
for (S32 n = 0; n < 2; n++)
{
if (depths[n])
{
glEnable(GL_CULL_FACE);
glEnable(GL_DEPTH_TEST);
glLineStipple(1, 0xffff);
}
else
{
glDisable(GL_CULL_FACE);
glDisable(GL_DEPTH_TEST);
glLineStipple(1, 0xfffe);
}
glLineWidth(widths[n]);
glBegin(GL_LINES);
for(U32 i = 0; i < 3; i++)
{
Point3F & centroid = mAxisGizmoCenter;
switch(i)
{
case 0:
glColor4f( 1.0f, 0.0f, 0.0f, 0.3f ); //x
break;
case 1:
glColor4f( 0.0f, 1.0f, 0.0f, 0.3f ); //y
break;
case 2:
glColor4f( 0.0f, 0.0f, 1.0f, 0.3f ); //z
break;
}
glVertex3f(centroid.x, centroid.y, centroid.z);
glVertex3f(centroid.x - mAxisGizmoVector[i].x * 1000.0f,
centroid.y - mAxisGizmoVector[i].y * 1000.0f,
centroid.z - mAxisGizmoVector[i].z * 1000.0f);
glVertex3f(centroid.x, centroid.y, centroid.z);
glVertex3f(centroid.x + mAxisGizmoVector[i].x * 1000.0f,
centroid.y + mAxisGizmoVector[i].y * 1000.0f,
centroid.z + mAxisGizmoVector[i].z * 1000.0f);
}
glEnd();
}
glDisable(GL_LINE_STIPPLE);
//----------------------------------all done!

About the author

Torque Owner Shon Gale