Create faces with new SketchUp SDK C API

Yes, I create side of cube(with SUFaceCreate or SUFaceCreateSimple), than I create textured face on this side with SUGeometryInputAddFace
Yuo canchek this in source

#include <assert.h>
#include <vector>

#include <slapi/slapi.h>
#include <slapi/geometry.h>
#include <slapi/initialize.h>
#include <slapi/model/model.h>
#include <slapi/model/entities.h>
#include <slapi/model/face.h>
#include <slapi/model/edge.h>
#include "slapi/model/texture.h"
#include "slapi/model/material.h"

#define SU_CALL(func) if ((func) != SU_ERROR_NONE) throw std::exception()

struct point3d
{
double x;
double y;
double z;
};
class SKPModel
{
public:
SKPModel()
{
	model.ptr = nullptr;
	SUInitialize();
	SU_CALL(SUModelCreate(&model));
}
~SKPModel()
{
	if (SUIsValid(model))
		SUModelRelease(&model);
	SUTerminate();
}

void AddFace(point3d *pPoints, int Count)
{
	SUEntitiesRef entities = SU_INVALID;
	SU_CALL(SUModelGetEntities(model, &entities));

	SUPoint3D* vertices = new SUPoint3D[Count];
	for (int i = 0; i < Count; ++i)
		vertices[Count - i - 1] = SUPoint3D({ pPoints[i].x, pPoints[i].y, pPoints[i].z });

	if (Count > 2) {
		SUFaceRef face = SU_INVALID;
		//SU_CALL(SUFaceCreateSimple(&face, vertices, Count));
		SULoopInputRef loop = SU_INVALID;
		SU_CALL(SULoopInputCreate(&loop));
		for (size_t i = 0; i < Count; ++i)
			SU_CALL(SULoopInputAddVertexIndex(loop, i));

		SU_CALL(SUFaceCreate(&face, vertices, &loop));
		SU_CALL(SUEntitiesAddFaces(entities, 1, &face));
	}
	else {
		SUEdgeRef edge = SU_INVALID;
		SU_CALL(SUEdgeCreate(&edge, vertices, vertices + 1));
		SU_CALL(SUEntitiesAddEdges(entities, 1, &edge));
	}
	delete[] vertices;
}
void AddBitmap(point3d *pPoints, int Count, char* FileName)
{
	assert(Count > 2);

	SUPoint3D* points = new SUPoint3D[Count];
	for (int i = 0; i < Count; ++i) {
		points[Count - i - 1] = SUPoint3D({ pPoints[i].x, pPoints[i].y, pPoints[i].z });
	}
	SUGeometryInputRef input = SU_INVALID;
	SU_CALL(SUGeometryInputCreate(&input));
	SU_CALL(SUGeometryInputSetVertices(input, Count, points));
	delete[] points;

	SULoopInputRef loop = SU_INVALID;
	SU_CALL(SULoopInputCreate(&loop));

	for (size_t i = 0; i < Count; ++i) {
		SU_CALL(SULoopInputAddVertexIndex(loop, i));
	}

	size_t face_index0;
	SU_CALL(SUGeometryInputAddFace(input, &loop, &face_index0));


	SUTextureRef tex = SU_INVALID;
	SU_CALL(SUTextureCreateFromFile(&tex, FileName, 1.0, 1.0));

	SUMaterialRef mat = SU_INVALID;
	SU_CALL(SUMaterialCreate(&mat));
	SU_CALL(SUMaterialSetTexture(mat, tex));
	SU_CALL(SUMaterialSetName(mat, "material"));

	SUMaterialInput mat_input;
	mat_input.material = mat;
	mat_input.num_uv_coords = 4;
	SUPoint2D uv_coords[4] = { { 0, 0 }, { 1, 0 }, { 1, 1 }, { 0, 1 } };
	for (size_t i = 0; i < 4; ++i) {
		mat_input.vertex_indices[i] = i;
		mat_input.uv_coords[i] = uv_coords[i];
	}

	SU_CALL(SUGeometryInputFaceSetFrontMaterial(input, face_index0, &mat_input));
	SU_CALL(SUGeometryInputFaceSetBackMaterial(input, face_index0, &mat_input));

	SUEntitiesRef entities = SU_INVALID;
	SU_CALL(SUModelGetEntities(model, &entities));
	SU_CALL(SUEntitiesFill(entities, input, true));

	SU_CALL(SUGeometryInputRelease(&input));
}
void Save(char* FileName)
{
	SU_CALL(SUModelSaveToFile(model, FileName));
}
private:
SUModelRef model;
};

int main()
{
point3d cb_vrtcs1[4] = {
	{ 0, 0, 0 },
	{ 100, 0, 0 },
	{ 100, 100, 0 },
	{ 0, 100, 0 }
};

point3d cb_vrtcs2[4] = {
	{ 0, 0, 100 },
	{ 0, 100, 100 },
	{ 100, 100, 100 },
	{ 100, 0, 100 }
};

point3d cb_vrtcs3[4] = {
	{ 0, 0, 0 },
	{ 0, 100, 0 },
	{ 0, 100, 100 },
	{ 0, 0, 100 }
};

point3d cb_vrtcs4[4] = {
	{ 100, 0, 0 },
	{ 100, 0, 100 },
	{ 100, 100, 100 },
	{ 100, 100, 0 }
};

point3d cb_vrtcs5[4] = {
	{ 0, 0, 0 },
	{ 0, 0, 100 },
	{ 100, 0, 100 },
	{ 100, 0, 0 }
};

point3d cb_vrtcs6[4] = {
	{ 0, 100, 0 },
	{ 100, 100, 0 },
	{ 100, 100, 100 },
	{ 0, 100, 100 }
};


SKPModel skp_model;
skp_model.AddFace(cb_vrtcs1, 4);
skp_model.AddFace(cb_vrtcs2, 4);
skp_model.AddFace(cb_vrtcs3, 4);
skp_model.AddFace(cb_vrtcs4, 4);
skp_model.AddFace(cb_vrtcs5, 4);
skp_model.AddFace(cb_vrtcs6, 4);

point3d txtr_vrtc1[4] = {
	{ 40, 40, 0 },
	{ 60, 40, 0 },
	{ 60, 60, 0 },
	{ 40, 60, 0 }
};
skp_model.AddBitmap(txtr_vrtc1, 4, "tst.jpg");

point3d txtr_vrtc2[4] = {
	{ 40, 40, 100 },
	{ 60, 40, 100 },
	{ 60, 60, 100 },
	{ 40, 60, 100 }
};
skp_model.AddBitmap(txtr_vrtc2, 4, "tst.jpg");

point3d txtr_vrtc3[4] = {
	{ 0, 40, 40 },
	{ 0, 40, 60 },
	{ 0, 60, 60 },
	{ 0, 60, 40 }
};
skp_model.AddBitmap(txtr_vrtc3, 4, "tst.jpg");

point3d txtr_vrtc4[4] = {
	{ 100, 40, 40 },
	{ 100, 40, 60 },
	{ 100, 60, 60 },
	{ 100, 60, 40 }
};
skp_model.AddBitmap(txtr_vrtc4, 4, "tst.jpg");
skp_model.Save("cube.skp");
return 0;
}