Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            if (obj == null)
            {
                return(false);
            }
            if (obj is FaceSetCompare)
            {
                FaceSetCompare e  = (FaceSetCompare)obj;
                bool           v  = V.Equals(e.V);
                bool           vn = VN.Equals(e.VN);
                bool           vu = VU.Equals(e.VU);

                return(v && vn && vu);
            }
            return(base.Equals(obj));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Build a Single Group from the Member Data generated with LoadLists()
        /// </summary>
        /// <param name="g"></param>
        /// <remarks>At this point, the faces Member contains the face List for
        /// the current Group</remarks>
        void BuildGroup(ImportedGroup g)
        {
            ArrayList    fv        = new ArrayList();
            ElementAlias alias     = new ElementAlias();
            Hashtable    facealias = new Hashtable();

            g.SetKeepOrder(CanKeepOrder(faces));


            BuildAliasMap(alias.V, vertices);
            BuildAliasMap(alias.VN, normals);
            BuildAliasMap(alias.VU, uvmaps);


            //Build the Face/Element List
            for (int x = 0; x < faces.Count; x++)
            {
                GmdcElementValueThreeFloat f = (GmdcElementValueThreeFloat)faces[x];

                FaceSetCompare fc = new FaceSetCompare(alias, f.Data[0], f.Data[2], f.Data[1]);


                //check if we already have this combination
                object o = facealias[fc];
#if DEBUG
                try
                {
#endif
                int c = g.Elements[0].Values.Count;
                if (o == null)
                {
                    if (fc.V >= 0)
                    {
                        int cv = -1;
                        if (g.KeepOrder)
                        {
                            if (f.Data[0] > 0)
                            {
                                c = (int)f.Data[0] - 1;
                            }
                            cv = c;
                        }


                        AddElement(g, 0, vertices[fc.V], cv);
                        AddElement(g, 1, normals[fc.VN], cv);
                        AddElement(g, 2, uvmaps[fc.VU], cv);
                    }

                    facealias[fc] = c;
                }
                else
                {
                    c = (int)o;
                }

                if (fc.V >= 0 || fc.VN >= 0 || fc.VU >= 0)
                {
                    g.Group.Faces.Add(c);
                }
#if DEBUG
            }
            catch (Exception ex)
            {
                FaceSetCompare ft = new FaceSetCompare(alias, f.Data[0], f.Data[2], f.Data[1]);
                Helper.ExceptionMessage(ex);
                return;
            }
#endif
            }

            if (g.KeepOrder)
            {
                ///Make sure all slots in the Elemnts are set
                FillMissingElements(g, 0, new Gmdc.GmdcElementValueThreeFloat(0, 0, 0));
                FillMissingElements(g, 1, new Gmdc.GmdcElementValueThreeFloat(0, 0, 0));
                FillMissingElements(g, 2, new Gmdc.GmdcElementValueTwoFloat(0, 0));
            }
        }