コード例 #1
0
        public void DrawSelectedTetrahedron(TetMesh mesh)
        {
            GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Line);
            GL.LineWidth(GlobalSetting.DisplaySetting.LineWidth);
            OpenGLManager.Instance.SetColorMesh(GlobalSetting.DisplaySetting.WifeFrameColor);
            GL.Begin(BeginMode.Triangles);
            foreach (var tet in mesh.Tetras)
            {
                if (tet.Flag != 0)
                {
                    foreach (var face in tet.Faces)
                    {
                        if (TetMeshFlag.CheckBoundary(face) != null)
                        {
                            foreach (var v in face.Vertices)
                            {
                                GL.Normal3(v.SelectedNormal.ToArray());
                                GL.Vertex3(v.Pos.ToArray());
                            }
                        }
                    }
                }
            }
            GL.End();

            GL.LightModel(LightModelParameter.LightModelTwoSide, 1f);
            GL.ShadeModel(ShadingModel.Smooth);
            GL.PolygonMode(MaterialFace.FrontAndBack, PolygonMode.Fill);
            GL.Enable(EnableCap.Normalize);
            //Color c = GlobalSetting.MeshDisplaySetting.TetrahedronColor;
            //OpenGLManager.Instance.SetMeshColor(c);
            GL.Disable(EnableCap.ColorMaterial);
            OpenGLManager.Instance.SetMaterialInfo();

            GL.Begin(BeginMode.Triangles);
            foreach (var tet in mesh.Tetras)
            {
                if (tet.Flag != 0)
                {
                    foreach (var face in tet.Faces)
                    {
                        if (TetMeshFlag.CheckBoundary(face) != null)
                        {
                            foreach (var v in face.Vertices)
                            {
                                GL.Normal3(v.SelectedNormal.ToArray());
                                GL.Vertex3(v.Pos.ToArray());
                            }
                        }
                    }
                }
            }
            GL.End();
            GL.Enable(EnableCap.ColorMaterial);
        }
コード例 #2
0
        public void ComputeSelectedNormal()
        {
            foreach (var face in this.faces)
            {
                face.SelectedNormal = TetMeshFlag.ComputeNormal(face);
            }

            Vector3D[] vn = TetMeshFlag.ComputeNormalUniformWeight(this);
            foreach (var v in this.vertices)
            {
                v.SelectedNormal = vn[v.Index];
            }
        }