private void drawUVMapCoordNum(apiMeshGeom geom, M3dView view, MTextureEditorDrawInfo info, bool drawNumbers) // // Description: // Draw the UV points for all uvs on this surface shape. // { view.beginGL(); float[] ptSize = new float[1]; OpenGL.glGetFloatv(OpenGL.GL_POINT_SIZE, ptSize); OpenGL.glPointSize(UV_POINT_SIZE); int uv; uint uv_len = geom.uvcoords.uvcount(); for (uv = 0; uv < uv_len; uv++) { float du = 0.0f; float dv = 0.0f; geom.uvcoords.getUV(uv, ref du, ref dv); drawUVMapCoord(view, uv, du, dv, drawNumbers); } OpenGL.glPointSize(ptSize[0]); view.endGL(); }
private void drawUVWireframe(apiMeshGeom geom, M3dView view, MTextureEditorDrawInfo info) // // Description: // Draws the UV layout in wireframe mode. // { view.beginGL(); // Draw the polygons // int vid = 0; int vid_start = 0; for (int i = 0; i < geom.faceCount; i++) { OpenGL.glBegin(OpenGL.GL_LINES); uint v; float du1 = 0.0f; float dv1 = 0.0f; float du2 = 0.0f; float dv2 = 0.0f; int uvId1, uvId2; vid_start = vid; for (v = 0; v < geom.face_counts[i] - 1; v++) { uvId1 = geom.uvcoords.uvId(vid); uvId2 = geom.uvcoords.uvId(vid + 1); geom.uvcoords.getUV(uvId1, ref du1, ref dv1); geom.uvcoords.getUV(uvId2, ref du2, ref dv2); OpenGL.glVertex3f(du1, dv1, 0.0f); OpenGL.glVertex3f(du2, dv2, 0.0f); vid++; } uvId1 = geom.uvcoords.uvId(vid); uvId2 = geom.uvcoords.uvId(vid_start); geom.uvcoords.getUV(uvId1, ref du1, ref dv1); geom.uvcoords.getUV(uvId2, ref du2, ref dv2); OpenGL.glVertex3f(du1, dv1, 0.0f); OpenGL.glVertex3f(du2, dv2, 0.0f); vid++; OpenGL.glEnd(); } view.endGL(); }
// Main draw routine for UV editor. This is called by maya when the // shape is selected and the UV texture window is visible. // public override void drawUV(M3dView view, MTextureEditorDrawInfo info) // // Description: // Main entry point for UV drawing. This method is called by the UV // texture editor when the shape is 'active'. // // Input: // A 3dView. // { apiMesh meshNode = (apiMesh)surfaceShape; apiMeshGeom geom = meshNode.meshGeom(); uint uv_len = geom.uvcoords.uvcount(); if (uv_len > 0) { view.setDrawColor(new MColor(1.0f, 0.0f, 0.0f)); switch (info.drawingFunction) { case MTextureEditorDrawInfo.DrawingFunction.kDrawWireframe: drawUVWireframe(geom, view, info); break; case MTextureEditorDrawInfo.DrawingFunction.kDrawEverything: case MTextureEditorDrawInfo.DrawingFunction.kDrawUVForSelect: drawUVWireframe(geom, view, info); drawUVMapCoordNum(geom, view, info, false); break; case MTextureEditorDrawInfo.DrawingFunction.kDrawVertexForSelect: case MTextureEditorDrawInfo.DrawingFunction.kDrawEdgeForSelect: case MTextureEditorDrawInfo.DrawingFunction.kDrawFacetForSelect: default: drawUVWireframe(geom, view, info); break; } ; } }
// // Description: // Draws the UV layout in wireframe mode. // private void drawUVWireframe( apiMeshGeom geom, M3dView view, MTextureEditorDrawInfo info) { view.beginGL(); // Draw the polygons // int vid = 0; int vid_start = 0; for ( int i=0; i<geom.faceCount; i++ ) { OpenGL.glBegin(OpenGL.GL_LINES); uint v; float du1 = 0.0f; float dv1 = 0.0f; float du2 = 0.0f; float dv2 = 0.0f; int uvId1, uvId2; vid_start = vid; for ( v=0; v<geom.face_counts[i]-1; v++ ) { uvId1 = geom.uvcoords.uvId(vid); uvId2 = geom.uvcoords.uvId(vid + 1); geom.uvcoords.getUV( uvId1, ref du1, ref dv1 ); geom.uvcoords.getUV( uvId2, ref du2, ref dv2 ); OpenGL.glVertex3f( du1, dv1, 0.0f ); OpenGL.glVertex3f( du2, dv2, 0.0f ); vid++; } uvId1 = geom.uvcoords.uvId(vid); uvId2 = geom.uvcoords.uvId(vid_start); geom.uvcoords.getUV( uvId1, ref du1, ref dv1 ); geom.uvcoords.getUV( uvId2, ref du2, ref dv2 ); OpenGL.glVertex3f(du1, dv1, 0.0f); OpenGL.glVertex3f(du2, dv2, 0.0f); vid ++ ; OpenGL.glEnd(); } view.endGL(); }
// // Description: // Draw the UV points for all uvs on this surface shape. // private void drawUVMapCoordNum( apiMeshGeom geom, M3dView view, MTextureEditorDrawInfo info, bool drawNumbers) { view.beginGL(); float[] ptSize = new float[1]; OpenGL.glGetFloatv(OpenGL.GL_POINT_SIZE, ptSize); OpenGL.glPointSize(UV_POINT_SIZE); int uv; uint uv_len = geom.uvcoords.uvcount(); for ( uv = 0; uv < uv_len; uv ++ ) { float du = 0.0f; float dv = 0.0f; geom.uvcoords.getUV( uv, ref du, ref dv ); drawUVMapCoord( view, uv, du, dv, drawNumbers ); } OpenGL.glPointSize(ptSize[0]); view.endGL(); }
// // Description: // Main entry point for UV drawing. This method is called by the UV // texture editor when the shape is 'active'. // // Input: // A 3dView. // // Main draw routine for UV editor. This is called by maya when the // shape is selected and the UV texture window is visible. // public override void drawUV( M3dView view, MTextureEditorDrawInfo info ) { apiMesh meshNode = (apiMesh)surfaceShape; apiMeshGeom geom = meshNode.meshGeom(); uint uv_len = geom.uvcoords.uvcount(); if (uv_len > 0) { view.setDrawColor( new MColor( 1.0f, 0.0f, 0.0f ) ); switch( info.drawingFunction ) { case MTextureEditorDrawInfo.DrawingFunction.kDrawWireframe: drawUVWireframe( geom, view, info ); break; case MTextureEditorDrawInfo.DrawingFunction.kDrawEverything: case MTextureEditorDrawInfo.DrawingFunction.kDrawUVForSelect: drawUVWireframe( geom, view, info ); drawUVMapCoordNum( geom, view, info, false ); break; case MTextureEditorDrawInfo.DrawingFunction.kDrawVertexForSelect: case MTextureEditorDrawInfo.DrawingFunction.kDrawEdgeForSelect: case MTextureEditorDrawInfo.DrawingFunction.kDrawFacetForSelect: default: drawUVWireframe( geom, view, info ); break; }; } }
// Main draw routine for UV editor. This is called by maya when the // shape is selected and the UV texture window is visible. // public override void drawUV( M3dView view, MTextureEditorDrawInfo info ) // // Description: // Main entry point for UV drawing. This method is called by the UV // texture editor when the shape is 'active'. // // Input: // A 3dView. // { apiMesh meshNode = (apiMesh)surfaceShape; apiMeshGeom geom = meshNode.meshGeom(); uint uv_len = geom.uvcoords.uvcount(); if (uv_len > 0) { view.setDrawColor( new MColor( 1.0f, 0.0f, 0.0f ) ); switch( info.drawingFunction ) { case MTextureEditorDrawInfo.DrawingFunction.kDrawWireframe: drawUVWireframe( geom, view, info ); break; case MTextureEditorDrawInfo.DrawingFunction.kDrawEverything: case MTextureEditorDrawInfo.DrawingFunction.kDrawUVForSelect: drawUVWireframe( geom, view, info ); drawUVMapCoordNum( geom, view, info, false ); break; case MTextureEditorDrawInfo.DrawingFunction.kDrawVertexForSelect: case MTextureEditorDrawInfo.DrawingFunction.kDrawEdgeForSelect: case MTextureEditorDrawInfo.DrawingFunction.kDrawFacetForSelect: default: drawUVWireframe( geom, view, info ); break; }; } }