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)); }
/// <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)); }
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 of the supplied texture data. (PolygonDetectionType.Integrated) /// </summary> /// <param name="data">The texture data.</param> /// <param name="width">The texture width.</param> /// <returns></returns> public static Vertices DetectVertices(uint[] data, int width) { TextureConverter tc = new TextureConverter(data, width); List <DetectedVertices> detectedVerticesList = tc.DetectVertices(); return(detectedVerticesList[0]); }
/// <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 CreatePolygon(int[] data, int width, bool holeDetection) { #if UNITY_FLASH return(new Vertices()); #else return(TextureConverter.DetectVertices(data, width, holeDetection)); #endif }
/// <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> CreatePolygon(int[] data, int width, float hullTolerance, byte alphaTolerance, bool multiPartDetection, bool holeDetection) { #if UNITY_FLASH return(new List <Vertices>()); #else return(TextureConverter.DetectVertices(data, width, hullTolerance, alphaTolerance, multiPartDetection, holeDetection)); #endif }
/// <summary> /// Detects the vertices of the supplied 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> /// <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> /// <returns></returns> public static List <Vertices> DetectVertices(uint[] data, int width, float hullTolerance, byte alphaTolerance, bool multiPartDetection, bool holeDetection) { TextureConverter tc = new TextureConverter(data, width) { HullTolerance = hullTolerance, AlphaTolerance = alphaTolerance, MultipartDetection = multiPartDetection, HoleDetection = holeDetection }; List <DetectedVertices> detectedVerticesList = tc.DetectVertices(); List <Vertices> result = new List <Vertices>(); for (int i = 0; i < detectedVerticesList.Count; i++) { result.Add(detectedVerticesList[i]); } return(result); }
public static Vertices CreatePolygon(uint[] data, int width, int height, bool holeDetection) { return(TextureConverter.CreateVertices(data, width, height, holeDetection)); }
public static Vertices CreatePolygon(uint[] data, int width, int height) { return(TextureConverter.CreateVertices(data, width, height)); }
/// <summary> /// Detects the vertices by analyzing the texture data. /// </summary> /// <param name="data">The texture data.</param> /// <param name="width">The texture width.</param> /// <returns></returns> public static Vertices CreatePolygon(uint[] data, int width) { return(TextureConverter.DetectVertices(data, width)); }
/// <summary> /// Detects the vertices of the supplied 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> /// <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> /// <returns></returns> public static List<Vertices> DetectVertices(uint[] data, int width, float hullTolerance, byte alphaTolerance, bool multiPartDetection, bool holeDetection) { TextureConverter tc = new TextureConverter(data, width) { HullTolerance = hullTolerance, AlphaTolerance = alphaTolerance, MultipartDetection = multiPartDetection, HoleDetection = holeDetection }; List<DetectedVertices> detectedVerticesList = tc.DetectVertices(); List<Vertices> result = new List<Vertices>(); for (int i = 0; i < detectedVerticesList.Count; i++) { result.Add(detectedVerticesList[i]); } return result; }
/// <summary> /// Detects the vertices of the supplied 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 DetectVertices(uint[] data, int width, bool holeDetection) { TextureConverter tc = new TextureConverter(data, width) { HoleDetection = holeDetection }; List<DetectedVertices> detectedVerticesList = tc.DetectVertices(); return detectedVerticesList[0]; }
/// <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)); }
/// <summary> /// Detects the vertices by analyzing the texture data. /// </summary> /// <param name="data">The texture data.</param> /// <param name="width">The texture width.</param> /// <returns></returns> public static Vertices createPolygonFromTextureData(uint[] data, int width) { return(TextureConverter.detectVertices(data, width)); }