When I set up an example demonstrating how much faster GPU-driven bones animation was than CPU-driven animation, I had to modify vertices to contain an index so that each vertex knew which matrix it should use.
I used ent_getvertex to modify the second uv set, which wasn't being used.
I really don't understand the manual's example usage of ent_setvertex. Using c.v (you'll know what I mean if you look in the manual) gives you access to the actual vertex buffer, so modifying the contents of c.v shouldn't require the use of ent_setvertex at all (my code doesn't).
Here's the function I had:
function initEnt() {
VECTOR currentVec;
VECTOR currentVec2;
ANGLE currentAng;
CONTACT* c;
var vexCount = ent_status(this, 0);
STRING* currentBone = str_create("#10");
while (vexCount > 0) {
c = ent_getvertex(this, NULL, vexCount);
// get position relative to the bone it is attached to
vec_for_bone(¤tVec, this, ent_bonename(this, NULL, vexCount));
ang_for_bone(¤tAng, this, ent_bonename(this, NULL, vexCount));
// swapping co-ordinates so I can use built-in functions
currentVec2.x = c.v.x;
currentVec2.y = c.v.z;
currentVec2.z = c.v.y;
// translate into world space
vec_rotate(¤tVec2, this.pan);
vec_add(¤tVec2, this.x);
// then get relative position to bone
vec_sub(¤tVec2, ¤tVec);
// account for the bone's angle
vec_rotateback(¤tVec2, ¤tAng);
// swap z and y co-ordinate back when we recover
c.v.x = currentVec2.x;
c.v.y = currentVec2.z;
c.v.z = currentVec2.y;
// will also need to set u2 to something that indicates which bone it is attached to
ent_bonename(this, currentBone, vexCount);
if (str_cmpni(currentBone, "root") == 1)
c.v.u2 = 0;
else if (str_cmpni(currentBone, "head") == 1)
c.v.u2 = 1;
else if (str_cmpni(currentBone, "upper") == 1)
c.v.u2 = 2;
else if (str_cmpni(currentBone, "lower") == 1)
c.v.u2 = 3;
else if (str_cmpni(currentBone, "hand") == 1)
c.v.u2 = 4;
else
c.v.u2 = 5;
//...
vexCount -= 1;
}
}
It's not very clean, as I was busting out an example as fast as I could to make a case for GPU-based bones animation. But it hopefully makes it clear how I used ent_getvertex.
I called this once at the beginning of the program to modify the second uv set (specifically, u2). Something similar could easily be done to indicate a brightness/darkness for a vertex, and whatever shader you used would be very easy to modify (as Slin already said).
I hope this is of some use.
Jibb