/// <summary> /// Initialize our editor /// </summary> /// <remarks> /// -Called from the form constructor so that the mainform is /// available when the plugins are initialized /// </remarks> public static void InitEditorApp(Form mainForm) { EditorManager.MainForm = mainForm; // set the asset profile first because everything from here on already needs file access ManagedBase.AssetHelper.SetAssetProfile("vForge", "vForge"); ManagedBase.AssetHelper.AddVariantKey("vForge"); ManagedBase.AssetHelper.AddVariantKey("android-default"); ManagedBase.FileAccessManager.Initialize(); // add the default shapes from the editor EditorManager.ShapeCreatorPlugins.Add(new GroupCreator()); EditorManager.ShapeCreatorPlugins.Add(new Group3DShapeCreator()); EditorManager.ShapeCreatorPlugins.Add(new AnchorShapeCreator()); //Initialize the editor manager //EditorManager.InitPlugins(Application.StartupPath); // do this later... EditorManager.SceneChanged += new SceneChangedEventHandler(EditorManager_SceneChanged); IProject.NewProjectLoaded += new EventHandler(IProject_ProjectChanged); IProject.ProjectUnloaded += new EventHandler(IProject_ProjectChanged); EditorManager.ProcessExternalFileDrop += new ExternalFileDropHandler(EditorManager_ProcessExternalFileDrop); EditorManager.EditorModeChanged += new EditorModeChangedEventHandler(EditorManager_EditorModeChanged); _visionEngine = new VisionEngineManager(); EditorManager.EngineManager = _visionEngine; EditorManager.ShapeFactory = new VForgeShapeFactory(); EditorManager.SceneFactory = new EditorSceneFactory(); EditorManager.ProjectFactory = new EditorProjectFactory(); EditorManager.LayerFactory = new EditorLayerFactory(); EditorManager.ZoneFactory = new EditorZoneFactory(); EditorManager.AddShapeActionFactory = new EditorAddShapeActionFactory(); EditorManager.RemoveShapeActionFactory = new EditorRemoveShapeActionFactory(); EditorManager.AddShapesActionFactory = new EditorAddShapesActionFactory(); EditorManager.RemoveShapesActionFactory = new EditorRemoveShapesActionFactory(); EditorManager.SetPropertyActionFactory = new EditorSetPropertyActionFactory(); EditorManager.SkyConfigChangedActionFactory = new EditorSkyConfigChangedActionFactory(); EditorManager.VisibilityBuilder = new VisionVisibilityBuilder(); EditorManager.AppInterface = new EditorAppInterface(); EditorManager.AssetManager = new AssetManager(); EditorManager.ProfileManager = new ProfileManager(); (EditorManager.ProfileManager as ProfileManager).InitEventHandler(); (EditorManager.AssetManager as AssetManager).InitEventHandler(); EditorManager.RendererNodeManager = new VisionRendererNodeManager(); EditorManager.FileLockFactory = new DefaultDiskLockFactory(); // Create the test helper utilities TestManager.Helpers = new EditorTests.TestHelpers(); UpdateTitleBar(); }
public void TestShadingModes() { CommonSubtestInit(@"HavokBinding\JointMuseum.scene"); int iFrameCount = 1000; VisionEngineManager em = (VisionEngineManager)EditorManager.EngineManager; StringCollection names = new StringCollection(); em.GetReplacementRenderLoopEffects(names); // render frames for (int iMode = 0; iMode < names.Count; iMode++) { em.SetReplacementRenderLoopEffect(iMode); for (int i = 0; i < iFrameCount; i++) { EditorManager.EngineManager.WriteText2D(10.0f, 10.0f, "Shading mode is now: " + names[iMode], VisionColors.White); EditorManager.ActiveView.UpdateView(true); } } em.SetReplacementRenderLoopEffect(-1); CommonSubtestDeInit(); }
/// <summary> /// Initialize our editor /// </summary> /// <remarks> /// -Called from the form constructor so that the mainform is /// available when the plugins are initialized /// </remarks> public static void InitEditorApp(Form mainForm) { EditorManager.MainForm = mainForm; // set the asset profile first because everything from here on already needs file access ManagedBase.AssetHelper.SetAssetProfile("vForge", "vForge"); ManagedBase.AssetHelper.AddVariantKey("vForge"); // add the default shapes from the editor EditorManager.ShapeCreatorPlugins.Add(new GroupCreator()); EditorManager.ShapeCreatorPlugins.Add(new Group3DShapeCreator()); EditorManager.ShapeCreatorPlugins.Add(new AnchorShapeCreator()); //Initialize the editor manager //EditorManager.InitPlugins(Application.StartupPath); // do this later... EditorManager.SceneChanged +=new SceneChangedEventHandler(EditorManager_SceneChanged); IProject.NewProjectLoaded += new EventHandler(IProject_ProjectChanged); IProject.ProjectUnloaded += new EventHandler(IProject_ProjectChanged); EditorManager.ProcessExternalFileDrop += new ExternalFileDropHandler(EditorManager_ProcessExternalFileDrop); EditorManager.EditorModeChanged += new EditorModeChangedEventHandler(EditorManager_EditorModeChanged); _visionEngine = new VisionEngineManager(); EditorManager.EngineManager = _visionEngine; EditorManager.ShapeFactory = new VForgeShapeFactory(); EditorManager.SceneFactory = new EditorSceneFactory(); EditorManager.ProjectFactory = new EditorProjectFactory(); EditorManager.LayerFactory = new EditorLayerFactory(); EditorManager.ZoneFactory = new EditorZoneFactory(); EditorManager.AddShapeActionFactory = new EditorAddShapeActionFactory(); EditorManager.RemoveShapeActionFactory = new EditorRemoveShapeActionFactory(); EditorManager.AddShapesActionFactory = new EditorAddShapesActionFactory(); EditorManager.RemoveShapesActionFactory = new EditorRemoveShapesActionFactory(); EditorManager.SetPropertyActionFactory = new EditorSetPropertyActionFactory(); EditorManager.SkyConfigChangedActionFactory = new EditorSkyConfigChangedActionFactory(); EditorManager.VisibilityBuilder = new VisionVisibilityBuilder(); EditorManager.AppInterface = new EditorAppInterface(); EditorManager.AssetManager = new AssetManager(); EditorManager.ProfileManager = new ProfileManager(); (EditorManager.ProfileManager as ProfileManager).InitEventHandler(); (EditorManager.AssetManager as AssetManager).InitEventHandler(); EditorManager.RendererNodeManager = new VisionRendererNodeManager(); EditorManager.FileLockFactory = new DefaultDiskLockFactory(); // Create the test helper utilities TestManager.Helpers = new TestHelpers(); UpdateTitleBar(); }
void LightAndRunScene(string sceneName) { string vsceneName = Path.ChangeExtension(Path.GetFileName(sceneName), ".vscene"); DeleteLitFileForScene(sceneName); // before the scene starts CommonSubtestInit(sceneName); int iFrameCount = 2000; VisionEngineManager em = (VisionEngineManager)EditorManager.EngineManager; StringCollection names = new StringCollection(); em.GetReplacementRenderLoopEffects(names); int iLightShading = names.IndexOf("Lighting Only"); Assert.IsTrue(iLightShading >= 0, "Lighting only shading not available"); // render frames EditorManager.Scene.ResetStaticLighting(); for (int i = 0; i < iFrameCount; i++) { EditorManager.EngineManager.WriteText2D(10.0f, 10.0f, "Unlit version of the scene", VisionColors.White); EditorManager.ActiveView.UpdateView(true); } // get the currently set lighting tool (might be Beast or something) IStaticLightingTool lt = EditorManager.LightingTool; // set vLux as the current tool EditorManager.LightingTool = new Editor.VLux.VLuxLightingTool(); Assert.IsTrue(EditorApp.Scene.UpdateStaticLighting(false, null, true)); // without dialog // reset to the original lighting tool EditorManager.LightingTool = lt; for (int i = 0; i < iFrameCount; i++) { EditorManager.EngineManager.WriteText2D(10.0f, 10.0f, "..after vLux lighting", VisionColors.White); EditorManager.ActiveView.UpdateView(true); } em.SetReplacementRenderLoopEffect(iLightShading); for (int i = 0; i < iFrameCount; i++) { EditorManager.EngineManager.WriteText2D(10.0f, 10.0f, "..after vLux lighting light shading only", VisionColors.White); EditorManager.ActiveView.UpdateView(true); } em.SetReplacementRenderLoopEffect(-1); // now export and see whether projector looks identically EditorManager.Scene.ExportScene(null, null); EditorManager.Scene.Close(); TestManager.Helpers.LoadExportedScene(vsceneName); for (int i = 0; i < iFrameCount; i++) { EditorManager.EngineManager.WriteText2D(10.0f, 10.0f, "This is the exported version", VisionColors.White); EditorManager.ActiveView.UpdateView(true); } TestManager.Helpers.CloseExportedScene(); // reload the scene CommonSubtestInit(sceneName); // render frames EditorManager.Scene.ResetStaticLighting(); for (int i = 0; i < iFrameCount; i++) { EditorManager.EngineManager.WriteText2D(10.0f, 10.0f, "Unlit version of the scene (again)", VisionColors.White); EditorManager.ActiveView.UpdateView(true); } // export again to restore SVN files EditorManager.Scene.ExportScene(null, null); CommonSubtestDeInit(); }