Custom Vertex Formats

Started by
1 comment, last by Potsticker 22 years, 2 months ago
I understand how to create vertex structs for DX8. But I was at a point with a dynamically adjusted mesh that I wanted to adjust the vertex''s normals to efficiently, so I added a variable to keep track of how many normals had been added in to divide the normal and get the proper vertex normal (you know the routine) I added a tracking variable after the normal vertex data, assuming that, since I have defined the vertex format and all those variables are before it in the struct, and that since you pass the sizeof the struct into DrawPrimitive it should be able to figure it out. But, it huh, doesn''t work. and really hoses things up big time. Now I have managed a work around, and it isn''t a big deal, but I was wondering if anyone has any info about this in case I come across a similar situation later. Basically, adding none directX related variables to vertex structs without hosing things up. Can it be done?
Advertisement
I don''t see where you can pass the size of a vertex to DrawPrimitive. You have to do this with SetStreamSource and the remark section tells you that the size must match the one of the size computed from the FVF.
But if you use a declaration for your vertex, it should work. But I can''t determine from your post what type you''re using.
Hmmm.. I thought the final parameter in DrawIndexedPrimitiveUP allowed you to set the size of the struct. Since, that''s what you pass into it. But maybe I''m missing something.

I''m all over setting the format and rendering it fine, I was just wondering if you could add personal variables for custom operations into the vertex, and just keep it after the defined format variables.

It isn''t essential by any stretch, more something I was curious about.

This topic is closed to new replies.

Advertisement