Yes, but I don't know how to convert an int value to a bit array. It only provides a constructor to pass in an int value, set the size, not the real value. In maxscript, you can convert it to an as array
BitArray vertsel(mesh.numVerts);
vertsel.Set(vertindex);
though you have to be careful vert index != normal index
I seem to be a little confused. I get a vertex serial number a, and I want to get the corresponding normal serial number through a, which seems to fail to work
there isn't always a corresponding normal to a vert there maybe several
you need to know what faces are used by the vert then get the corner of the vert in that face and from there get the normal ID (it's very similar to how uv's work) they may all share the same normal ID but they may not.
if you are doing a lot changes to normals working from vert indexs but no changes to the geometry you can build a reverse look up table vert to face and corner
typedef std::pair<int, int> fcorner;
typedef std::vector<std::deque<fcorner>> vertfacelookup;
void BuildVertFaceLookUpTable(Mesh& mesh, vertfacelookup& vfac)
{
vfac.clear();
vfac.resize(mesh.numVerts);
Face* faces = mesh.faces;
for(int f = 0; f < mesh.numFaces; ++f, ++faces)
{
vfac[faces->v[0]].push_back(fcorner(f,0));
vfac[faces->v[1]].push_back(fcorner(f,1));
vfac[faces->v[2]].push_back(fcorner(f,2));
}
}
then getting the normals becomes something like.....
void PrintVertNormals(int vert, IEditNormalsMod* enm, vertfacelookup& vfac)
{
std::deque<fcorner>& vfaces = vfac[vert];
for(int i = 0; i < vfaces.size(); ++i)
{
int normalID = enm->EnfnGetNormalID (vfaces[i].first, vfaces[i].second);
Point3* normal = enm->EnfnGetNormal(normalID);
mprintf(_T("[%f,%f,%f]\n"), normal->x, normal->y, normal->z);
}
}
what is the reason to use
std::deque
if you use only push_back?
deques are useful when you don't know what the size is going be (they don't even have resize() as they don't need it) You could use a vector and reserve( arbitary_amount) if you want or just let it reallocate as it goes, what ever float yer boat. Could even use Max Tab.