generateSideWallUV static method

dynamic generateSideWallUV(
  1. dynamic geometry,
  2. List<double> vertices,
  3. num indexA,
  4. num indexB,
  5. num indexC,
  6. num indexD,
)

Implementation

static generateSideWallUV(geometry, List<double> vertices, num indexA, num indexB, num indexC, num indexD) {
  double aX = vertices[indexA.toInt() * 3];
  double aY = vertices[indexA.toInt() * 3 + 1];
  double aZ = vertices[indexA.toInt() * 3 + 2];
  double bX = vertices[indexB.toInt() * 3];
  double bY = vertices[indexB.toInt() * 3 + 1];
  double bZ = vertices[indexB.toInt() * 3 + 2];
  double cX = vertices[indexC.toInt() * 3];
  double cY = vertices[indexC.toInt() * 3 + 1];
  double cZ = vertices[indexC.toInt() * 3 + 2];
  double dX = vertices[indexD.toInt() * 3];
  double dY = vertices[indexD.toInt() * 3 + 1];
  double dZ = vertices[indexD.toInt() * 3 + 2];

  if (Math.abs(aY - bY) < Math.abs(aX - bX)) {
    return [Vector2(aX, 1 - aZ), Vector2(bX, 1 - bZ), Vector2(cX, 1 - cZ), Vector2(dX, 1 - dZ)];
  } else {
    return [Vector2(aY, 1 - aZ), Vector2(bY, 1 - bZ), Vector2(cY, 1 - cZ), Vector2(dY, 1 - dZ)];
  }
}