当前位置: 首页>>代码示例>>C#>>正文


C# Autodesk.beginGL方法代码示例

本文整理汇总了C#中Autodesk.beginGL方法的典型用法代码示例。如果您正苦于以下问题:C# Autodesk.beginGL方法的具体用法?C# Autodesk.beginGL怎么用?C# Autodesk.beginGL使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Autodesk的用法示例。


在下文中一共展示了Autodesk.beginGL方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: draw

        public override void draw(Autodesk.Maya.OpenMayaUI.M3dView view, MDagPath path, Autodesk.Maya.OpenMayaUI.M3dView.DisplayStyle style, Autodesk.Maya.OpenMayaUI.M3dView.DisplayStatus status)
        {
            // Get the size
            //
            MObject thisNode = thisMObject();
            MPlug plug = new MPlug( thisNode, size );
            MDistance sizeVal = new MDistance();
            plug.getValue( sizeVal );

            float multiplier = (float) sizeVal.asCentimeters;

            view.beginGL();

            if ( ( style == M3dView.DisplayStyle.kFlatShaded ) ||
                 ( style == M3dView.DisplayStyle.kGouraudShaded ) )
            {
                // Push the color settings
                //
                OpenGL.glPushAttrib( (uint)OpenGL.GL_CURRENT_BIT );

                if ( status == M3dView.DisplayStatus.kActive ) {
                    view.setDrawColor( 13, (int)M3dView.ColorTable.kActiveColors );
                } else {
                    view.setDrawColor(13, (int)M3dView.ColorTable.kDormantColors);
                }

                OpenGL.glBegin((uint)OpenGL.GL_TRIANGLE_FAN);
                    int i;
                    int last = footPrintData.soleCount - 1;
                    for ( i = 0; i < last; ++i ) {
                        OpenGL.glVertex3f(footPrintData.sole[i,0] * multiplier,
                                        footPrintData.sole[i,1] * multiplier,
                                        footPrintData.sole[i,2] * multiplier);
                    }
                OpenGL.glEnd();
                OpenGL.glBegin((uint)OpenGL.GL_TRIANGLE_FAN);
                last = footPrintData.heelCount - 1;
                    for ( i = 0; i < last; ++i ) {
                        OpenGL.glVertex3f(footPrintData.heel[i,0] * multiplier,
                                        footPrintData.heel[i,1] * multiplier,
                                        footPrintData.heel[i,2] * multiplier);
                    }
                OpenGL.glEnd();

                OpenGL.glPopAttrib();
            }

            // Draw the outline of the foot
            //
            OpenGL.glBegin((uint)OpenGL.GL_LINES);
            {
                int last = footPrintData.soleCount - 1;
                for (int i = 0; i < last; ++i)
                {
                    OpenGL.glVertex3f(footPrintData.sole[i, 0] * multiplier,
                                    footPrintData.sole[i, 1] * multiplier,
                                    footPrintData.sole[i, 2] * multiplier);
                    OpenGL.glVertex3f(footPrintData.sole[i + 1, 0] * multiplier,
                                    footPrintData.sole[i + 1, 1] * multiplier,
                                    footPrintData.sole[i + 1, 2] * multiplier);
                }
                last = footPrintData.heelCount - 1;
                for (int i = 0; i < last; ++i)
                {
                    OpenGL.glVertex3f(footPrintData.heel[i, 0] * multiplier,
                                    footPrintData.heel[i, 1] * multiplier,
                                    footPrintData.heel[i, 2] * multiplier);
                    OpenGL.glVertex3f(footPrintData.heel[i + 1, 0] * multiplier,
                                    footPrintData.heel[i + 1, 1] * multiplier,
                                    footPrintData.heel[i + 1, 2] * multiplier);
                }
            }
            OpenGL.glEnd();

            view.endGL();
        }
开发者ID:EricTRocks,项目名称:Maya-devkit,代码行数:76,代码来源:footPrintNode.cs


注:本文中的Autodesk.beginGL方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。