C# 클래스 Sparrow.Utils.VertexData

The VertexData class manages a raw list of vertex information, allowing direct upload to OpenGL vertex buffers. _You only have to work with this class if you create display objects with a custom render function. If you don't plan to do that, you can safely ignore it._ To render objects with OpenGL, you have to organize vertex data in so-called vertex buffers. Those buffers reside in graphics memory and can be accessed very efficiently by the GPU. Before you can move data into vertex buffers, you have to set it up in conventional memory - that is, in a byte array. That array contains all vertex information (the coordinates, color, and texture coordinates) - one vertex after the other. To simplify creating and working with such a bulky list, the VertexData class was created. It contains methods to specify and modify vertex data. The raw array managed by the class can then easily be uploaded to a vertex buffer. **Premultiplied Alpha** The color values of texture files may contain premultiplied alpha values, which means that the 'RGB' values were multiplied with the 'alpha' value before saving them. On rendering, it makes a difference in which way the alpha value is saved; for that reason, the VertexData class mimics this behavior. You can choose how the alpha values should be handled via the 'premultipliedAlpha' property.
파일 보기 프로젝트 열기: fmotagarcia/sparrow-sharp 1 사용 예제들

공개 메소드들

메소드 설명
AlphaAt ( int index ) : float

Returns the alpha value of a vertex.

BoundsAfterTransformation ( Matrix matrix ) : Rectangle

Calculates the bounding rectangle of all vertices after being transformed by a matrix.

BoundsAfterTransformation ( Matrix matrix, int atIndex, int numVertices ) : Rectangle

Calculates the bounding rectangle of subsequent vertices after being transformed by a matrix.

ColorAt ( int index ) : uint

Returns the RGB color of a vertex (without premultiplied alpha).

CopyToVertexData ( VertexData target, bool copyColor, int atIndex ) : void

Copies the vertex data of this instance to another vertex data object, starting at a certain index.

CopyToVertexData ( VertexData target, bool copyColor, int atIndex, int numVertices ) : void

Copies a range of vertices of this instance to another vertex data object.

PositionAt ( int index ) : Point

Returns the position of a vertex.

ScaleAlphaBy ( float factor ) : void

Multiplies all alpha values with a certain factor.

ScaleAlphaBy ( float factor, int index, int numVertices ) : void

Multiplies a range of alpha values with a certain factor.

SetAlpha ( float alpha ) : void

Updates the alpha value of all vertices.

SetAlpha ( float alpha, int atIndex ) : void

Updates the alpha value of a vertex.

SetColor ( uint color ) : void

Updates the color of all vertexes. The method always expects non-premultiplied alpha values.

SetColor ( uint color, float alpha ) : void

Updates the color of all vertexes. The method always expects non-premultiplied alpha values.

SetColor ( uint color, float alpha, int atIndex ) : void

Updates the color of a vertex. The method always expects non-premultiplied alpha values.

SetColor ( uint color, int atIndex ) : void

Updates the color of a vertex. The method always expects non-premultiplied alpha values.

SetPosition ( Point position, int atIndex ) : void

Updates the position of a vertex.

SetPosition ( float x, float y, int atIndex ) : void

Updates the position of a vertex.

SetPremultipliedAlpha ( bool value, bool updateVertices ) : void

Changes the way alpha and color values are stored. Optionally, all exisiting vertices are updated.

SetTexCoords ( Point texCoords, int atIndex ) : void

Updates the texture coordinates of a vertex.

SetTexCoords ( float x, float y, int atIndex ) : void

Updates the texture coordinates of a vertex.

TexCoordsAt ( int index ) : Point

Returns the texture coordinates of a vertex.

TransformVertices ( Matrix matrix, int atIndex, int numVertices ) : void

Transforms the positions of subsequent vertices by multiplication with a transformation matrix

VertexData ( int numVertices, bool premultipliedAlpha = false ) : System

Initializes a VertexData instance with a certain size.

메소드 상세

AlphaAt() 공개 메소드

Returns the alpha value of a vertex.
public AlphaAt ( int index ) : float
index int
리턴 float

BoundsAfterTransformation() 공개 메소드

Calculates the bounding rectangle of all vertices after being transformed by a matrix.
public BoundsAfterTransformation ( Matrix matrix ) : Rectangle
matrix Matrix
리턴 Sparrow.Geom.Rectangle

