Some refactor around texture coordinate calculation.