예제 #1
0
        void CreateR32G32B32A32_Float(MyGeneratedTexture tex, string name, Vector2I resolution, Vector4[] colors)
        {
            Texture2DDescription desc = m_descDefault;

            desc.Format = Format.R32G32B32A32_Float;
            int width  = resolution.X;
            int height = resolution.Y;

            desc.Height = width;
            desc.Width  = height;
            tex.Init(name, desc, new Vector2I(width, height), width * height * 16);

            if (colors != null)
            {
                float[] values = new float[width * height * 4];

                int inOffset  = 0;
                int outOffset = 0;
                for (int y = 0; y < height; y++)
                {
                    for (int x = 0; x < width; x++)
                    {
                        values[outOffset++] = colors[inOffset].X;
                        values[outOffset++] = colors[inOffset].Y;
                        values[outOffset++] = colors[inOffset].Z;
                        values[outOffset++] = colors[inOffset].W;
                        inOffset++;
                    }
                }

                Reset(tex, values, width, 4);
            }
        }
예제 #2
0
        void CreateR_1x1(MyGeneratedTexture tex, string name, byte data)
        {
            Texture2DDescription desc = m_descDefault;

            desc.Format = Format.R8_UNorm;
            desc.Height = 1;
            desc.Width  = 1;
            tex.Init(name, desc, new Vector2I(1, 1), 1);
            Reset(tex, data);
        }
예제 #3
0
        void CreateRGBA_1x1(MyGeneratedTexture tex, string name, Color color)
        {
            Texture2DDescription desc = m_descDefault;

            desc.Format = Format.R8G8B8A8_UNorm;
            desc.Height = 1;
            desc.Width  = 1;
            tex.Init(name, desc, new Vector2I(1, 1), 4);
            int data = color.ToRgba();

            Reset(tex, data);
        }
예제 #4
0
        void CreateCubeRGBA_1x1(MyGeneratedTexture tex, string name, Color color)
        {
            Texture2DDescription desc = m_descDefault;

            desc.Format      = Format.R8G8B8A8_UNorm;
            desc.Height      = 1;
            desc.Width       = 1;
            desc.ArraySize   = 6;
            desc.OptionFlags = ResourceOptionFlags.TextureCube;
            tex.Init(name, desc, new Vector2I(1, 1), 4);
            int data = color.ToRgba();

            ResetCube(tex, data);
        }
예제 #5
0
        void CreateR(MyGeneratedTexture tex, string name, Vector2I resolution, byte[] data, bool userTexture = false, int numMipLebels = 1)
        {
            Texture2DDescription desc = m_descDefault;

            desc.Usage  = userTexture ? ResourceUsage.Default : ResourceUsage.Immutable;
            desc.Format = Format.R8_UNorm;
            int width  = resolution.X;
            int height = resolution.Y;

            desc.Height    = height;
            desc.Width     = width;
            desc.MipLevels = numMipLebels;
            tex.Init(name, desc, new Vector2I(width, height), width * height);
            if (data != null)
            {
                Reset(tex, data, 1);
            }
        }
예제 #6
0
        void CreateRGBA(MyGeneratedTexture tex, string name, Vector2I resolution, bool srgb, byte[] data, bool userTexture = false, int numMipLevels = 1)
        {
            Texture2DDescription desc = m_descDefault;

            desc.Usage  = userTexture ? ResourceUsage.Default : ResourceUsage.Immutable;
            desc.Format = srgb ? Format.R8G8B8A8_UNorm_SRgb : Format.B8G8R8A8_UNorm;
            int width  = resolution.X;
            int height = resolution.Y;

            desc.Width     = width;
            desc.Height    = height;
            desc.MipLevels = numMipLevels;
            tex.Init(name, desc, new Vector2I(width, height), width * height * 4);
            if (data != null)
            {
                Debug.Assert(width * height * 4 == data.Length, "Wrong data array size for RGBA texture");
                Reset(tex, data, 4);
            }
        }
 void CreateTexture(MyGeneratedTexture tex, string name, Texture2DDescription desc, DataBox[] dataBoxes, Vector2I size, int bytes, bool enableDxInitialisation = true)
 {
     tex.Init(name, desc, dataBoxes, size, bytes, enableDxInitialisation);
 }
