public void TestEditorMeshPartRenderDataSimple()
        {
            EditorMeshPart eMeshPart = new EditorMeshPart(null);

            eMeshPart.GeometryData = MeshPartGeometryData.CreateTestSquare();

            XNAGame                  game       = new XNAGame();
            ColladaShader            shader     = null;
            EditorMeshPartRenderData renderData = null;


            game.InitializeEvent +=
                delegate
            {
                renderData = new EditorMeshPartRenderData(eMeshPart);
                renderData.Initialize(game);

                shader = new ColladaShader(game, null);

                shader.DiffuseColor   = Color.Red.ToVector4();
                shader.SpecularColor  = Color.Green.ToVector4();
                shader.LightDirection = new Vector3(0, 0, -1);
                shader.Shininess      = 1;
            };

            game.DrawEvent +=
                delegate
            {
                game.GraphicsDevice.RenderState.CullMode = Microsoft.Xna.Framework.Graphics.CullMode.None;
                shader.World          = Matrix.Identity;
                shader.ViewInverse    = game.Camera.ViewInverse;
                shader.ViewProjection = game.Camera.ViewProjection;
                shader.RenderPrimitiveSinglePass(renderData, Microsoft.Xna.Framework.Graphics.SaveStateMode.None);
            };

            game.Run();
        }
        public void TestEditorMeshPartRenderDataAdvanced()
        {
            List <EditorMeshPart> parts = new List <EditorMeshPart>();

            TheWizards.WorldDatabase.WorldDatabase db = new MHGameWork.TheWizards.WorldDatabase.WorldDatabase(
                System.Windows.Forms.Application.StartupPath + "\\Test\\EntityEditor\\TestEMPRDAdvanced");
            ColladaMeshImporter importer = new ColladaMeshImporter(db);


            COLLADA collada;
            List <EditorMeshPart> meshParts;

            collada = COLLADA.FromStream(ColladaFiles.GetSimplePlaneDAE());
            parts.AddRange(importer.ImportMeshParts(collada));

            collada = COLLADA.FromStream(ColladaFiles.GetAdvancedScene001DAE());
            parts.AddRange(importer.ImportMeshParts(collada));

            collada = COLLADA.FromStream(ColladaFiles.GetTeapot001DAE());
            parts.AddRange(importer.ImportMeshParts(collada));


            XNAGame       game   = new XNAGame();
            ColladaShader shader = null;
            List <EditorMeshPartRenderData> renderDatas = new List <EditorMeshPartRenderData>();


            game.InitializeEvent +=
                delegate
            {
                for (int i = 0; i < parts.Count; i++)
                {
                    EditorMeshPartRenderData renderData = new EditorMeshPartRenderData(parts[i]);
                    renderData.Initialize(game);
                    renderDatas.Add(renderData);
                }


                shader = new ColladaShader(game, null);

                shader.DiffuseColor   = Color.Red.ToVector4();
                shader.SpecularColor  = Color.White.ToVector4();
                shader.LightDirection = Vector3.Normalize(new Vector3(0, 0, 1));
                shader.Shininess      = 20;
            };

            game.DrawEvent +=
                delegate
            {
                game.GraphicsDevice.RenderState.CullMode = Microsoft.Xna.Framework.Graphics.CullMode.None;

                shader.ViewProjection = game.Camera.ViewProjection;
                shader.ViewInverse    = game.Camera.ViewInverse;

                for (int i = 0; i < renderDatas.Count; i++)
                {
                    shader.World = Matrix.CreateRotationX(-MathHelper.PiOver2) * Matrix.CreateTranslation(Vector3.UnitX * (-100 + 40 * i));
                    shader.RenderPrimitiveSinglePass(renderDatas[i], Microsoft.Xna.Framework.Graphics.SaveStateMode.None);
                }
            };

            game.Run();
        }