Exemplo n.º 1
0
        void AdjustLOD()
        {
            List <ME2Vector> lod2 = me2Save.PlayerRecord.Appearance.MorphHead.LOD0Vertices;
            List <ME3Vector> lod3 = me3Save.Player.Appearance.MorphHead.Lod0Vertices;

            for (int i = 0; i < mapping.Mapping.Length; i++)
            {
                if (mapping.Verified[i])
                {
                    ME3Vector vec = new ME3Vector()
                    {
                        X = lod2[i].X,
                        Y = lod2[i].Y,
                        Z = lod2[i].Z
                    };
                    if (checkBoxMultiple.Checked)
                    {
                        if (mapping.Mapping[i].Count > 1)
                        {
                            Vector3 avr = Vector3.Zero;
                            foreach (int v in mapping.Mapping[i])
                            {
                                avr += new Vector3(lod3[v].X, lod3[v].Y, lod3[v].Z);
                            }
                            avr /= mapping.Mapping[i].Count;
                            Vector3 offset = new Vector3(vec.X, vec.Y, vec.Z) - avr;
                            foreach (int v in mapping.Mapping[i])
                            {
                                Vector3 res = new Vector3(lod3[v].X, lod3[v].Y, lod3[v].Z) + offset;

                                lod3[v].X = res.X;
                                lod3[v].Y = res.Y;
                                lod3[v].Z = res.Z;
                            }
                        }
                        else if (mapping.Mapping[i].Count == 1)
                        {
                            foreach (int v in mapping.Mapping[i])
                            {
                                lod3[v] = vec;
                            }
                        }
                    }
                    else
                    {
                        foreach (int v in mapping.Mapping[i])
                        {
                            lod3[v] = vec;
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public VertexMapping(List <ME2Vector> me2Data, List <ME3Vector> me3Data)
        {
            mapping = new HashSet <int> [me2Data.Count];
            for (int i = 0; i < mapping.Length; i++)
            {
                mapping[i] = new HashSet <int>();
            }
            thresholds = new float[mapping.Length];
            ignore     = new bool[mapping.Length];
            verified   = new bool[mapping.Length];

            for (int i = 0; i < me2Data.Count; i++)
            {
                ME2Vector me2Source = me2Data[i];
                Vector3   source    = new Vector3(me2Source.X, me2Source.Y, me2Source.Z);
                bool      matched   = false;
                float     threshold = 0f;

                while (!matched)
                {
                    for (int j = 0; j < me3Data.Count; j++)
                    {
                        ME3Vector me3Candidate = me3Data[j];
                        Vector3   candidate    = new Vector3(me3Candidate.X, me3Candidate.Y, me3Candidate.Z);

                        if (Vector3.Distance(source, candidate) <= threshold)
                        {
                            mapping[i].Add(j);
                            matched = true;
                        }
                    }
                    threshold += thresholdIncrement;
                }
                thresholds[i] = threshold;
                if (threshold < minThreshold)
                {
                    minThreshold = threshold;
                }
                if (threshold > maxThreshold)
                {
                    maxThreshold = threshold;
                }

                ignore[i]   = false;
                verified[i] = false;
            }
        }
Exemplo n.º 3
0
        void AdjustLOD()
        {
            List<ME2Vector> lod2 = me2Save.PlayerRecord.Appearance.MorphHead.LOD0Vertices;
            List<ME3Vector> lod3 = me3Save.Player.Appearance.MorphHead.Lod0Vertices;

            for (int i = 0; i < mapping.Mapping.Length; i++)
            {
                if (mapping.Verified[i])
                {
                    ME3Vector vec = new ME3Vector()
                    {
                        X = lod2[i].X,
                        Y = lod2[i].Y,
                        Z = lod2[i].Z
                    };
                    if (checkBoxMultiple.Checked)
                    {
                        if (mapping.Mapping[i].Count > 1)
                        {
                            Vector3 avr = Vector3.Zero;
                            foreach (int v in mapping.Mapping[i]) avr += new Vector3(lod3[v].X, lod3[v].Y, lod3[v].Z);
                            avr /= mapping.Mapping[i].Count;
                            Vector3 offset = new Vector3(vec.X, vec.Y, vec.Z) - avr;
                            foreach (int v in mapping.Mapping[i])
                            {
                                Vector3 res = new Vector3(lod3[v].X, lod3[v].Y, lod3[v].Z) + offset;

                                lod3[v].X = res.X;
                                lod3[v].Y = res.Y;
                                lod3[v].Z = res.Z;
                            }
                        }
                        else if (mapping.Mapping[i].Count == 1)
                        {
                            foreach (int v in mapping.Mapping[i])
                            {
                                lod3[v] = vec;
                            }
                        }
                    }
                    else
                    {
                        foreach (int v in mapping.Mapping[i]) lod3[v] = vec;
                    }
                }
            }
        }