Ejemplo n.º 1
0
        /// <summary>
        /// Overridden function to create the shape instance
        /// </summary>
        /// <returns></returns>
        public override ShapeBase CreateShapeInstance()
        {
            CustomVolumeShape shape = new CustomVolumeShape("Custom Volume Shape", false);

            shape.Position = EditorManager.Scene.CurrentShapeSpawnPosition;
            EditorManager.ActiveView.CurrentContext = new AddVolumeVertexContext(shape);
            return(shape);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Overridden clone function
        /// </summary>
        /// <returns></returns>
        public override ShapeBase Clone()
        {
            CustomVolumeVertex.IsVolumeCloning = true;
            CustomVolumeShape clone = (CustomVolumeShape)base.Clone();

            CustomVolumeVertex.IsVolumeCloning = false;
            clone._hotSpotNewNodes             = null;
            clone._hotSpotHeight = null;

            return(clone);
        }
Ejemplo n.º 3
0
        public override void CreateEngineInstance(bool bCreateChildren)
        {
            base.CreateEngineInstance(bCreateChildren);

            _lastParent = (CustomVolumeShape)Parent;

            if (_engineInstance == null)
            {
                Debug.Assert(Parent != null, "Need a parent to create the engine instance");
                _engineInstance = new EngineInstanceCustomVolumeVertex((Shape3D)Parent);
                _engineInstance.SetPosition(Position.X, Position.Y, Position.Z);
            }
        }
Ejemplo n.º 4
0
 public AddVolumeVertexContext(CustomVolumeShape shape)
 {
     this.AllowShapeSelection = false;
       this.AllowRecenterMouse = false;
       _shape = shape;
       _contextDialog = new CreateCustomVolumeDlg();
       _contextDialog.Show(EditorManager.ActiveView);
       _contextDialog.FormClosed += new FormClosedEventHandler(FormClosed);
       IScene.ShapeChanged += new ShapeChangedEventHandler(ShapeChanged);
       IScene.PropertyChanged += new CSharpFramework.PropertyChangedEventHandler(PropertyChanged);
       EditorManager.BeforeSceneClosing += new BeforeSceneClosing(SceneClosing);
       EditorManager.SceneEvent += new SceneEventHandler(EditorManager_SceneEvent);
       EditorManager.ActiveView.Focus();
 }
Ejemplo n.º 5
0
 public AddVolumeVertexContext(CustomVolumeShape shape)
 {
     this.AllowShapeSelection = false;
     this.AllowRecenterMouse  = false;
     _shape         = shape;
     _contextDialog = new CreateCustomVolumeDlg();
     _contextDialog.Show(EditorManager.ActiveView);
     _contextDialog.FormClosed        += new FormClosedEventHandler(FormClosed);
     IScene.ShapeChanged              += new ShapeChangedEventHandler(ShapeChanged);
     IScene.PropertyChanged           += new CSharpFramework.PropertyChangedEventHandler(PropertyChanged);
     EditorManager.BeforeSceneClosing += new BeforeSceneClosing(SceneClosing);
     EditorManager.SceneEvent         += new SceneEventHandler(EditorManager_SceneEvent);
     EditorManager.ActiveView.Focus();
 }
        public void TestVolumeCreation()
        {
            TestManager.Helpers.OpenSceneFromFile(Path.Combine(TestManager.Helpers.TestDataDir, @"CustomVolumeShapeTests\empty.scene"));

              CustomVolumeShape volume = new CustomVolumeShape();
              Layer layer = EditorManager.Scene.ActiveLayer;
              EditorManager.Actions.Add(new AddShapeAction(volume, null, layer, false));
              volume.Preview = true;

              AddVolumeVertex(volume, new Vector3F(-200.0f, -200.0f, -136.0f));
              EditorManager.ActiveView.UpdateView(true);
              AddVolumeVertex(volume, new Vector3F( 200.0f, -200.0f, -136.0f));
              EditorManager.ActiveView.UpdateView(true);
              AddVolumeVertex(volume, new Vector3F( 200.0f,  200.0f, -136.0f));
              EditorManager.ActiveView.UpdateView(true);
              AddVolumeVertex(volume, new Vector3F(   0.0f,  250.0f, -136.0f));
              EditorManager.ActiveView.UpdateView(true);
              AddVolumeVertex(volume, new Vector3F(-200.0f,  200.0f, -136.0f));
              EditorManager.ActiveView.UpdateView(true);

              volume.Height = 100.0f;
              EditorManager.ActiveView.UpdateView(true);

              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.EditorMode = EditorManager.Mode.EM_PLAYING_IN_EDITOR;
              for (int i = 0; i < 30; i++)
              {
            EditorManager.EngineManager.WriteText2D(10.0f, 10.0f, "Play in editor", VisionColors.White);
            EditorManager.ActiveView.UpdateView(true);
              }
              EditorManager.EditorMode = EditorManager.Mode.EM_NONE;

              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();
        }
        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;
        }
 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.º 9
0
 /// <summary>
 /// Overridden function to create the shape instance
 /// </summary>
 /// <returns></returns>
 public override ShapeBase CreateShapeInstance()
 {
     CustomVolumeShape shape = new CustomVolumeShape("Custom Volume Shape", false);
       shape.Position = EditorManager.Scene.CurrentShapeSpawnPosition;
       EditorManager.ActiveView.CurrentContext = new AddVolumeVertexContext(shape);
       return shape;
 }
Ejemplo n.º 10
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="owner">the owning CustomVolumeShape</param>
 /// <param name="insert">at which place to insert</param>
 public HotSpotAddVolumeVertex( CustomVolumeShape owner, int insert)
     : base(owner, @"Textures\Hotspot_add.dds", VisionColors.RGBA(255, 255, 255, 180), VisionColors.White, 8.0f)
 {
     _insert = insert;
 }
Ejemplo n.º 11
0
        public override void CreateEngineInstance(bool bCreateChildren)
        {
            base.CreateEngineInstance(bCreateChildren);

              _lastParent = (CustomVolumeShape)Parent;

              if (_engineInstance == null)
              {
            Debug.Assert(Parent != null, "Need a parent to create the engine instance");
            _engineInstance = new EngineInstanceCustomVolumeVertex((Shape3D)Parent);
            _engineInstance.SetPosition(Position.X, Position.Y, Position.Z);
              }
        }
Ejemplo n.º 12
0
 /// <summary>
 /// constructor
 /// </summary>
 /// <param name="owner">the owning CustomVolumeShape</param>
 /// <param name="insert">at which place to insert</param>
 public HotSpotAddVolumeVertex(CustomVolumeShape owner, int insert)
     : base(owner, @"Textures\Hotspot_add.dds", VisionColors.RGBA(255, 255, 255, 180), VisionColors.White, 8.0f)
 {
     _insert = insert;
 }