Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You have a few options. It depends two things: whether the model is loaded or generated at runtime, and whether your multiple textures get combined into one or kept individual.</p> <p>If you have art skills or know an artist, probably the easiest approach is to get them to texture map the cylinder with as many textures as you want (multiple materials). You'd want your <code>Model</code> to have one mesh (<code>ModelMesh</code>) and one material (<code>ModelMeshPart</code>) per texture required. This is assuming the cylinders always have a fixed number of textures!. Then, to swap the textures at runtime you'd iterate through the <code>ModelMesh.Effects</code> collection, cast each to a <code>BasicEffect</code> and set it's <code>Texture</code> property. </p> <p>If you can't modify the model, you'll have to generate it. There's an example of this on the AppHub site: <a href="http://create.msdn.com/en-US/education/catalog/sample/primitives_3d" rel="nofollow">http://create.msdn.com/en-US/education/catalog/sample/primitives_3d</a>. It probably does not generate texture coordinates so you'd need to add them. If you wanted 5 images per cylinder, you should make sure the number of segments is a multiple of 5 and the V coordinate should go from 0 to 1, 5 times as it wraps around the cylinder. To keep your textures individual with this technique, you'd need to draw the cylinder in 5 chunks, each time setting the <code>GraphicsDevice.Textures[0]</code> to your current texture.</p> <p>With both techniques it would be possible to draw the cylinder in a single draw call, but you'd need to merge your textures into a single one using <code>Texture2D.GetData</code> and <code>Texture2D.SetData</code>. This is going to be more efficient, but really isn't worth the trouble. Well not unless you making some kind of crazy slot machine particle system anyway.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload