Jypeli 10
The simple game programming library
Jypeli.TextureToShapeConverter luokkareferenssi

Muuttaa tekstuurin yhdeksi tai useammaksi listaksi verteksejä. Mahdollistaa myös reikien sisällyttämisen muotoon. Lisää...

Luokat

class  Vertices
 

Julkiset jäsenfunktiot

 TextureToShapeConverter ()
 
 TextureToShapeConverter (byte? alphaTolerance, float? hullTolerance, bool? holeDetection, bool? multipartDetection, bool? pixelOffsetOptimization, Matrix? transform)
 
 TextureToShapeConverter (uint[] data, int width)
 
 TextureToShapeConverter (uint[] data, int width, byte? alphaTolerance, float? hullTolerance, bool? holeDetection, bool? multipartDetection, bool? pixelOffsetOptimization, Matrix? transform)
 
List< List< Vector > > DetectVertices ()
 
bool InBounds (ref Vector coord)
 
bool IsSolid (ref int index)
 
bool IsSolid (ref int x, ref int y)
 
bool IsSolid (ref Vector v)
 

Staattiset julkiset jäsenfunktiot

static List< VectorDetectVertices (uint[] data, int width)
 Detects the vertices of the supplied texture data. (PolygonDetectionType.Integrated) Lisää...
 
static List< VectorDetectVertices (uint[] data, int width, bool holeDetection)
 Detects the vertices of the supplied texture data. Lisää...
 
static List< List< Vector > > DetectVertices (uint[] data, int width, float hullTolerance, byte alphaTolerance, bool multiPartDetection, bool holeDetection)
 Detects the vertices of the supplied texture data. Lisää...
 
static double DistanceBetweenPointAndLineSegment (ref Vector point, ref Vector start, ref Vector end)
 

Ominaisuudet

byte AlphaTolerance [getset]
 Alpha (coverage) tolerance. Default is 20: Every pixel with a coverage value equal or greater to 20 will be counts as solid. Lisää...
 
bool HoleDetection [getset]
 Will detect texture 'holes' if set to true. Slows down the detection. Default is false. Lisää...
 
float HullTolerance [getset]
 Default is 1.5f. Lisää...
 
bool MultipartDetection [getset]
 Will detect texture multiple 'solid' isles if set to true. Slows down the detection. Default is false. Lisää...
 
bool PixelOffsetOptimization [getset]
 Will optimize the vertex positions along the interpolated normal between two edges about a half pixel (post processing). Default is false. Lisää...
 
VerticesDetectionType PolygonDetectionType [getset]
 Get or set the polygon detection type. Lisää...
 
Matrix Transform [getset]
 Can be used for scaling. Lisää...
 

Yksityiset jäsenfunktiot

void ApplyTransform (ref List< Vertices > detectedPolygons)
 
void ApplyTriangulationCompatibleWinding (ref List< Vertices > detectedPolygons)
 
Vertices CreateSimplePolygon (Vector entrance, Vector last)
 
bool DistanceToHullAcceptable (Vertices polygon, Vector point, bool higherDetail)
 
bool DistanceToHullAcceptableHoles (Vertices polygon, Vector point, bool higherDetail)
 
double GetBottomMostCoord (Vertices vertices)
 
int GetIndexOfFirstPixelToCheck (ref Vector last, ref Vector current)
 
bool GetNextHullPoint (ref Vector last, ref Vector current, out Vector next)
 
double GetTopMostCoord (Vertices vertices)
 
VectorGetTopMostVertex (Vertices vertices)
 
void Initialize (uint[] data, int? width, byte? alphaTolerance, float? hullTolerance, bool? holeDetection, bool? multipartDetection, bool? pixelOffsetOptimization, Matrix? transform)
 
bool InPolygon (Vertices polygon, Vector point)
 
bool IsNearPixel (ref Vector current, ref Vector near)
 
List< double > SearchCrossingEdges (Vertices polygon, int y)
 Searches the polygon for the x coordinates of the edges that cross the specified y coordinate. Lisää...
 
List< double > SearchCrossingEdgesHoles (Vertices polygon, int y)
 
bool SearchForOutstandingVertex (Vertices hullArea, out Vector outstanding)
 
VectorSearchHoleEntrance (Vertices polygon, Vector? lastHoleEntrance)
 Function to search for an entrance point of a hole in a polygon. It searches the polygon from top to bottom between the polygon edges. Lisää...
 
bool SearchHullEntrance (out Vector entrance)
 
bool SearchNearPixels (bool searchingForSolidPixel, ref Vector current, out Vector foundPixel)
 
bool SearchNextHullEntrance (List< Vertices > detectedPolygons, Vector start, out Vector? entrance)
 Searches for the next shape. Lisää...
 
void SetTextureData (uint[] data, int width)
 
bool SplitPolygonEdge (Vertices polygon, Vector coordInsideThePolygon, out int vertex1Index, out int vertex2Index)
 

Yksityiset attribuutit

uint _alphaTolerance
 
uint[] _data
 
int _dataLength
 
int _height
 
bool _holeDetection
 
float _hullTolerance
 
bool _multipartDetection
 
bool _pixelOffsetOptimization
 
VerticesDetectionType _polygonDetectionType
 
int _tempIsSolidX
 
int _tempIsSolidY
 
Matrix _transform = Matrix.Identity
 
int _width
 

Staattiset yksityiset attribuutit

static int[,] _closePixels = new[,] { { -1, -1 }, { 0, -1 }, { 1, -1 }, { 1, 0 }, { 1, 1 }, { 0, 1 }, { -1, 1 }, { -1, 0 } }
 This array is ment to be readonly. It's not because it is accessed very frequently. Lisää...
 
const int ClosepixelsLength = 8
 

Yksityiskohtainen selite

Muuttaa tekstuurin yhdeksi tai useammaksi listaksi verteksejä. Mahdollistaa myös reikien sisällyttämisen muotoon.

Määrittely tiedoston TextureToShapeConverter.cs rivillä 45.

Rakentajien & purkajien dokumentaatio

◆ TextureToShapeConverter() [1/4]

Jypeli.TextureToShapeConverter.TextureToShapeConverter ( )

◆ TextureToShapeConverter() [2/4]

Jypeli.TextureToShapeConverter.TextureToShapeConverter ( byte?  alphaTolerance,
float?  hullTolerance,
bool?  holeDetection,
bool?  multipartDetection,
bool?  pixelOffsetOptimization,
Matrix transform 
)

Määrittely tiedoston TextureToShapeConverter.cs rivillä 198.

Viittaukset Jypeli.TextureToShapeConverter.Initialize().

◆ TextureToShapeConverter() [3/4]

Jypeli.TextureToShapeConverter.TextureToShapeConverter ( uint[]  data,
int  width 
)

Määrittely tiedoston TextureToShapeConverter.cs rivillä 205.

Viittaukset Jypeli.TextureToShapeConverter.Initialize().

◆ TextureToShapeConverter() [4/4]

Jypeli.TextureToShapeConverter.TextureToShapeConverter ( uint[]  data,
int  width,
byte?  alphaTolerance,
float?  hullTolerance,
bool?  holeDetection,
bool?  multipartDetection,
bool?  pixelOffsetOptimization,
Matrix transform 
)

Määrittely tiedoston TextureToShapeConverter.cs rivillä 210.

Viittaukset Jypeli.TextureToShapeConverter.Initialize().

Jäsenfunktioiden dokumentaatio

◆ ApplyTransform()

void Jypeli.TextureToShapeConverter.ApplyTransform ( ref List< Vertices detectedPolygons)
private

◆ ApplyTriangulationCompatibleWinding()

void Jypeli.TextureToShapeConverter.ApplyTriangulationCompatibleWinding ( ref List< Vertices detectedPolygons)
private

◆ CreateSimplePolygon()

◆ DetectVertices() [1/4]

◆ DetectVertices() [2/4]

static List< Vector > Jypeli.TextureToShapeConverter.DetectVertices ( uint[]  data,
int  width 
)
static

Detects the vertices of the supplied texture data. (PolygonDetectionType.Integrated)

Parametrit
dataThe texture data.
widthThe texture width.
Palauttaa

Määrittely tiedoston TextureToShapeConverter.cs rivillä 291.

Viittaukset Jypeli.TextureToShapeConverter.TextureToShapeConverter() ja Jypeli.TextureToShapeConverter.DetectVertices().

Viitattu Jypeli.TextureToShapeConverter.DetectVertices() ja Jypeli.Shape.FromImage().

