XNA Creators Club Online
Page 1 of 1 (3 items)
Sort Posts: Previous Next

Why Do We Loop Through BasicEffects in Mesh?

Last post 05/10/2007 22:45 by Zoozooka. 2 replies.
  • 05/10/2007 21:10

    Why Do We Loop Through BasicEffects in Mesh?

    When we use the following code, why do we loop through the effects in the mesh. I don't really need to know this but I feel like learning a bit more. If you can help, I'm all two ears. Thanks☺

     

    foreach (ModelMesh mesh in myModel.Meshes)
    {
    foreach (BasicEffect effect in mesh.Effects)
    {
    //Draw code
    }
    mesh.Draw();
    }
    I work for Him, in His government, as an agent, of grace.
  • 05/10/2007 21:26 In reply to

    Re: Why Do We Loop Through BasicEffects in Mesh?

    Answer
    Reply Quote
    There could be several effects used on different parts of a single mesh. For instance one part of it might use a different texture to another, or have different lighting settings. You need the loop in order to make sure that all of these effects are correctly set up before you draw the geometry.
    XNA Framework Developer - blog - homepage
  • 05/10/2007 22:45 In reply to

    Re: Why Do We Loop Through BasicEffects in Mesh?

    Ok, thanks. I probably weigh about .002 more pounds more because I am smarter.
    I work for Him, in His government, as an agent, of grace.
Page 1 of 1 (3 items) Previous Next