public void BuildSelectedGeometry()
        {
            GL.PushMatrix();
            GL.DeleteLists(GL_SELECT, 1);
            GL.NewList(GL_SELECT, ListMode.Compile);

            {
                GL.Begin(PrimitiveType.Polygon);
                int idx = editor.m_dmesh.selected_poly;
                if (idx > -1 && idx < editor.m_dmesh.polygon.Count)
                {
                    DPoly dp = editor.m_dmesh.polygon[idx];
                    if (editor.m_edit_mode == EditMode.POLY)
                    {
                        GL.Color3(dp.marked ? C_select_marked_main : C_select_main);
                    }
                    else
                    {
                        GL.Color3(dp.marked ? C_select_marked : C_select);
                    }
                    CreatePolygon(dp, editor.m_dmesh);
                }
                GL.End();

                // Verts
                GL.Begin(PrimitiveType.Points);
                idx = editor.m_dmesh.selected_vert;
                if (idx > -1 && idx < editor.m_dmesh.vertex.Count)
                {
                    Vector3 v  = editor.m_dmesh.vertex[idx];
                    DVert   dv = editor.m_dmesh.vert_info[idx];
                    if (editor.m_edit_mode == EditMode.VERT)
                    {
                        GL.Color3(dv.marked ? C_select_marked_main : C_select_main);
                    }
                    else
                    {
                        GL.Color3(dv.marked ? C_select_marked : C_select);
                    }
                    CreateVertexPoint(v);
                }
                GL.End();
            }

            GL.EndList();
            GL.PopMatrix();
        }
        public void DeserializePolys(JObject root)
        {
            // Just initialize vert info
            for (int i = 0; i < vertex.Count; i++)
            {
                DVert d_vert = new DVert();
                vert_info.Add(d_vert);
            }

            JObject j_polys = root["polys"].GetObject();

            foreach (var kvp in j_polys)
            {
                JObject j_poly = kvp.Value.GetObject();
                DPoly   d_poly = new DPoly(j_poly);
                polygon.Add(d_poly);
            }
        }
Esempio n. 3
0
        public void CopyExtraProperties(DMesh src)
        {
#if OVERLOAD_LEVEL_EDITOR
            for (int i = 0; i < src.polygon.Count; i++)
            {
                DPoly dpoly = new DPoly(src.polygon[i]);
                polygon.Add(dpoly);
            }
            for (int i = 0; i < src.vert_info.Count; i++)
            {
                DVert dvert = new DVert(src.vert_info[i]);
                vert_info.Add(dvert);
            }

            selected_poly    = src.selected_poly;
            selected_vert    = src.selected_vert;
            num_marked_polys = src.num_marked_polys;
            num_marked_verts = src.num_marked_verts;
#endif
        }
 public DVert(DVert src)
 {
     marked = src.marked;
     tag    = src.tag;
 }