예제 #8
0
 void CreateTexture(MyGeneratedTexture tex, string name, Texture2DDescription desc, DataBox[] dataBoxes, Vector2I size, int bytes, bool enableDxInitialisation = true)
 {
     tex.Init(name, desc, dataBoxes, size, bytes, enableDxInitialisation);
 }
예제 #9
0
        void CreateR32G32B32A32_Float(MyGeneratedTexture tex, string name, Vector2I resolution, Vector4[] colors)
        {
            Texture2DDescription desc = m_descDefault;
            desc.Format = Format.R32G32B32A32_Float;
            int width = resolution.X;
            int height = resolution.Y;
            desc.Height = width;
            desc.Width = height;
            tex.Init(name, desc, new Vector2I(width, height), width * height * 16);

            if (colors != null)
            {
                float[] values = new float[width * height * 4];

                int inOffset = 0;
                int outOffset = 0;
                for (int y = 0; y < height; y++)
                {
                    for (int x = 0; x < width; x++)
                    {
                        values[outOffset++] = colors[inOffset].X;
                        values[outOffset++] = colors[inOffset].Y;
                        values[outOffset++] = colors[inOffset].Z;
                        values[outOffset++] = colors[inOffset].W;
                        inOffset++;
                    }
                }

                Reset(tex, values, width, 4);
            }
        }
예제 #10
0
 void CreateRGBA(MyGeneratedTexture tex, string name, Vector2I resolution, bool srgb, byte[] data, bool userTexture = false, int numMipLevels = 1)
 {
     Texture2DDescription desc = m_descDefault;
     desc.Usage = userTexture ? ResourceUsage.Default : ResourceUsage.Immutable;
     desc.Format = srgb ? Format.R8G8B8A8_UNorm_SRgb : Format.B8G8R8A8_UNorm;
     int width = resolution.X;
     int height = resolution.Y;
     desc.Width = width;
     desc.Height = height;
     desc.MipLevels = numMipLevels;
     tex.Init(name, desc, new Vector2I(width, height), width * height * 4);
     if (data != null)
     {
         Debug.Assert(width * height * 4 == data.Length, "Wrong data array size for RGBA texture");
         Reset(tex, data, 4);
     }
 }
예제 #11
0
 void CreateR(MyGeneratedTexture tex, string name, Vector2I resolution, byte[] data, bool userTexture = false, int numMipLebels = 1)
 {
     Texture2DDescription desc = m_descDefault;
     desc.Usage = userTexture ? ResourceUsage.Default : ResourceUsage.Immutable;
     desc.Format = Format.R8_UNorm;
     int width = resolution.X;
     int height = resolution.Y;
     desc.Height = height;
     desc.Width = width;
     desc.MipLevels = numMipLebels;
     tex.Init(name, desc, new Vector2I(width, height), width * height);
     if (data != null)
         Reset(tex, data, 1);
 }
예제 #12
0
 void CreateCubeRGBA_1x1(MyGeneratedTexture tex, string name, Color color)
 {
     Texture2DDescription desc = m_descDefault;
     desc.Format = Format.R8G8B8A8_UNorm;
     desc.Height = 1;
     desc.Width = 1;
     desc.ArraySize = 6;
     desc.OptionFlags = ResourceOptionFlags.TextureCube;
     tex.Init(name, desc, new Vector2I(1, 1), 4);
     int data = color.ToRgba();
     ResetCube(tex, data);
 }
예제 #13
0
 void CreateRGBA_1x1(MyGeneratedTexture tex, string name, Color color)
 {
     Texture2DDescription desc = m_descDefault;
     desc.Format = Format.R8G8B8A8_UNorm;
     desc.Height = 1;
     desc.Width = 1;
     tex.Init(name, desc, new Vector2I(1, 1), 4);
     int data = color.ToRgba();
     Reset(tex, data);
 }
예제 #14
0
 void CreateR_1x1(MyGeneratedTexture tex, string name, byte data)
 {
     Texture2DDescription desc = m_descDefault;
     desc.Format = Format.R8_UNorm;
     desc.Height = 1;
     desc.Width = 1;
     tex.Init(name, desc, new Vector2I(1, 1), 1);
     Reset(tex, data);
 }