Page 1 of 1

Visually Rendering DetectorVolume?

Posted: Wed Feb 17, 2010 3:49 am
by vintagegames
How can this be accomplished?

Re: Visually Rendering DetectorVolume?

Posted: Wed Feb 17, 2010 4:02 am
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.

Re: Visually Rendering DetectorVolume?

Posted: Wed Feb 24, 2010 11:24 am
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.

Re: Visually Rendering DetectorVolume?

Posted: Wed Feb 24, 2010 11:35 pm
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.