transformVertex function
void
transformVertex()
Implementation
void transformVertex(Vector3 vertexPosition, Vector3 mvPosition, Vector2 center, Vector scale, double? sin, double? cos) {
// compute position in camera space
_alignedPosition
.sub2(vertexPosition, center)
.addScalar(0.5)
.multiply(Vector2(scale.x,scale.y));
// to check if rotation is not zero
if (sin != null && cos != null) {
_rotatedPosition.x =
(cos * _alignedPosition.x) - (sin * _alignedPosition.y);
_rotatedPosition.y =
(sin * _alignedPosition.x) + (cos * _alignedPosition.y);
} else {
_rotatedPosition.setFrom(_alignedPosition);
}
vertexPosition.setFrom(mvPosition);
vertexPosition.x += _rotatedPosition.x;
vertexPosition.y += _rotatedPosition.y;
// transform to world space
vertexPosition.applyMatrix4(_viewWorldMatrix);
}