◆ DetectVertices() [3/4]

static List< Vector > Jypeli.TextureToShapeConverter.DetectVertices ( uint[]  data,
int  width,
bool  holeDetection 
)
static

Detects the vertices of the supplied texture data.

Parametrit
dataThe texture data.
widthThe texture width.
holeDetectionif set to true it will perform hole detection.
Palauttaa

Määrittely tiedoston TextureToShapeConverter.cs rivillä 307.

Viittaukset Jypeli.TextureToShapeConverter.TextureToShapeConverter(), Jypeli.TextureToShapeConverter.DetectVertices() ja Jypeli.TextureToShapeConverter.HoleDetection.

◆ DetectVertices() [4/4]

static List< List< Vector > > Jypeli.TextureToShapeConverter.DetectVertices ( uint[]  data,
int  width,
float  hullTolerance,
byte  alphaTolerance,
bool  multiPartDetection,
bool  holeDetection 
)
static

Detects the vertices of the supplied texture data.

Parametrit
dataThe texture data.
widthThe texture width.
holeDetectionif set to true it will perform hole detection.
hullToleranceThe hull tolerance.
alphaToleranceThe alpha tolerance.
multiPartDetectionif set to true it will perform multi part detection.
Palauttaa

Määrittely tiedoston TextureToShapeConverter.cs rivillä 330.

Viittaukset Jypeli.TextureToShapeConverter.TextureToShapeConverter(), Jypeli.TextureToShapeConverter.AlphaTolerance, Jypeli.TextureToShapeConverter.DetectVertices(), Jypeli.TextureToShapeConverter.HoleDetection, Jypeli.TextureToShapeConverter.HullTolerance ja Jypeli.TextureToShapeConverter.MultipartDetection.

◆ DistanceBetweenPointAndLineSegment()

static double Jypeli.TextureToShapeConverter.DistanceBetweenPointAndLineSegment ( ref Vector  point,
ref Vector  start,
ref Vector  end 
)
static

◆ DistanceToHullAcceptable()

◆ DistanceToHullAcceptableHoles()

bool Jypeli.TextureToShapeConverter.DistanceToHullAcceptableHoles ( Vertices  polygon,
Vector  point,
bool  higherDetail 
)
private

◆ GetBottomMostCoord()

double Jypeli.TextureToShapeConverter.GetBottomMostCoord ( Vertices  vertices)
private

Määrittely tiedoston TextureToShapeConverter.cs rivillä 784.

Viittaukset Jypeli.Y.

Viitattu Jypeli.TextureToShapeConverter.SearchHoleEntrance().

◆ GetIndexOfFirstPixelToCheck()

int Jypeli.TextureToShapeConverter.GetIndexOfFirstPixelToCheck ( ref Vector  last,
ref Vector  current 
)
private

◆ GetNextHullPoint()

◆ GetTopMostCoord()

double Jypeli.TextureToShapeConverter.GetTopMostCoord ( Vertices  vertices)
private

Määrittely tiedoston TextureToShapeConverter.cs rivillä 769.

Viittaukset Jypeli.Y.

Viitattu Jypeli.TextureToShapeConverter.SearchHoleEntrance().

◆ GetTopMostVertex()

Vector? Jypeli.TextureToShapeConverter.GetTopMostVertex ( Vertices  vertices)
private

Määrittely tiedoston TextureToShapeConverter.cs rivillä 752.

Viittaukset Jypeli.Y.

Viitattu Jypeli.TextureToShapeConverter.DetectVertices().

◆ InBounds()

bool Jypeli.TextureToShapeConverter.InBounds ( ref Vector  coord)

◆ Initialize()

void Jypeli.TextureToShapeConverter.Initialize ( uint[]  data,
int?  width,
byte?  alphaTolerance,
float?  hullTolerance,
bool?  holeDetection,
bool?  multipartDetection,
bool?  pixelOffsetOptimization,
Matrix transform 
)
private

◆ InPolygon()

◆ IsNearPixel()

bool Jypeli.TextureToShapeConverter.IsNearPixel ( ref Vector  current,
ref Vector  near 
)
private

◆ IsSolid() [1/3]

bool Jypeli.TextureToShapeConverter.IsSolid ( ref int  index)

◆ IsSolid() [2/3]

