public static Vertices createPolygonFromTextureData(Nez.Textures.Subtexture subtexture) { var data = new uint[subtexture.sourceRect.Width * subtexture.sourceRect.Height]; subtexture.texture2D.GetData(0, subtexture.sourceRect, data, 0, data.Length); return(TextureConverter.detectVertices(data, subtexture.texture2D.Width)); }
public static Vertices createPolygonFromTextureData(Texture2D texture) { var data = new uint[texture.Width * texture.Height]; texture.GetData(data, 0, data.Length); return(TextureConverter.detectVertices(data, texture.Width)); }
/// <summary> /// Detects the vertices by analyzing the texture data. /// </summary> /// <param name="data">The texture data.</param> /// <param name="width">The texture width.</param> /// <param name="hullTolerance">The hull tolerance.</param> /// <param name="alphaTolerance">The alpha tolerance.</param> /// <param name="multiPartDetection">if set to <c>true</c> it will perform multi part detection.</param> /// <param name="holeDetection">if set to <c>true</c> it will perform hole detection.</param> /// <returns></returns> public static List <Vertices> createPolygonFromTextureData(uint[] data, int width, float hullTolerance, byte alphaTolerance, bool multiPartDetection, bool holeDetection) { return(TextureConverter.detectVertices(data, width, hullTolerance, alphaTolerance, multiPartDetection, holeDetection)); }
/// <summary> /// Detects the vertices by analyzing the texture data. /// </summary> /// <param name="data">The texture data.</param> /// <param name="width">The texture width.</param> /// <param name="holeDetection">if set to <c>true</c> it will perform hole detection.</param> /// <returns></returns> public static Vertices createPolygonFromTextureData(uint[] data, int width, bool holeDetection) { return(TextureConverter.detectVertices(data, width, holeDetection)); }