Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

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?

share|improve this question
add comment

1 Answer 1

up vote 3 down vote accepted

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.