Ejemplo n.º 1
0
            /// <summary>
            /// Render all meshes that use this technique sorted by the materials.
            /// This method is only called if we got any meshes to render,
            /// which is determinated if NumberOfRenderMeshes is greater 0.
            /// </summary>
            /// <param name="effect">Effect</param>
            public void Render(Effect effect)
            {
                // Start effect for this technique
                effect.CurrentTechnique = technique;
                try
                {
                    effect.Begin(SaveStateMode.None);

                    // Render all pass (we always just have one)
                    EffectPass pass = effect.CurrentTechnique.Passes[0];

                    pass.Begin();
                    // Render all meshes sorted by all materials.
                    for (int listNum = 0; listNum < meshesPerMaterials.Count; listNum++)
                    {
                        MeshesPerMaterial list = meshesPerMaterials[listNum];
                        if (list.NumberOfRenderMatrices > 0)
                        {
                            list.Render();
                        }
                    }
                    pass.End();
                }
                finally
                {
                    // End shader
                    effect.End();
                }
            }
            }             // Add(addMesh)

            #endregion

            #region Render
            /// <summary>
            /// Render all meshes that use this technique sorted by the materials.
            /// This method is only called if we got any meshes to render,
            /// which is determinated if NumberOfRenderMeshes is greater 0.
            /// </summary>
            /// <param name="effect">Effect</param>
            public void Render(Effect effect)
            {
                // Start effect for this technique
                effect.CurrentTechnique = technique;
                effect.Begin(SaveStateMode.None);

                // Render all pass (we always just have one)
                //obs: foreach (EffectPass pass in effect.CurrentTechnique.Passes)
                {
                    EffectPass pass = effect.CurrentTechnique.Passes[0];

                    pass.Begin();
                    // Render all meshes sorted by all materials.
                    //obs: foreach (MeshesPerMaterial list in meshesPerMaterials)
                    for (int listNum = 0; listNum < meshesPerMaterials.Count; listNum++)
                    {
                        MeshesPerMaterial list = meshesPerMaterials[listNum];
                        if (list.NumberOfRenderMatrices > 0)
                        {
                            list.Render();
                        }
                    }             // for (listNum)
                    pass.End();
                }                 // foreach (pass)

                // End shader
                effect.End();
            }             // Render(effect)
Ejemplo n.º 3
0
            /// <summary>
            /// Render all meshes that use this technique sorted by the materials.
            /// This method is only called if we got any meshes to render,
            /// which is determinated if NumberOfRenderMeshes is greater 0.
            /// </summary>
            /// <param name="effect">Effect</param>
            public void Render(Effect effect)
            {
                // Start effect for this technique
                effect.CurrentTechnique = technique;


                // Render all pass (we always just have one)
                EffectPass pass = effect.CurrentTechnique.Passes[0];

                pass.Apply();
                // Render all meshes sorted by all materials.
                for (int listNum = 0; listNum < meshesPerMaterials.Count; listNum++)
                {
                    MeshesPerMaterial list = meshesPerMaterials[listNum];
                    if (list.NumberOfRenderMatrices > 0)
                    {
                        list.Render();
                    }
                }
            }