1
\$\begingroup\$

I am generating vertices at runtime that represent terrain.

I've always drawn the vertices as triangles with GraphicsDevice.DrawUserPrimitives<VertexPositionColor>, but I'm wondering: Can vertices be converted into a "Model" so I could handle model and terrain rendering in a unified way?

This page is quite similar to what I am searching for.

I want to later port my game to Mono. Would this approach cause problems when using the Content Pipeline to convert the data?

\$\endgroup\$

1 Answer 1

3
\$\begingroup\$

The official answer from Shawn Hargreaves (one of the developers of XNA) is

The XNA Model class doesn't do any optimization at runtime: that all happens at build time inside the ModelProcessor. This is exactly why it is impossible to create a Model instance at runtime: the Model class depends on the processor to have optimized its data ready for rendering. If you are generating your data procedurally at runtime, there is no place for those optimizations to happen, so you're as well off just using your own standalone class.

Source: http://social.msdn.microsoft.com/Forums/en-US/cd49df6b-21b1-48a5-89ef-77d22cba2e1a/how-to-procedurally-generate-models-at-runtime?forum=xnagamestudioexpress

I do not believe this behaviour has changed. But of course you can create a wrapper class yourselves so that you can handle a series of vertices and Models in a unified way.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .