コード例 #1
0
ファイル: move_manipulator.cpp プロジェクト: jonntd/mannequin
void MannequinMoveManipulator::draw(M3dView &view,
  const MDagPath &path,
  M3dView::DisplayStyle style,
  M3dView::DisplayStatus status) {
  static MGLFunctionTable *gGLFT = 0;
  if (0 == gGLFT) {
    gGLFT = MHardwareRenderer::theRenderer()->glFunctionTable();
  }

  recalcMetrics();

  float size = _manipScale * MFnManip3D::globalSize();
  float handleSize = MFnManip3D::handleSize() / 100.0f; // Probably on [0, 100].
  float handleHeight = size * handleSize * 0.5f;
  float handleOfs = size - handleHeight;
  float handleRadius = handleHeight * 0.25f;

  float origin[4];
  _origin.get(origin);

  float x[4], y[4], z[4];
  (_origin + (_x * size)).get(x);
  (_origin + (_y * size)).get(y);
  (_origin + (_z * size)).get(z);

  view.beginGL();

  GLUquadricObj* quadric = gluNewQuadric();
  gluQuadricNormals(quadric, GLU_SMOOTH);
  gluQuadricTexture(quadric, true);
  gluQuadricDrawStyle(quadric, GLU_FILL);

  colorAndName(view, _glPickableItem + 0, true, xColor());
  gGLFT->glBegin(MGL_LINES);
    gGLFT->glVertex3fv(origin);
    gGLFT->glVertex3fv(x);
  gGLFT->glEnd();
  glDrawCone(quadric, _origin + (_x * handleOfs), _x, handleHeight,
    handleRadius);

  colorAndName(view, _glPickableItem + 1, true, yColor());
  gGLFT->glBegin(MGL_LINES);
    gGLFT->glVertex3fv(origin);
    gGLFT->glVertex3fv(y);
  gGLFT->glEnd();
  glDrawCone(quadric, _origin + (_y * handleOfs), _y, handleHeight,
    handleRadius);

  colorAndName(view, _glPickableItem + 2, true, zColor());
  gGLFT->glBegin(MGL_LINES);
    gGLFT->glVertex3fv(origin);
    gGLFT->glVertex3fv(z);
  gGLFT->glEnd();
  glDrawCone(quadric, _origin + (_z * handleOfs), _z, handleHeight,
    handleRadius);

  gluDeleteQuadric(quadric);

  view.endGL();
}
コード例 #2
0
ファイル: ToolBox.cpp プロジェクト: KeckCAVES/flow
void DefaultIcon::display ( GLContextData& contextData ) const
{
	glMaterial ( GLMaterialEnums::FRONT_AND_BACK, GLMaterial ( Vrui::getUiBgColor ( ) ) ) ;
	glPushMatrix ( ) ;
	glTranslate ( 0.0f, 0.0f, 0.0f ) ;
	glRotate ( Vrui::Scalar ( 50.0 ), Vrui::Vector ( -1.0, -1.0, 1.0 ) ) ;
	glDrawCone ( 0.75, 1.5, 10 ) ;
	glPopMatrix ( ) ;
}
コード例 #3
0
void FiberApplication::drawArrow(const Vrui::Point& to, Vrui::Scalar radius) const
{
        Vrui::Scalar tipHeight=radius*Vrui::Scalar(6.0);
        Vrui::Scalar shaftLength=Geometry::dist(Vrui::Point::origin,to)-tipHeight;

        glPushMatrix();
        glTranslate(Vrui::Point::origin-Vrui::Point::origin);
        glRotate(Vrui::Rotation::rotateFromTo(Vrui::Vector(0,0,1),to-Vrui::Point::origin));
        glTranslate(Vrui::Vector(0,0,Math::div2(shaftLength)));
        glDrawCylinder(radius,shaftLength,24);
        glTranslate(Vrui::Vector(0,0,Math::div2(shaftLength)+tipHeight*Vrui::Scalar(0.25)));
        glDrawCone(radius*Vrui::Scalar(2),tipHeight,24);
        glPopMatrix();
}
コード例 #4
0
void Glyph::render(int glyphType,GLfloat glyphSize)
	{
	switch(glyphType)
		{
		case CONE:
			glRotatef(-90.0f,1.0f,0.0f,0.0f);
			glTranslatef(0.0f,0.0f,-0.75f*glyphSize);
			glDrawCone(0.25f*glyphSize,glyphSize,16);
			break;
		
		case CUBE:
			glDrawCube(glyphSize);
			break;
		
		case SPHERE:
			glDrawSphereIcosahedron(0.5f*glyphSize,8);
			break;
		
		case CROSSBALL:
			glDrawSphereIcosahedron(0.4f*glyphSize,8);
			glDrawCylinder(0.125f*glyphSize,1.1f*glyphSize,16);
			glRotatef(90.0f,1.0f,0.0f,0.0f);
			glDrawCylinder(0.125f*glyphSize,1.1f*glyphSize,16);
			glRotatef(90.0f,0.0f,1.0f,0.0f);
			glDrawCylinder(0.125f*glyphSize,1.1f*glyphSize,16);
			break;
		
		case BOX:
			{
			#if 1
			glDrawWireframeCube(glyphSize,glyphSize*0.075f,glyphSize*0.15f);
			#else
			GLfloat gs=glyphSize*0.5f;
			glPushAttrib(GL_ENABLE_BIT|GL_POINT_BIT|GL_LINE_BIT);
			glDisable(GL_LIGHTING);
			glPointSize(5.0f);
			glBegin(GL_POINTS);
			glVertex3f(-gs,-gs,-gs);
			glVertex3f( gs,-gs,-gs);
			glVertex3f(-gs, gs,-gs);
			glVertex3f( gs, gs,-gs);
			glVertex3f(-gs,-gs, gs);
			glVertex3f( gs,-gs, gs);
			glVertex3f(-gs, gs, gs);
			glVertex3f( gs, gs, gs);
			glEnd();
			glLineWidth(3.0f);
			glBegin(GL_LINE_STRIP);
			glVertex3f(-gs,-gs,-gs);
			glVertex3f( gs,-gs,-gs);
			glVertex3f( gs, gs,-gs);
			glVertex3f(-gs, gs,-gs);
			glVertex3f(-gs,-gs,-gs);
			glVertex3f(-gs,-gs, gs);
			glVertex3f( gs,-gs, gs);
			glVertex3f( gs, gs, gs);
			glVertex3f(-gs, gs, gs);
			glVertex3f(-gs,-gs, gs);
			glEnd();
			glBegin(GL_LINES);
			glVertex3f( gs,-gs,-gs);
			glVertex3f( gs,-gs, gs);
			glVertex3f( gs, gs,-gs);
			glVertex3f( gs, gs, gs);
			glVertex3f(-gs, gs,-gs);
			glVertex3f(-gs, gs, gs);
			glEnd();
			glPopAttrib();
			#endif
			break;
			}
		}
	}