Notifications
Clear all

[Closed] [SDK] Vertex Colors, how to create them?

Hello,
I am confused with vertex colors. Can’t figure it out so far. I have my mesh, and I would like to set all the vertex colors od this mesh to (0.5, 0.5, 0.5) …

I setting this values, but after clicking render I have a message about no vertex channel info… also I am confused with channels,

// some raw code

mesh_knot.setMapSupport(0, 1);
mesh_knot.setNumVertCol(4);
mesh_knot.setNumVCFaces(2);

mesh_knot.vertCol[0] = Point3(0.5f, 0.5f, 0.5f);
mesh_knot.vertCol[1] = Point3(0.5f, 0.5f, 0.5f);
mesh_knot.vertCol[2] = Point3(0.5f, 0.5f, 0.5f);
mesh_knot.vertCol[3] = Point3(0.5f, 0.5f, 0.5f);
mesh_knot.vcFace[0].t[0] = 0;
mesh_knot.vcFace[0].t[1] = 0;
mesh_knot.vcFace[0].t[2] = 0;
2 Replies
mesh.setNumVertCol(4);
mesh.setNumVCFaces(2);

mesh.setMapVert(0, 0, Point3(0.5f, 0.5f, 0.5f));
mesh.setMapVert(0, 1, Point3(0.5f, 0.5f, 0.5f));
mesh.setMapVert(0, 2, Point3(0.5f, 0.5f, 0.5f));
mesh.setMapVert(0, 3, Point3(0.5f, 0.5f, 0.5f));

Face* faces = mesh.faces;
TVFace* mapfaces = mesh.mapFaces(0);
mapfaces[0].t[0] = faces[0].v[0];
mapfaces[0].t[1] = faces[0].v[1];
mapfaces[0].t[2] = faces[0].v[2];

mapfaces[1].t[0] = faces[1].v[0];
mapfaces[1].t[1] = faces[1].v[1];
mapfaces[1].t[2] = faces[1].v[2];

Thank you again Klvnk, works great…