public void TestColladaImportMeshParts()
        {
            TheWizards.WorldDatabase.WorldDatabase db =
                new MHGameWork.TheWizards.WorldDatabase.WorldDatabase(System.Windows.Forms.Application.StartupPath +
                                                                      "\\Test\\Entity\\Editor\\ImportMeshParts");
            ColladaMeshImporter importer = new ColladaMeshImporter(db);

            COLLADA collada;
            List <EditorMeshPart> meshParts;

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

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

            collada   = COLLADA.FromStream(ColladaFiles.GetTeapot001DAE());
            meshParts = importer.ImportMeshParts(collada);
        }
        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();
        }