Esempio n. 1
0
 public FaceSetCompare(ElementAlias alias, float v, float vn, float vu) : this(alias, (int)v, (int)vn, (int)vu)
 {
 }
Esempio n. 2
0
 public FaceSetCompare(ElementAlias alias, int v, int vn, int vu)
 {
     V  = GetAlias(alias.V, v);
     VN = GetAlias(alias.VN, vn);
     VU = GetAlias(alias.VU, vu);
 }
Esempio n. 3
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));
            }
        }