Ejemplo n.º 1
0
        public void CalculateAspectCorrection(CGVolume volume, CGMaterialSettingsEx matSettings)
        {
            float totalLength = 0;
            float totalULength = 0;
            float l, u;

            for (int g = 0; g < Count; g++)
            {
                this[g].GetLengths(volume, out l, out u);
                totalLength  += l;
                totalULength += u;
            }

            AspectCorrection = volume.Length / (totalLength / totalULength);

            /*
             * float crossLength = volume.GetCrossLength(0);
             * for (int g = 0; g < Count; g++)
             * {
             *  // Calculate local U
             *  if (matSettings.LocalU)
             *      this[g].CalculateLocalINTERNAL(volume);
             *  // Aspect correction
             *  this[g].AspectCorrectionU = 1;
             *  this[g].AspectCorrectionV = 1;
             *  switch (matSettings.KeepAspect)
             *  {
             *      case CGKeepAspectMode.ScaleU:
             *          if (matSettings.LocalU)
             *               this[g].AspectCorrectionU = this[g].LocalLength / volume.Length;
             *          else
             *              this[g].AspectCorrectionU = crossLength / volume.Length;
             *          break;
             *      case CGKeepAspectMode.ScaleV:
             *          if (matSettings.LocalU)
             *              this[g].AspectCorrectionV = volume.Length / this[g].LocalLength;
             *          else
             *              this[g].AspectCorrectionV = volume.Length / crossLength;
             *          break;
             *  }
             * }
             *
             *
             */
        }
Ejemplo n.º 2
0
 public void CalculateAspectCorrection(CGVolume volume, CGMaterialSettingsEx matSettings)
 {
     if (matSettings.KeepAspect == CGKeepAspectMode.Off)
     {
         AspectCorrection = 1;
     }
     else
     {
         float totalLength = 0;
         float totalULength = 0;
         float l, u;
         for (int g = 0; g < Count; g++)
         {
             this[g].GetLengths(volume, out l, out u);
             totalLength  += l;
             totalULength += u;
         }
         AspectCorrection = volume.Length / (totalLength / totalULength);
     }
 }