public void TestPutObjectsTool() { SceneEditor editor = new SceneEditor(new EditorScene()); PutObjectsTool tool = new PutObjectsTool(editor); EditorObject eObj = new EditorObject(); eObj.AddMeshFromCollada(COLLADA.FromStream(ColladaFiles.GetPyramid001DAE())); eObj.Name = "Wall001"; //eObj.Save(); tool.SelectedPutObject = eObj; editor.ActivateTool(tool); // SceneEditorTest.RunSceneEditorTestEnvironment(editor); }
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(); }