BoundsAfterTransformation() 공개 메소드

Calculates the bounding rectangle of subsequent vertices after being transformed by a matrix.
public BoundsAfterTransformation ( Matrix matrix, int atIndex, int numVertices ) : Rectangle
matrix Matrix
atIndex int
numVertices int
리턴 Sparrow.Geom.Rectangle

ColorAt() 공개 메소드

Returns the RGB color of a vertex (without premultiplied alpha).
public ColorAt ( int index ) : uint
index int
리턴 uint

CopyToVertexData() 공개 메소드

Copies the vertex data of this instance to another vertex data object, starting at a certain index.
public CopyToVertexData ( VertexData target, bool copyColor, int atIndex ) : void
target VertexData
copyColor bool
atIndex int
리턴 void

CopyToVertexData() 공개 메소드

Copies a range of vertices of this instance to another vertex data object.
public CopyToVertexData ( VertexData target, bool copyColor, int atIndex, int numVertices ) : void
target VertexData
copyColor bool
atIndex int
numVertices int
리턴 void

PositionAt() 공개 메소드

Returns the position of a vertex.
public PositionAt ( int index ) : Point
index int
리턴 Point

ScaleAlphaBy() 공개 메소드

Multiplies all alpha values with a certain factor.
public ScaleAlphaBy ( float factor ) : void
factor float
리턴 void

ScaleAlphaBy() 공개 메소드

Multiplies a range of alpha values with a certain factor.
public ScaleAlphaBy ( float factor, int index, int numVertices ) : void
factor float
index int
numVertices int
리턴 void

SetAlpha() 공개 메소드

Updates the alpha value of all vertices.
public SetAlpha ( float alpha ) : void
alpha float
리턴 void

SetAlpha() 공개 메소드

Updates the alpha value of a vertex.
public SetAlpha ( float alpha, int atIndex ) : void
alpha float
atIndex int
리턴 void

SetColor() 공개 메소드

Updates the color of all vertexes. The method always expects non-premultiplied alpha values.
public SetColor ( uint color ) : void
color uint
리턴 void

SetColor() 공개 메소드

Updates the color of all vertexes. The method always expects non-premultiplied alpha values.
public SetColor ( uint color, float alpha ) : void
color uint
alpha float
리턴 void

SetColor() 공개 메소드

Updates the color of a vertex. The method always expects non-premultiplied alpha values.
public SetColor ( uint color, float alpha, int atIndex ) : void
color uint
alpha float
atIndex int
리턴 void

SetColor() 공개 메소드

Updates the color of a vertex. The method always expects non-premultiplied alpha values.
public SetColor ( uint color, int atIndex ) : void
color uint
atIndex int
리턴 void

SetPosition() 공개 메소드

Updates the position of a vertex.
public SetPosition ( Point position, int atIndex ) : void
position Point
atIndex int
리턴 void

SetPosition() 공개 메소드

Updates the position of a vertex.
public SetPosition ( float x, float y, int atIndex ) : void
x float
y float
atIndex int
리턴 void

SetPremultipliedAlpha() 공개 메소드

Changes the way alpha and color values are stored. Optionally, all exisiting vertices are updated.
public SetPremultipliedAlpha ( bool value, bool updateVertices ) : void
value bool
updateVertices bool
리턴 void

SetTexCoords() 공개 메소드

Updates the texture coordinates of a vertex.
public SetTexCoords ( Point texCoords, int atIndex ) : void
texCoords Point
atIndex int
리턴 void

SetTexCoords() 공개 메소드

Updates the texture coordinates of a vertex.
public SetTexCoords ( float x, float y, int atIndex ) : void
x float
y float
atIndex int
리턴 void

TexCoordsAt() 공개 메소드

Returns the texture coordinates of a vertex.
public TexCoordsAt ( int index ) : Point
index int
리턴 Point

TransformVertices() 공개 메소드

Transforms the positions of subsequent vertices by multiplication with a transformation matrix
public TransformVertices ( Matrix matrix, int atIndex, int numVertices ) : void
matrix Matrix
atIndex int
numVertices int
리턴 void

VertexData() 공개 메소드

Initializes a VertexData instance with a certain size.
public VertexData ( int numVertices, bool premultipliedAlpha = false ) : System
numVertices int
premultipliedAlpha bool
리턴 System