TriangleColumnCuts

A textured triangle's texture columns and rows for BGE.QuadColumnDrawer.drawTriangleTo(), each cut to the triangle's span. Strips are a power of two texels wide, and each width is cut on first use and kept, so drawing only projects. Share one per face texture.

Properties

  • isValid (boolean) — false if the UV triangle has no area, so it can't map onto the face
  • u (Array.<float>) — the triangle's texel points
  • v (Array.<float>)
  • ua (float) — (u, v) -> how far along the face's edges 0->1 (a) and 0->2 (b) it is:
  • va (float)
  • ub (float)
  • vb (float)
  • minU (integer) — the texels the triangle covers, whole texels
  • maxU (integer)
  • minV (integer)
  • maxV (integer)
  • mirrorSource (BGE.QuadColumnTexture) — The whole texture, shared by every face using it, whose flipped copies mirrored strips

Constructor

new TriangleColumnCuts( region: roRegion, points: Array.<BGE.Math.Vector>, ): TriangleColumnCuts

Parameters

  • region (roRegion) — the texture
  • points (Array.<BGE.Math.Vector>) — the triangle's 3 texel points within region

Instance Methods

getStrips( useRows: boolean, stepLog2: integer, ): BGE.TriangleColumnStrips

The strips stepLog2 (log2 of their width in texels) wide: columns run along v at fixed u, rows along u at fixed v.

Parameters

  • useRows (boolean)
  • stepLog2 (integer)

Returns

getMirroredRegion( useRows: boolean, strips: BGE.TriangleColumnStrips, k: integer, ): roRegion

Strip k of strips for a strip drawn mirrored: a negative scale can't be rotated, so it's cut from the flipped copy of mirrorSource, or is the middle texel alone without one.

Parameters

Returns

  • roRegion

canMirror(useRows: boolean): boolean

Whether mirrored strips draw whole slabs (texels across), not just their middle texel.

Parameters

  • useRows (boolean)

Returns

  • boolean

getCroppedRegion( useRows: boolean, strips: BGE.TriangleColumnStrips, k: integer, low: integer, high: integer, mirrored?: boolean, ): roRegion

Strip k of strips with only the texels from low to high along, for a strip cut back to the near plane. A new region each call.

Parameters

  • useRows (boolean)
  • strips (BGE.TriangleColumnStrips) — from getStrips(useRows, ...)
  • k (integer)
  • low (integer)
  • high (integer)
  • mirrored (boolean, optional, default: false) — for a strip drawn mirrored (see getMirroredRegion())

Returns

  • roRegion

stripCount(useRows: boolean, stepSize: integer): integer

How many strips stepSize texels wide cross the triangle.

Parameters

  • useRows (boolean)
  • stepSize (integer)

Returns

  • integer