예제 #1
0
        public static void DrawLineInfo(Color c, LineGLInfo info)
        {
            GL.Enable(EnableCap.ColorMaterial);
            GL.ColorMaterial(MaterialFace.FrontAndBack, ColorMaterialParameter.Diffuse);

            float[] color = new float[4] {
                c.R / 256f, c.G / 256f, c.B / 256f, 1f
            };

            if (ConfigNPR.Instance.DrawHiddenLine)
            {
                GL.LineWidth((float)ConfigNPR.Instance.HiddenLineWidth);
                GL.Begin(BeginMode.Lines);
                for (int i = 0; i < info.Front; i++)
                {
                    color[3] = info.Alpha[i];
                    GL.Color4(color);
                    GL.Vertex3(info.Vertex[i].ToArray());
                }
                GL.End();
            }

            GL.LineWidth((float)ConfigNPR.Instance.LineWidth);
            GL.Begin(BeginMode.Lines);
            for (int i = info.Front; i < info.Vertex.Length; i++)
            {
                color[3] = i < info.Alpha.Length ? info.Alpha[i] : 1f;
                GL.Color4(color);
                GL.Vertex3(info.Vertex[i].ToArray());
            }
            GL.End();
            GL.Disable(EnableCap.ColorMaterial);
        }
예제 #2
0
        private static void DrawLine(LineBase line)
        {
            if (ConfigNPR.Instance.RTSC)
            {
                LineGLInfo info = RTSC.Instance.GetLine(line.Type);

                DrawLineInfo(line.Color, info);
            }
        }
예제 #3
0
        public LineGLInfo GetLine(EnumLine type)
        {
            if (rtsc == null)
            {
                this.Init(GlobalData.Instance.TriMesh);
            }
            ChangeSettings();

            Vector3D viewpos = ToolPool.Instance.Tool.ComputeViewPoint();

            rtsc.InitRtsc(viewpos);

            switch (type)
            {
            case EnumLine.ApparentRidges:
                rtsc.DrawApparentRidges();
                break;

            case EnumLine.BoundaryLine:
                rtsc.DrawBoundaries();
                break;

            case EnumLine.Contours:
                rtsc.DrawOccludingContours();
                break;

            case EnumLine.DwKrLine:
                rtsc.DrawDwKr();
                break;

            case EnumLine.H0Line:
                rtsc.DrawH();
                break;

            case EnumLine.HighlightLine:
                rtsc.DrawSuggestiveHighlights();
                break;

            case EnumLine.Isophotes:
                Vector3D lightdir = GlobalSetting.Light0Setting.LightPosition;
                rtsc.DrawIsophotes(lightdir, ConfigNPR.Instance.IsoPhotosNum);
                break;

            case EnumLine.K0Line:
                rtsc.DrawK();
                break;

            case EnumLine.PrincipalHighlightRidges:
                rtsc.DrawPrincipalHighlightRidges();
                break;

            case EnumLine.PrincipalHighlightValleys:
                rtsc.DrawPrincipalHighlightValleys();
                break;

            case EnumLine.RidgesLine:
                rtsc.DrawRidges();
                break;

            case EnumLine.Silluhoute:
                rtsc.DrawExteriorSilhouette();
                break;

            case EnumLine.SuggestCountour:
                rtsc.DrawSuggestiveContours();
                break;

            case EnumLine.TopoLines:
                rtsc.DrawTopolines(ConfigNPR.Instance.TopoLineNum, ConfigNPR.Instance.TopoLineOffset);
                break;

            case EnumLine.ValleysLine:
                rtsc.DrawValleys();
                break;
            }
            LineGLInfo info = new LineGLInfo(rtsc.gl_alpha, rtsc.gl_vertex, rtsc.front_index);

            return(info);
        }
예제 #4
0
파일: RTSC.cs 프로젝트: meshdgp/MeshDGP
        public LineGLInfo GetLine(EnumLine type)
        {
            if(rtsc==null)
            {
                this.Init(GlobalData.Instance.TriMesh);
            }
            ChangeSettings();

            Vector3D viewpos = ToolPool.Instance.Tool.ComputeViewPoint();
            rtsc.InitRtsc(viewpos);

            switch (type)
            {
                case EnumLine.ApparentRidges:
                rtsc.DrawApparentRidges();
                break;

                case EnumLine.BoundaryLine:
                rtsc.DrawBoundaries();
                break;

                case EnumLine.Contours:
                rtsc.DrawOccludingContours();
                break;

                case EnumLine.DwKrLine:
                rtsc.DrawDwKr();
                break;

                case EnumLine.H0Line:
                rtsc.DrawH();
                break;
                case EnumLine.HighlightLine:
                rtsc.DrawSuggestiveHighlights();
                break;
                case EnumLine.Isophotes:
                Vector3D lightdir = GlobalSetting.Light0Setting.LightPosition;
                rtsc.DrawIsophotes(lightdir, ConfigNPR.Instance.IsoPhotosNum);
                break;
                case EnumLine.K0Line:
                rtsc.DrawK();
                break;
                case EnumLine.PrincipalHighlightRidges:
                rtsc.DrawPrincipalHighlightRidges();
                break;
                case EnumLine.PrincipalHighlightValleys:
                rtsc.DrawPrincipalHighlightValleys();
                break;
                case EnumLine.RidgesLine:
                rtsc.DrawRidges();
                break;
                case EnumLine.Silluhoute:
                rtsc.DrawExteriorSilhouette();
                break;
                case EnumLine.SuggestCountour:
                rtsc.DrawSuggestiveContours();
                break;
                case EnumLine.TopoLines:
                rtsc.DrawTopolines(ConfigNPR.Instance.TopoLineNum, ConfigNPR.Instance.TopoLineOffset);
                break;
                case EnumLine.ValleysLine:
                rtsc.DrawValleys();
                break;
               

            }
            LineGLInfo info=new LineGLInfo(rtsc.gl_alpha, rtsc.gl_vertex, rtsc.front_index);
            return info;
        }
예제 #5
0
파일: NPRDraw.cs 프로젝트: meshdgp/MeshDGP
        public static void DrawLineInfo(Color c, LineGLInfo info)
        { 

            GL.Enable(EnableCap.ColorMaterial);
            GL.ColorMaterial(MaterialFace.FrontAndBack, ColorMaterialParameter.Diffuse);  
          
            float[] color = new float[4] { c.R / 256f, c.G / 256f, c.B / 256f, 1f };

            if (ConfigNPR.Instance.DrawHiddenLine)
            {
                GL.LineWidth((float)ConfigNPR.Instance.HiddenLineWidth);
                GL.Begin(BeginMode.Lines);
                for (int i = 0; i < info.Front; i++)
                {
                    color[3] = info.Alpha[i];
                    GL.Color4(color);
                    GL.Vertex3(info.Vertex[i].ToArray());
                }
                GL.End();
            }

            GL.LineWidth((float)ConfigNPR.Instance.LineWidth);
            GL.Begin(BeginMode.Lines);
            for (int i = info.Front; i < info.Vertex.Length; i++)
            {
                color[3] = i < info.Alpha.Length ? info.Alpha[i] : 1f;
                GL.Color4(color);
                GL.Vertex3(info.Vertex[i].ToArray());
            }
            GL.End();
            GL.Disable(EnableCap.ColorMaterial);
        }