void EntityInstanceNode::draw( M3dView & view, const MDagPath & path, M3dView::DisplayStyle style, M3dView::DisplayStatus status ) { MStatus stat; // Check whether need to redo points if (s_PointerPoints.length()) { if (s_PointerYUp != MGlobal::isYAxisUp()) { // Store the up axis s_PointerYUp = MGlobal::isYAxisUp(); // Points are for Y-UP float pointerVerts[][4] = { {-200, -100, 0, 1}, {-200, 0, 100, 1}, {-200, 0, 100, 1}, {-200, 100, 0, 1}, {-200, 100, 0, 1}, { 0, 0, 0, 1}, { 0, 0, 0, 1}, {-200, -100, 0, 1}, {-200, 0, 100, 1}, { 0, 0, 0, 1}, {-200, -100, 0, 1}, {-200, 100, 0, 1} }; s_PointerPoints = MPointArray(pointerVerts, 12); // Flip the points if Y-Up if (s_PointerYUp) { for(unsigned i = 0; i < s_PointerPoints.length(); ++i) { MPoint p = s_PointerPoints[i]; s_PointerPoints[i].x = p.y; s_PointerPoints[i].y = p.z; s_PointerPoints[i].z = p.x; } } } } // Go ahead and draw pointer selected if this instance is selected switch (status) { case M3dView::kDormant: { stat = view.setDrawColor(s_DrawColor); MErr(stat, "Unable to do: view.setDrawColor"); break; } case M3dView::kTemplate: { MColor templateColor = view.templateColor(&stat); MErr(stat, "Unable to do: view.templateColor"); stat = view.setDrawColor(templateColor); MErr(stat, "Unable to do: view.setDrawColor"); break; } default: { stat = view.setDrawColor(15, M3dView::kActiveColors); MErr(stat, "Unable to do: view.setDrawColor"); break; } } glPushMatrix(); { glBegin( GL_LINES ); { u32 len = s_PointerPoints.length(); for( unsigned i = 0; i < len; i += 2 ) { glVertex3f((GLfloat)s_PointerPoints[i].x, (GLfloat)s_PointerPoints[i].y, (GLfloat)s_PointerPoints[i].z); glVertex3f((GLfloat)s_PointerPoints[i+1].x, (GLfloat)s_PointerPoints[i+1].y, (GLfloat)s_PointerPoints[i+1].z); } } glEnd(); } glPopMatrix(); }