computeWorldVertices2 method

void computeWorldVertices2(
  1. Bone bone,
  2. Float32List worldVertices,
  3. int offset,
  4. int stride,
)

Implementation

void computeWorldVertices2(
    Bone bone, Float32List worldVertices, int offset, int stride) {
  final Float32List vertexOffset = this.offset;
  final double x = bone.worldX, y = bone.worldY;
  final double a = bone.a, b = bone.b, c = bone.c, d = bone.d;
  double offsetX = 0.0, offsetY = 0.0;

  offsetX = vertexOffset[RegionAttachment.ox1];
  offsetY = vertexOffset[RegionAttachment.oy1];
  worldVertices[offset] = offsetX * a + offsetY * b + x; // br
  worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
  offset += stride;

  offsetX = vertexOffset[RegionAttachment.ox2];
  offsetY = vertexOffset[RegionAttachment.oy2];
  worldVertices[offset] = offsetX * a + offsetY * b + x; // bl
  worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
  offset += stride;

  offsetX = vertexOffset[RegionAttachment.ox3];
  offsetY = vertexOffset[RegionAttachment.oy3];
  worldVertices[offset] = offsetX * a + offsetY * b + x; // ul
  worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
  offset += stride;

  offsetX = vertexOffset[RegionAttachment.ox4];
  offsetY = vertexOffset[RegionAttachment.oy4];
  worldVertices[offset] = offsetX * a + offsetY * b + x; // ur
  worldVertices[offset + 1] = offsetX * c + offsetY * d + y;
}