Vertex stream is a tool for appending vertices and triangles.

顶点流工具,用于顶点数据和三角形数据的添加。

构造函数

属性

color: Color

The default color of the vertices.

顶点的默认颜色。

contentRect: Rectangle

The rectangle of the content. The origin is at the top-left corner.

内容的矩形区域。原点在左上角。

mainTex: Texture

The main texture.

主贴图。

uvRect: Rectangle

The rectangle of the uv. The origin is at the top-left corner.

uv 的矩形区域。原点在左上角。

pool: IPool<VertexStream> = ...

访问器

方法

  • 参数

    • rect: Readonly<Rectangle>

      The rectangle of the quad.

    • 可选color: Readonly<Color>

      The color of the quad. If not set, the color will be the default color.

    • 可选uvRect: Readonly<Rectangle>

      The uvs of the quad. If not set, the uv will be calculated based on the contentRect and uvRect.

    返回 void

    Add a quad. A quad is composed of four vertices.

    添加一个四边形。四边形由四个顶点组成。

  • 参数

    • idx0: number

      The first index of the triangle.

    • idx1: number

      The second index of the triangle.

    • idx2: number

      The third index of the triangle.

    返回 void

    Add a triangle. A triangle is composed of three indices.

    添加一个三角形。三角形由三个索引组成。

  • 参数

    • indices: readonly number[]

      The indices of the triangles.

    返回 void

    Add triangles. The triangles are composed of indices.

    添加三角形。三角形由索引组成。

  • 参数

    • x: number

      The x coordinate of the vertex.

    • y: number

      The y coordinate of the vertex.

    • 可选color: Readonly<Color>

      The color of the vertex. If not set, the color will be the default color.

    • 可选u: number

      The u of the vertex. If not set, the u will be calculated based on the contentRect and uvRect.

    • 可选v: number

      The v of the vertex. If not set, the v will be calculated based on the contentRect and uvRect.

    返回 void

    Add a vertex.

    添加一个顶点。

  • 参数

    • index: number

      The index of the vertex. If it is negative, it will be calculated from the end.

    返回 Readonly<Vector2>

    The position of the vertex.

    Get the position of the vertex by index.

    根据索引获取顶点的位置。

  • 参数

    • baseIndex: number

      The index of the first vertex of the first quad. If it is negative, it will be calculated from the end.

    返回 void

    Triangulate the quads.

    将四边形分割成三角形。