JeeGee
JeeGee

Reputation: 23

Image-revealing triangles in XNA

Say, I have some images drawn on screen, like in any average XNA project. Is it possible to make it so that only a selected array of triangles of the image is visible? Here's an example:

http://i.imgur.com/Q2a513O.png

The red lines outline the triangles in the array. The blackness is completely hidden from view.

I tried googling and didn't find anything, so I hope this is even possible.

Upvotes: 1

Views: 165

Answers (2)

Kent Munthe Caspersen
Kent Munthe Caspersen

Reputation: 6888

You can use the VertexPositionTexture class. Then use a mask consiting of a VPT for each triangle in you array to reveal the parts of your texture you want visible. An example of how you can use it: enter link description here

Upvotes: 0

Geeky Guy
Geeky Guy

Reputation: 9399

If you want to make a mask like that, you could have a sprite that's the exact shape of the blackness (bonus if you make that shape dynamic ;)). Have it drawn in a layer above whatever you want to hide.

Upvotes: 1

Related Questions