/// <summary> /// Updates a specific texture in the texture array with the given TexImage. /// </summary> /// <param name="array">The array.</param> /// <param name="texture">The texture.</param> /// <param name="indice">The indice.</param> /// <exception cref="TextureToolsException"> /// The first given texture must be an array texture. /// or /// The given indice is out of range in the array texture. /// </exception> public void Update(TexImage array, TexImage texture, int indice) { texture.Update(); if (array.ArraySize == 1) { Log.Error("The first given texture must be an array texture."); throw new TextureToolsException("The first given texture must be an array texture."); } if (array.ArraySize-1 < indice) { Log.Error("The given indice is out of range in the array texture."); throw new TextureToolsException("The given indice is out of range in the array texture."); } CheckConformity(array, texture); ExecuteRequest(array, new ArrayUpdateRequest(texture, indice)); }
/// <summary> /// Inserts a texture into a texture array at a specified position. /// </summary> /// <param name="array">The array.</param> /// <param name="texture">The texture to be added.</param> /// <param name="indice">The indice.</param> /// <exception cref="TextureToolsException">The given indice must be between 0 and the array size</exception> public void Insert(TexImage array, TexImage texture, int indice) { texture.Update(); if (indice < 0 || indice > array.ArraySize) { Log.Error("The given indice must be between 0 and " + array.ArraySize); throw new TextureToolsException("The given indice must be between 0 and " + array.ArraySize); } CheckConformity(array, texture); ExecuteRequest(array, new ArrayInsertionRequest(texture, indice)); }
/// <summary> /// Updates a specific texture in the atlas with the given TexImage. /// </summary> /// <param name="atlas">The atlas.</param> /// <param name="texture">The texture.</param> /// <param name="name">The name of the texture to update (takes the TexImage's name if none given).</param> /// <exception cref="TextureToolsException"> /// You must either set the Name attribute of the TexImage, or you must give the name of the texture to update in the atlas. /// or /// The new texture can't be a texture array. /// </exception> public void Update(TexAtlas atlas, TexImage texture, string name = "") { texture.Update(); if (texture.Name.Equals("") && name.Equals("")) { Log.Error("You must either set the Name attribute of the TexImage, or you must give the name of the texture to update in the atlas."); throw new TextureToolsException("You must either set the Name attribute of the TexImage, or you must give the name of the texture to update in the atlas."); } if (texture.ArraySize > 1) { Log.Error("The new texture can't be a texture array."); throw new TextureToolsException("The new texture can't be a texture array."); } CheckConformity(atlas, texture); name = name.Equals("") ? texture.Name : name; ExecuteRequest(atlas, new AtlasUpdateRequest(texture, name)); }