any idea skipping some vertices with DrawIndexedPrimitive()
#1 Members - Reputation: 107
Posted 18 December 2012 - 08:37 AM
I'm using DirectX9.
Thanks for reading.
I want to skip some vertices drawing mesh with DrawIndexedPrimitive() func.
Original mesh (with one DrawIndexedPrimitive() call):
┌─┬─┬─┐
│/│/│/│
├─┼─┼─┤
│/│/│/│
├─┼─┼─┤
│/│/│/│
└─┴─┴─┘
and I want to make the mesh like this:
┌─┬─┬─┐
│/│/│/│
├─┴─┼─┤
│/ │/│
│ * ├─┤
/│/│
──┴─┘
(the vertex marked as * <- is skipped one.)
Of course it can be achived with DrawPrimitive() func, but
DrawPrimitive() is very inefficient for some reasons such that memory efficiency or many draw call.
It seems quiet difficult problem to me.
Anyone tried to do this?
It'll be appreciate for any ideas.
#2 GDNet+ - Reputation: 470
Posted 18 December 2012 - 01:42 PM
Or is that meant to be a gap where the asterisk is ? In that case, can't you edit your index buffer to remove the 4 triangles that are affected ?
#5 Members - Reputation: 1597
Posted 19 December 2012 - 03:52 AM
PIX does not mind. The Debug Runtimes don't either. But look what the reference driver does:
So both lines and triangles are screwed.
To be on the safe side, rather go with Gavin's version. If you got triangle lists you can even eliminate individual triangles by setting the indices to e.g. (0,0,0). Degenerate triangles don't get rasterized.
#6 Members - Reputation: 107
Posted 21 December 2012 - 04:04 AM
unbird,
My project is very performance-sensitive, so Gavin's version is difficult to apply.
As you said, one proper way is making one of x/y/z value of a vertex of a triangle NaN value.
In my code, NaN value is specified with std::numeric_limits<float>::signaling_NaN() func.
This is cheap and easy.
Another way is making indices of a triangle (0,0,0) or something non-triangle vertex indices.
Both method are suit to me.
#7 Members - Reputation: 380
Posted 22 December 2012 - 06:20 AM
I agree with unbird, I wouldn't trust using NaN values. Gavin's approach would be the way to go. It shouldn't be too performance heavy. Just create the index buffer as a dynamic buffer so the API optimizes it for frequent CPU access. And create the vertex buffer as a static buffer if that data is not going to change.






