Beispiel #1
0
 public void DoIntegrityCheckMergedEncapsulatingSamplingRects(List <MB_TexSet> distinctMaterialTextures)
 {
     if (MB3_MeshBakerRoot.DO_INTEGRITY_CHECKS)
     {
         for (int i = 0; i < distinctMaterialTextures.Count; i++)
         {
             MB_TexSet tx1 = distinctMaterialTextures[i];
             if (!tx1.allTexturesUseSameMatTiling)
             {
                 continue;
             }
             for (int matIdx = 0; matIdx < tx1.matsAndGOs.mats.Count; matIdx++)
             {
                 MatAndTransformToMerged mat = tx1.matsAndGOs.mats[matIdx];
                 DRect uvR  = mat.obUVRectIfTilingSame;
                 DRect matR = mat.materialTiling;
                 if (!MB2_TextureBakeResults.IsMeshAndMaterialRectEnclosedByAtlasRect(tx1.tilingTreatment, uvR.GetRect(), matR.GetRect(), tx1.ts[0].GetEncapsulatingSamplingRect().GetRect(), MB2_LogLevel.info))
                 {
                     Debug.LogErrorFormat("mesh " + tx1.matsAndGOs.mats[matIdx].objName + "\n" +
                                          " uv=" + uvR + "\n" +
                                          " mat=" + matR.GetRect().ToString("f5") + "\n" +
                                          " samplingRect=" + tx1.matsAndGOs.mats[matIdx].samplingRectMatAndUVTiling.GetRect().ToString("f4") + "\n" +
                                          " encapsulatingRect " + tx1.ts[0].GetEncapsulatingSamplingRect().GetRect().ToString("f4") + "\n");
                     Debug.LogErrorFormat(string.Format("Integrity check failed. " + tx1.matsAndGOs.mats[matIdx].objName + " Encapsulating sampling rect failed to contain potentialRect\n"));
                     MB2_TextureBakeResults.IsMeshAndMaterialRectEnclosedByAtlasRect(tx1.tilingTreatment, uvR.GetRect(), matR.GetRect(), tx1.ts[0].GetEncapsulatingSamplingRect().GetRect(), MB2_LogLevel.trace);
                     Debug.Assert(false);
                 }
             }
         }
     }
 }
Beispiel #2
0
        public override bool Equals(object obj)
        {
            if (obj is MatAndTransformToMerged)
            {
                MatAndTransformToMerged o = (MatAndTransformToMerged)obj;

                if (o.mat == mat && o.obUVRectIfTilingSame == obUVRectIfTilingSame)
                {
                    return true;
                }
            }
            return false;
        }