🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

D3DRMMESH

Started by
0 comments, last by GameDev.net 24 years, 9 months ago
I converted a Meshbuilder which had already loaded a file in to a Mesh.

meshbuilder->CreateMesh( &mesh );

I added it to the scene and I tried to change the vertices using the SetVertices function. The problem is after doing so, everything works as it should, except the mesh is pitch black, even with the lights and everything. You can just see the silhoutte of the mesh.

what I did was:

D3DRMVERTEX vertices[3000];

. . . //put vertex positions in vertices[]

mesh->SetVertices(0, 0, vertnum, vertices);

But when I change the

D3DRMVERTEX vertices[3000];
to
D3DRMVERTEX *vertices = (D3DRMVERTEX *)malloc(sizeof(D3DRMVERTEX) * vertnum);

and then do the SetVertex call, it works better, but now it has flashy black and white alternating colours swirling around the mesh.

I have no idea what's wrong, the mesh should be white, and it is if I don't call the SetVertices function, but I need to change vertex positions often so I used D3DRMMESH instead of Meshbuilder.

When I set only a portion of the mesh vetices with the SetVertices function, those vertices are turned black, but the rest is white.

Please help, I don't know why the mesh turns pitch black or swirls with alternating black and white colours when I call the SetVertices function.

Thanks very much,

Advertisement
Hmmm.. intresting, ive played around with RM too, not much with mesh manipulation on your scale but from my experience there could be several possiblitites:

-UV coordinates are being messed up by moving verticies. This is unlikly since you dont have any textures from your description.

-You have to recalculate normals for faces when you manipulate a mesh (not sure about this but you can check) I think RM uses normals to calcualte visiblity and lighting, which would fit the effects your describing of disappering faces and strange lighting.

So the struct for D3DRMVERTEX is as follows :

typedef struct _D3DRMVERTEX{
D3DVECTOR position;
D3DVECTOR normal;
D3DVALUE tu, tv;
D3DCOLOR color;
} D3DRMVERTEX;

As you can see if you dont init the normal, tu, tv, or color you'll proably experiecne that affect your describing. Yes thats proably it. Youll have to explicitly set those values.

Good Luck!

-ddn

This topic is closed to new replies.

Advertisement