How to access vertex position w/out locking the VertexBuffer

Started by
3 comments, last by mdias 21 years, 5 months ago
Hi, I want to make a per-polygon collision engine but I don''t know how to access the polygon''s vertices coordinates w/out locking the vertex buffer, cause if I need to lock and unlock the VertexBuffer everytime I need to test a collision I would lose a lot of performance... Does anyone knows how to do this ???? Kamikaze
Advertisement
why not just keep a non-VB copy of the vertex positions? the copy could contain only positions (ie. no tex coords, etc.)

Also, you could keep a lower res copy of the vertices in your collision copy - there is no reason your collision test has to be on exactly the same vertices...

Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces"
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
I know I could keep a copy of the VB coordinates but I want
to the coordinates directly from the VB, thanx anyway

Kamikaze
Just curious - why? Assuming you put them there, why do you need to pull them back out.

Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces"
Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces", A third book on advanced lighting and materials
Because I don''t want to waste memory...
If I had a mesh with a high polygon count I would waste
AGP memory and System memory... But I already made it
using VB->Lock(), and it doesn''t appear to make a slowdown
as I used the flag D3DLOCK_READONLY.
And I''m detecting collisions well now

And to answer your question:
If I make a copy of the VB to the Sys Memory
everytime I make a change to the mesh, like a
deformation I would have to refresh the VB in
the Sys Memory.

Kamikaze

This topic is closed to new replies.

Advertisement