Grid Cutting in Half-DirectX

I'm trying to cut the grid in half or at least remove faces from it in real time. How to do this, I wonder?

Locking vertex buffers, memset of selected face or vertex to 0, does not work for me. is there someone solution or tutorial on this i really want this feature in my program!

Greetings

+3
source share
3 answers

Oh, that’s easy. No need to change the grid. D3D can already do it for you!

Set the plane of the clip with IDirect3DDevice9::SetClipPlane, then enable the plane with D3DRS_CLIPPLANEENABLErenderstate. You can even set multiple clip planes at the same time if you want ..

msdn-entry: http://doc.51windows.net/Directx9_SDK/?url=/directx9_sdk/graphics/reference/d3d/interfaces/idirect3ddevice9/setclipplane.htm

Google "D3D SetClipPlane", , .

+2

, / . , "D3DUSAGE_DYNAMIC". , "D3DLOCK_DISCARD". , , .

, , , . , , , .

0

You say setting the vertex to 0 does not work. How does it not work?

If you set the position of all the vertices of the triangle to (0.0, 0.0, 0.0), then the resulting triangle will have a zero size and should not be drawn. Just make sure you can set it to off screen instead of zero.

0
source

Source: https://habr.com/ru/post/1727242/


All Articles