Example #1
0
 private void drawUVMapCoord(M3dView view, int uv, float u, float v, bool drawNum)
 //
 // Description:
 //  Draw the specified uv value into the port view. If drawNum is true
 //  It will also draw the UV id for the the UV.
 //
 {
     if (drawNum)
     {
         string s = uv.ToString();
         view.drawText(s, new MPoint(u, v, 0), M3dView.TextPosition.kCenter);
     }
     OpenGL.glVertex3f(u, v, 0.0f);
 }
Example #2
0
        public override void draw(M3dView view, MDagPath path, M3dView.DisplayStyle style, M3dView.DisplayStatus status)
        {
            base.draw(view, path, style, status);

            //
            view.beginGL();

            //MPoint textPos = new MPoint(nodeTranslation());
            MPoint textPos      = new MPoint(0, 0, 0);
            String distanceText = "Two custom line manipulators";

            view.drawText(distanceText, textPos, M3dView.TextPosition.kLeft);

            //
            view.endGL();
        }
Example #3
0
		public override void draw(M3dView view, MDagPath path, M3dView.DisplayStyle style, M3dView.DisplayStatus status)
		{
			base.draw(view, path, style, status);

			//
			view.beginGL(); 

			//MPoint textPos = new MPoint(nodeTranslation());
			MPoint textPos = new MPoint(0,0,0);
			String distanceText = "Two custom line manipulators";
			view.drawText(distanceText, textPos, M3dView.TextPosition.kLeft);

			// 
			view.endGL();
		}
Example #4
0
 //
 // Description:
 //  Draw the specified uv value into the port view. If drawNum is true
 //  It will also draw the UV id for the the UV.
 //
 private void drawUVMapCoord( M3dView view, int uv, float u, float v, bool drawNum )
 {
     if ( drawNum ) {
         string s = uv.ToString();
         view.drawText(s, new MPoint(u, v, 0), M3dView.TextPosition.kCenter);
     }
     OpenGL.glVertex3f(u, v, 0.0f);
 }
Example #5
0
        //
        // Description:
        //
        //     Component (vertex) drawing routine
        //
        // Arguments:
        //
        //     request - request to be drawn
        //     view    - view to draw into
        //
        public void drawVertices( MDrawRequest request, M3dView view )
        {
            MDrawData data = request.drawData();
            apiMeshGeom geom = (apiMeshGeom)data.geometry();
            if (geom == null) return;

            view.beginGL();

            // Query current state so it can be restored
            //
            bool lightingWasOn = OpenGL.glIsEnabled(OpenGL.GL_LIGHTING) != 0;
            if ( lightingWasOn ) {
                OpenGL.glDisable(OpenGL.GL_LIGHTING);
            }
            float[] lastPointSize = new float[1];
            OpenGL.glGetFloatv(OpenGL.GL_POINT_SIZE, lastPointSize);

            // Set the point size of the vertices
            //
            OpenGL.glPointSize(POINT_SIZE);

            // If there is a component specified by the draw request
            // then loop over comp (using an MFnComponent class) and draw the
            // active vertices, otherwise draw all vertices.
            //
            MObject comp = request.component;
            if ( ! comp.isNull ) {
                MFnSingleIndexedComponent fnComponent = new MFnSingleIndexedComponent( comp );
                for ( int i=0; i<fnComponent.elementCount; i++ )
                {
                    int index = fnComponent.element( i );
                    OpenGL.glBegin(OpenGL.GL_POINTS);
                    MPoint vertex = geom.vertices[ index ];
                    OpenGL.glVertex3f((float)vertex[0],
                                (float)vertex[1],
                                (float)vertex[2] );
                    OpenGL.glEnd();

                    string annotation = index.ToString();
                    view.drawText( annotation, vertex );
                }
            }
            else {
                int vid = 0;
                for ( int i=0; i<geom.faceCount; i++ )
                {
                    OpenGL.glBegin(OpenGL.GL_POINTS);
                    for ( int v=0; v<geom.face_counts[i]; v++ )
                    {
                        MPoint vertex = geom.vertices[ geom.face_connects[vid++] ];
                        OpenGL.glVertex3f((float)vertex[0],
                                    (float)vertex[1],
                                    (float)vertex[2] );
                    }
                    OpenGL.glEnd();
                }
            }

            // Restore the state
            //
            if ( lightingWasOn ) {
                OpenGL.glEnable(OpenGL.GL_LIGHTING);
            }
            OpenGL.glPointSize(lastPointSize[0]);

            view.endGL();
        }
Example #6
0
        public void drawVertices(MDrawRequest request, M3dView view)
        {
            MDrawData data = request.drawData();
            MVectorArray geom = data.geometry() as MVectorArray;

            view.beginGL();

            // Query current state so it can be restored
            //
            bool lightingWasOn = OpenGL.glIsEnabled(OpenGL.GL_LIGHTING) != 0 ? true : false;
            if (lightingWasOn)
            {
                OpenGL.glDisable(OpenGL.GL_LIGHTING);
            }
            float lastPointSize;
            getLastPointSize(out lastPointSize);

            // Set the point size of the vertices
            //
            OpenGL.glPointSize(POINT_SIZE);

            // If there is a component specified by the draw request
            // then loop over comp (using an MFnComponent class) and draw the
            // active vertices, otherwise draw all vertices.
            //
            MObject comp = request.component;
            if (!comp.isNull)
            {
                MFnSingleIndexedComponent fnComponent = new MFnSingleIndexedComponent(comp);
                for (int i = 0; i < fnComponent.elementCount; i++)
                {
                    int index = fnComponent.element(i);
                    OpenGL.glBegin(OpenGL.GL_POINTS);
                    MVector point = geom[index];
                    OpenGL.glVertex3f((float)point[0],
                                (float)point[1],
                                (float)point[2]);
                    OpenGL.glEnd();

                    MPoint mp = new MPoint(point);
                    view.drawText(String.Format("{0}", index), mp);
                }
            }
            else
            {
                for (int i = 0; i < geom.length; i++)
                {
                    OpenGL.glBegin(OpenGL.GL_POINTS);
                    MVector point = geom[i];
                    OpenGL.glVertex3f((float)point[0], (float)point[1], (float)point[2]);
                    OpenGL.glEnd();
                }
            }

            // Restore the state
            //
            if (lightingWasOn)
            {
                OpenGL.glEnable(OpenGL.GL_LIGHTING);
            }
            OpenGL.glPointSize(lastPointSize);

            view.endGL();
        }
Example #7
0
        public void drawVertices(MDrawRequest request, M3dView view)
        //
        // Description:
        //
        //     Component (vertex) drawing routine
        //
        // Arguments:
        //
        //     request - request to be drawn
        //     view    - view to draw into
        //
        {
            MDrawData   data = request.drawData();
            apiMeshGeom geom = (apiMeshGeom)data.geometry();

            if (geom == null)
            {
                return;
            }

            view.beginGL();

            // Query current state so it can be restored
            //
            bool lightingWasOn = OpenGL.glIsEnabled(OpenGL.GL_LIGHTING) != 0;

            if (lightingWasOn)
            {
                OpenGL.glDisable(OpenGL.GL_LIGHTING);
            }
            float[] lastPointSize = new float[1];
            OpenGL.glGetFloatv(OpenGL.GL_POINT_SIZE, lastPointSize);

            // Set the point size of the vertices
            //
            OpenGL.glPointSize(POINT_SIZE);

            // If there is a component specified by the draw request
            // then loop over comp (using an MFnComponent class) and draw the
            // active vertices, otherwise draw all vertices.
            //
            MObject comp = request.component;

            if (!comp.isNull)
            {
                MFnSingleIndexedComponent fnComponent = new MFnSingleIndexedComponent(comp);
                for (int i = 0; i < fnComponent.elementCount; i++)
                {
                    int index = fnComponent.element(i);
                    OpenGL.glBegin(OpenGL.GL_POINTS);
                    MPoint vertex = geom.vertices[index];
                    OpenGL.glVertex3f((float)vertex[0],
                                      (float)vertex[1],
                                      (float)vertex[2]);
                    OpenGL.glEnd();

                    string annotation = index.ToString();
                    view.drawText(annotation, vertex);
                }
            }
            else
            {
                int vid = 0;
                for (int i = 0; i < geom.faceCount; i++)
                {
                    OpenGL.glBegin(OpenGL.GL_POINTS);
                    for (int v = 0; v < geom.face_counts[i]; v++)
                    {
                        MPoint vertex = geom.vertices[geom.face_connects[vid++]];
                        OpenGL.glVertex3f((float)vertex[0],
                                          (float)vertex[1],
                                          (float)vertex[2]);
                    }
                    OpenGL.glEnd();
                }
            }

            // Restore the state
            //
            if (lightingWasOn)
            {
                OpenGL.glEnable(OpenGL.GL_LIGHTING);
            }
            OpenGL.glPointSize(lastPointSize[0]);

            view.endGL();
        }
Example #8
0
        public void drawVertices(MDrawRequest request, M3dView view)
        {
            MDrawData    data = request.drawData();
            MVectorArray geom = data.geometry() as MVectorArray;

            view.beginGL();

            // Query current state so it can be restored
            //
            bool lightingWasOn = OpenGL.glIsEnabled(OpenGL.GL_LIGHTING) != 0 ? true : false;

            if (lightingWasOn)
            {
                OpenGL.glDisable(OpenGL.GL_LIGHTING);
            }
            float lastPointSize;

            getLastPointSize(out lastPointSize);

            // Set the point size of the vertices
            //
            OpenGL.glPointSize(POINT_SIZE);

            // If there is a component specified by the draw request
            // then loop over comp (using an MFnComponent class) and draw the
            // active vertices, otherwise draw all vertices.
            //
            MObject comp = request.component;

            if (!comp.isNull)
            {
                MFnSingleIndexedComponent fnComponent = new MFnSingleIndexedComponent(comp);
                for (int i = 0; i < fnComponent.elementCount; i++)
                {
                    int index = fnComponent.element(i);
                    OpenGL.glBegin(OpenGL.GL_POINTS);
                    MVector point = geom[index];
                    OpenGL.glVertex3f((float)point[0],
                                      (float)point[1],
                                      (float)point[2]);
                    OpenGL.glEnd();

                    MPoint mp = new MPoint(point);
                    view.drawText(String.Format("{0}", index), mp);
                }
            }
            else
            {
                for (int i = 0; i < geom.length; i++)
                {
                    OpenGL.glBegin(OpenGL.GL_POINTS);
                    MVector point = geom[i];
                    OpenGL.glVertex3f((float)point[0], (float)point[1], (float)point[2]);
                    OpenGL.glEnd();
                }
            }

            // Restore the state
            //
            if (lightingWasOn)
            {
                OpenGL.glEnable(OpenGL.GL_LIGHTING);
            }
            OpenGL.glPointSize(lastPointSize);

            view.endGL();
        }
Example #9
0
		private void drawUVMapCoord( M3dView view, int uv, float u, float v, bool drawNum )
		//
		// Description:
		//  Draw the specified uv value into the port view. If drawNum is true
		//  It will also draw the UV id for the the UV.
		//
		{
			if ( drawNum ) { 
				string s = uv.ToString();
				view.drawText(s, new MPoint(u, v, 0), M3dView.TextPosition.kCenter);
			}
			OpenGL.glVertex3f(u, v, 0.0f);
		}