bool Jypeli.TextureToShapeConverter.IsSolid ( ref int  x,
ref int  y 
)

◆ IsSolid() [3/3]

◆ SearchCrossingEdges()

List< double > Jypeli.TextureToShapeConverter.SearchCrossingEdges ( Vertices  polygon,
int  y 
)
private

Searches the polygon for the x coordinates of the edges that cross the specified y coordinate.

Parametrit
polygonPolygon to search in.
yY coordinate to check for edges.
Palauttaa
Descending sorted list of x coordinates of edges that cross the specified y coordinate.

Määrittely tiedoston TextureToShapeConverter.cs rivillä 827.

Viittaukset Jypeli.Vector.X ja Jypeli.Vector.Y.

Viitattu Jypeli.TextureToShapeConverter.SearchCrossingEdgesHoles(), Jypeli.TextureToShapeConverter.SearchHoleEntrance() ja Jypeli.TextureToShapeConverter.SplitPolygonEdge().

◆ SearchCrossingEdgesHoles()

List< double > Jypeli.TextureToShapeConverter.SearchCrossingEdgesHoles ( Vertices  polygon,
int  y 
)
private

◆ SearchForOutstandingVertex()

bool Jypeli.TextureToShapeConverter.SearchForOutstandingVertex ( Vertices  hullArea,
out Vector  outstanding 
)
private

◆ SearchHoleEntrance()

Vector? Jypeli.TextureToShapeConverter.SearchHoleEntrance ( Vertices  polygon,
Vector lastHoleEntrance 
)
private

Function to search for an entrance point of a hole in a polygon. It searches the polygon from top to bottom between the polygon edges.

Parametrit
polygonThe polygon to search in.
lastHoleEntranceThe last entrance point.
Palauttaa
The next holes entrance point. Null if ther are no holes.

Määrittely tiedoston TextureToShapeConverter.cs rivillä 549.

Viittaukset Jypeli.TextureToShapeConverter._height, Jypeli.TextureToShapeConverter.DistanceToHullAcceptable(), Jypeli.TextureToShapeConverter.GetBottomMostCoord(), Jypeli.TextureToShapeConverter.GetTopMostCoord(), Jypeli.TextureToShapeConverter.IsSolid(), Jypeli.TextureToShapeConverter.SearchCrossingEdges() ja Jypeli.Vector.Y.

Viitattu Jypeli.TextureToShapeConverter.DetectVertices().

◆ SearchHullEntrance()

bool Jypeli.TextureToShapeConverter.SearchHullEntrance ( out Vector  entrance)
private

◆ SearchNearPixels()

bool Jypeli.TextureToShapeConverter.SearchNearPixels ( bool  searchingForSolidPixel,
ref Vector  current,
out Vector  foundPixel 
)
private

◆ SearchNextHullEntrance()

bool Jypeli.TextureToShapeConverter.SearchNextHullEntrance ( List< Vertices detectedPolygons,
Vector  start,
out Vector entrance 
)
private

Searches for the next shape.

Parametrit
detectedPolygonsAlready detected polygons.
startSearch start coordinate.
entranceReturns the found entrance coordinate. Null if no other shapes found.
Palauttaa
True if a new shape was found.

Määrittely tiedoston TextureToShapeConverter.cs rivillä 1170.

Viittaukset Jypeli.TextureToShapeConverter._dataLength, Jypeli.TextureToShapeConverter._width, Jypeli.TextureToShapeConverter.InPolygon(), Jypeli.TextureToShapeConverter.IsSolid(), Jypeli.Vector.X ja Jypeli.Vector.Y.

Viitattu Jypeli.TextureToShapeConverter.DetectVertices().

◆ SetTextureData()

void Jypeli.TextureToShapeConverter.SetTextureData ( uint[]  data,
int  width 
)
private

◆ SplitPolygonEdge()

bool Jypeli.TextureToShapeConverter.SplitPolygonEdge ( Vertices  polygon,
Vector  coordInsideThePolygon,
out int  vertex1Index,
out int  vertex2Index 
)
private

Jäsendatan dokumentaatio

◆ _alphaTolerance

uint Jypeli.TextureToShapeConverter._alphaTolerance
private

Määrittely tiedoston TextureToShapeConverter.cs rivillä 104.

Viitattu Jypeli.TextureToShapeConverter.IsSolid().

◆ _closePixels

