Пример #1
0
        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();
        }
Пример #2
0
        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();
        }