SketchUp doesn’t store UV coordinates per vertex. Instead there is a UV mapping transformation matrix per face. These are controlled by the UI via four pins:
The APIs map using the same manner.
When you UV map via the API it’s up to four points. You can use less, depending on what you are intending to do.
Number of points in UV mapping will give you:
- A position where the UV mapping origin is. Direction is taken from the model axis and size is taken from the texture size.
- Two points will control origin and uniform scale.
- Three points will control origin and non-uniform scale and skew.
- Four points let you map a texture such that the texture plane isn’t planar to the face’s plane.
There is a design quirk with the C API what IMO makes it a bit more challenging to work with textures than the Ruby API.
The Ruby API doesn’t force you to provide 3d world points that match the vertices of the face - they just need to be on the plane of the face.
The C API for some reason (this function was added before my time) expects the input points to be anchored to the vertices of the face. This forces some extra calculations to be made in some cases to position the texture exactly where you want.
If you are writing an importer from another format what provide UV coordinates you can use just the first four and discard the rest. SketchUp computes the transformation matrix based on those four points. The catch is that you could have cases where the first four vertices of a face might be co-linear. So to be robust you want to pick a set of points that doesn’t form a degenerate triangle or quadrilateral.