int [,] Jypeli.TextureToShapeConverter._closePixels = new[,] { { -1, -1 }, { 0, -1 }, { 1, -1 }, { 1, 0 }, { 1, 1 }, { 0, 1 }, { -1, 1 }, { -1, 0 } }
staticprivate

This array is ment to be readonly. It's not because it is accessed very frequently.

Määrittely tiedoston TextureToShapeConverter.cs rivillä 95.

Viitattu Jypeli.TextureToShapeConverter.GetNextHullPoint(), Jypeli.TextureToShapeConverter.IsNearPixel() ja Jypeli.TextureToShapeConverter.SearchNearPixels().

◆ _data

◆ _dataLength

◆ _height

◆ _holeDetection

bool Jypeli.TextureToShapeConverter._holeDetection
private

◆ _hullTolerance

float Jypeli.TextureToShapeConverter._hullTolerance
private

◆ _multipartDetection

bool Jypeli.TextureToShapeConverter._multipartDetection
private

◆ _pixelOffsetOptimization

bool Jypeli.TextureToShapeConverter._pixelOffsetOptimization
private

Määrittely tiedoston TextureToShapeConverter.cs rivillä 109.

◆ _polygonDetectionType

VerticesDetectionType Jypeli.TextureToShapeConverter._polygonDetectionType
private

◆ _tempIsSolidX

int Jypeli.TextureToShapeConverter._tempIsSolidX
private

Määrittely tiedoston TextureToShapeConverter.cs rivillä 505.

Viitattu Jypeli.TextureToShapeConverter.IsSolid().

◆ _tempIsSolidY

int Jypeli.TextureToShapeConverter._tempIsSolidY
private

Määrittely tiedoston TextureToShapeConverter.cs rivillä 506.

Viitattu Jypeli.TextureToShapeConverter.IsSolid().

◆ _transform

Matrix Jypeli.TextureToShapeConverter._transform = Matrix.Identity
private

◆ _width

◆ ClosepixelsLength

const int Jypeli.TextureToShapeConverter.ClosepixelsLength = 8
staticprivate

Ominaisuuksien dokumentaatio

◆ AlphaTolerance

byte Jypeli.TextureToShapeConverter.AlphaTolerance
getset

Alpha (coverage) tolerance. Default is 20: Every pixel with a coverage value equal or greater to 20 will be counts as solid.

Määrittely tiedoston TextureToShapeConverter.cs rivillä 162.

Viitattu Jypeli.TextureToShapeConverter.DetectVertices() ja Jypeli.TextureToShapeConverter.Initialize().

◆ HoleDetection

bool Jypeli.TextureToShapeConverter.HoleDetection
getset

Will detect texture 'holes' if set to true. Slows down the detection. Default is false.

Määrittely tiedoston TextureToShapeConverter.cs rivillä 126.

Viitattu Jypeli.TextureToShapeConverter.DetectVertices() ja Jypeli.TextureToShapeConverter.Initialize().

◆ HullTolerance

float Jypeli.TextureToShapeConverter.HullTolerance
getset

◆ MultipartDetection

bool Jypeli.TextureToShapeConverter.MultipartDetection
getset

Will detect texture multiple 'solid' isles if set to true. Slows down the detection. Default is false.

Määrittely tiedoston TextureToShapeConverter.cs rivillä 135.

Viitattu Jypeli.TextureToShapeConverter.DetectVertices() ja Jypeli.TextureToShapeConverter.Initialize().

◆ PixelOffsetOptimization

bool Jypeli.TextureToShapeConverter.PixelOffsetOptimization
getset

Will optimize the vertex positions along the interpolated normal between two edges about a half pixel (post processing). Default is false.

Määrittely tiedoston TextureToShapeConverter.cs rivillä 144.

Viitattu Jypeli.TextureToShapeConverter.Initialize().

◆ PolygonDetectionType

VerticesDetectionType Jypeli.TextureToShapeConverter.PolygonDetectionType
getset

Get or set the polygon detection type.

Määrittely tiedoston TextureToShapeConverter.cs rivillä 117.

Viitattu Jypeli.TextureToShapeConverter.DetectVertices().

◆ Transform

Matrix Jypeli.TextureToShapeConverter.Transform
getset

Dokumentaatio tälle luokalle luotiin seuraavasta tiedostosta: