Exemple #1
0
 public unsafe WithGammaRamp(GammaRamp ramp)
 {
     Ramp          = ramp;
     GammaTable    = Ramp.GammaTable;
     InvGammaTable = Ramp.InvGammaTable;
     PAGray        = _PAGray;
 }
Exemple #2
0
        public DynamicAtlas(
            RenderCoordinator coordinator, int width, int height, SurfaceFormat format,
            int spacing = 2, MipGeneratorFn mipGenerator = null, object tag = null
            )
        {
            Id          = NextId++;
            Coordinator = coordinator;
            Width       = width;
            Height      = height;
            Format      = format;
            int temp;

            BytesPerPixel  = Evil.TextureUtils.GetBytesPerPixelAndComponents(Format, out temp);
            Spacing        = spacing;
            X              = Y = Spacing;
            RowHeight      = 0;
            _BeforeIssue   = Flush;
            _BeforePrepare = QueueGenerateMips;
            Tag            = tag;

            GenerateMip = mipGenerator;

            EnsureValidResource();

            Pixels = new T[width * height];
            if (mipGenerator != null)
            {
                var totalMipSize         = 4;
                var currentMipSizePixels = (width / 2) * (height / 2);
                while (currentMipSizePixels > 1)
                {
                    totalMipSize         += (currentMipSizePixels + 1);
                    currentMipSizePixels /= 2;
                }
                MipBuffer = new T[totalMipSize];
            }

            if (DebugColors)
            {
                var p = Pixels as Color[];
                if (p != null)
                {
                    var w = 4096 * 4;
                    for (int i = 0, l = p.Length; i < l; i++)
                    {
                        p[i] = (Color) new Color(i % 255, (Id * 64) % 255, (Id * 192) % 255, 255);
                    }
                }
            }

            MipLevelCount = Texture.LevelCount;

            Invalidate();
        }
Exemple #3
0
 public static void Set(MipFormat format, MipGeneratorFn implementation)
 {
     Cache[(int)format] = implementation;
 }