|
Hello, I am learning 3D Studio MAX plugin development by programming a little dummy modifier which converts an input mesh into a single triangle. The problem is that I am not able to construct that single triangle without making 3D Studio to crash.
I hope anyone of you can help me or point me to some useful resource.
This is my code:
TriObject *obj = (TriObject *) os->obj;
Mesh *mesh = &obj->mesh;
mesh->setNumVerts(1);
mesh->setVert(0,Point3(0.0f,0.0f,0.0f));
mesh->setNumFaces(1,TRUE);
if (mesh->tvFace)
{
mesh->setNumTVerts(1);
mesh->setTVert(0,0.0f,0.0f,0.0f);
}
if(mesh->tvFace) mesh->setNumTVFaces(1);
if(mesh->vcFace) mesh->setNumVCFaces(1);
for(int i=0;i<1;i++) {
Face *f= &(mesh->faces[i]);
f->v[0] = 0;
f->v[1] = 1;
f->v[2] = 2;
f->smGroup = 0;
f->flags = EDGE_ALL;
if(mesh->tvFace) {
TVFace *tvf = &(mesh->tvFace[i]);
tvf->setTVerts(0,1,2);
}
if(mesh->vcFace) {
TVFace *tvf = &(mesh->vcFace[i]);
tvf->setTVerts(0,1,2);
}
}
mesh->InvalidateGeomCache();
mesh->InvalidateTopologyCache();
|
|
|