Ejemplo n.º 1
0
        void AddVolumeVertex(CustomVolumeShape volume, Vector3F position)
        {
            CustomVolumeVertex vertex = new CustomVolumeVertex();

            EditorManager.Actions.Add(AddShapeAction.CreateAddShapeAction(vertex, volume, volume.ParentLayer, true));
            vertex.CreateEngineInstance(true);
            vertex.Position = position;
        }
Ejemplo n.º 2
0
        public void TestVolumeStaticMesh()
        {
            TestManager.Helpers.OpenSceneFromFile(Path.Combine(TestManager.Helpers.TestDataDir, @"CustomVolumeShapeTests\empty.scene"));

            CustomVolumeShape volume = new CustomVolumeShape();
            Layer             layer  = EditorManager.Scene.ActiveLayer;

            EditorManager.Actions.Add(AddShapeAction.CreateAddShapeAction(volume, null, layer, false));
            volume.Preview          = true;
            volume.CustomStaticMesh = true;
            volume.StaticMeshPath   = "Meshes\\kugel.vmesh";
            volume.Scaling          = new Vector3F(20.0f, 20.0f, 20.0f);

            DynLightShape light = new DynLightShape("test light");

            light.LightType = LightSourceType_e.Point;
            light.Position  = EditorManager.Scene.CurrentShapeSpawnPosition;
            EditorManager.Actions.Add(AddShapeAction.CreateAddShapeAction(light, null, layer, false));

            ShapeComponent component = CreateLightClippingComponent(volume);

            EditorManager.Actions.Add(new AddShapeComponentAction(light, component));

            for (int i = 0; i < 60; i++)
            {
                EditorManager.ActiveView.UpdateView(true);
            }

            bool success = EditorManager.Scene.SaveAs("volume.scene");

            Assert.IsTrue(success);
            EditorManager.Scene.Close();
            TestManager.Helpers.OpenSceneFromFile(Path.Combine(TestManager.Helpers.TestDataDir, @"CustomVolumeShapeTests\volume.scene"));

            for (int i = 0; i < 60; i++)
            {
                EditorManager.EngineManager.WriteText2D(10.0f, 10.0f, "This is the saved version", VisionColors.White);
                EditorManager.ActiveView.UpdateView(true);
            }

            EditorManager.Scene.ExportScene(null, null);
            EditorManager.Scene.Close();
            EditorManager.Scene = null;
            TestManager.Helpers.LoadExportedScene("volume.vscene");
            for (int i = 0; i < 60; i++)
            {
                EditorManager.EngineManager.WriteText2D(10.0f, 10.0f, "This is the exported version", VisionColors.White);
                EditorManager.ActiveView.UpdateView(true);
            }

            EditorManager.EditorMode = EditorManager.Mode.EM_NONE;
            TestManager.Helpers.CloseExportedScene();
            TestManager.Helpers.CloseActiveProject();
        }
Ejemplo n.º 3
0
        ShapeComponent CreateLightClippingComponent(CustomVolumeShape volume)
        {
            ShapeComponentType t = (ShapeComponentType)EditorManager.EngineManager.ComponentClassManager.GetCollectionType("VLightClippingVolumeComponent");

            Assert.IsNotNull(t);
            if (t == null)
            {
                return(null);
            }

            ShapeComponent comp = (ShapeComponent)t.CreateInstance(null);

            comp.SetPropertyValue("Volume", volume);

            return(comp);
        }