Ejemplo n.º 1
0
        // This constructor is reserved for the content loader, it's signature should not be changed
        internal Texture(string file, TextureCreateOptions createOptions)
        {
            _createOptions = createOptions;

            // Create a temporary dynamic texture so we can load the file and read the pixel data
            using (DynamicTexture temp = new DynamicTexture(file))
            {
                Size = new IntVector2(temp.Size.X, temp.Size.Y);
                // Load the texture into gl
                LoadTexture(temp.ReadBytes());
            }
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Create a new empty texture
 /// </summary>
 /// <param name="width">The width of the texture</param>
 /// <param name="height">The height of the texture</param>
 /// <param name="color">The color for all pixels in the texture</param>
 /// <param name="createOptions">The create options</param>
 public Texture(int width, int height, Color color, TextureCreateOptions createOptions)
 {
     _createOptions = createOptions;
     Size           = new IntVector2(width, height);
     if (color == Color.Transparent)
     {
         // No need to do the Enumerate.Repeat since transparent is (0, 0, 0, 0)
         LoadTexture(new byte[Size.X * Size.Y * 4]);
     }
     else
     {
         LoadTexture(Enumerable.Repeat(color, Size.X * Size.Y).ToBytes());
     }
 }
Ejemplo n.º 3
0
        /// <inheritdoc />
        protected override bool IsEqualContent(ContentCreateOptions otherContent)
        {
            TextureCreateOptions other = (TextureCreateOptions)otherContent;

            if (other != null)
            {
                if (FilterMode == other.FilterMode &&
                    WrapMode == other.WrapMode)
                {
                    return(true);
                }
            }

            return(false);
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Create a new texture
 /// </summary>
 /// <param name="width">The width of the texture</param>
 /// <param name="height">The height of the texture</param>
 /// <param name="bytes">The RGBA bytes to load this texture with</param>
 /// <param name="createOptions">The create options</param>
 public Texture(int width, int height, byte[] bytes, TextureCreateOptions createOptions)
 {
     _createOptions = createOptions;
     Size           = new IntVector2(width, height);
     LoadTexture(bytes);
 }
Ejemplo n.º 5
0
 /// <summary>
 /// Create a new texture
 /// </summary>
 /// <param name="dynamicTexture">The dynamic texture to copy the pixel data from</param>
 /// <param name="createOptions">The create options</param>
 public Texture(DynamicTexture dynamicTexture, TextureCreateOptions createOptions)
 {
     _createOptions = createOptions;
     Size           = new IntVector2(dynamicTexture.Size.X, dynamicTexture.Size.Y);
     LoadTexture(dynamicTexture.ReadBytes());
 }