Visually Rendering DetectorVolume?

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
vintagegames
Posts: 19
Joined: Wed Dec 16, 2009 4:36 pm

Visually Rendering DetectorVolume?

Post by vintagegames »

How can this be accomplished?
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Visually Rendering DetectorVolume?

Post by Norbo »

A detector volume takes a TriangleMesh in the constructor, so you can render that TriangleMesh somehow or render the model that is the source of the TriangleMesh. You may want to also set GraphicsDevice.RenderState.FillMode = FillMode.WireFrame when you draw the detector's mesh. The renderer in the demo just draws the detector's model.
vintagegames
Posts: 19
Joined: Wed Dec 16, 2009 4:36 pm

Re: Visually Rendering DetectorVolume?

Post by vintagegames »

What if I've created the TriangleMesh from scratch ( a set of manually created vertices and indices) and don't have a 3D model to render as a DisplayObject?

If I create a StaticTriangleGroup, I don't see a way to render that unless I also render the 3D model used to create the StaticTriangleGroup.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Visually Rendering DetectorVolume?

Post by Norbo »

While the demos renderer have no built in renderer for that particular case, it is pretty similar. The TriangleMesh already has a vertex list and index list. You can convert them into a format that the graphics card likes (a VertexBuffer and IndexBuffer, for example) and just use a draw (indexed) primitives call.

Here's a little introduction to it:
http://msdn.microsoft.com/en-us/library/bb196414.aspx

There's also a lot of other resources floating around the internet, and I'm guessing you could find something in XNA creator's website samples too.
Post Reply