public AddBillboardAction(BillboardGroupShape shape, BillboardInstance newInst)
     : base(shape,"Instances",null)
 {
     BillboardInstance[] _newArr = new BillboardInstance[shape.Instances.Length + 1];
       for (int i = 0; i < shape.Instances.Length; i++)
     _newArr[i] = shape.Instances[i];
       _newArr[_newArr.Length - 1] = newInst;
       this._newValue = _newArr;
 }
 protected BillboardDropToFloorAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _instances = (BillboardInstance[])info.GetValue("_instances", typeof(BillboardInstance[]));
       _shape = (BillboardGroupShape)info.GetValue("_shape", typeof(BillboardGroupShape));
       _mode = (Shape3D.DropToFloorMode)info.GetValue("_mode", typeof(Shape3D.DropToFloorMode));
       _oldHeights = (float[])info.GetValue("_oldHeights", typeof(float[]));
       _newHeights = (float[])info.GetValue("_newHeights", typeof(float[]));
 }
 /// <summary>
 /// Overridden function to create the shape instance
 /// </summary>
 /// <returns></returns>
 public override ShapeBase CreateShapeInstance()
 {
     BillboardGroupShape shape = new BillboardGroupShape("Billboard Group");
       shape.Position = EditorManager.Scene.CurrentShapeSpawnPosition;
       return shape;
 }
        public BillboardDropToFloorAction(BillboardGroupShape shape, BillboardInstance[] instances, Shape3D.DropToFloorMode mode, Vector3F axis, ShapeCollection colliderShapes)
        {
            _instances = instances;
              if (_instances == null)
            _instances = shape.Instances;

              _shape = shape;
              _mode = mode;
              _oldHeights = new float[_instances.Length];
              _newHeights = new float[_instances.Length];

              for (int i = 0; i < _instances.Length; i++)
            _oldHeights[i] = _instances[i].Z;
              _shape.EngineMesh.GetDropToFloorHeights(_shape, _instances, _mode, axis, colliderShapes);
              for (int i = 0; i < _instances.Length; i++)
            _newHeights[i] = _instances[i].Z;
        }
 public ScaleBillboardAction(BillboardGroupShape shape, BillboardInstance inst, float oldSX, float oldSY, float newSX, float newSY)
 {
     _inst = inst;
       _shape = shape;
       _oldSX = oldSX;
       _oldSY = oldSY;
       _newSX = newSX;
       _newSY = newSY;
 }
 protected ScaleBillboardAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _shape = (BillboardGroupShape)info.GetValue("_shape", typeof(BillboardGroupShape));
       _inst = (BillboardInstance)info.GetValue("_inst", typeof(BillboardInstance));
       _oldSX = info.GetSingle("_oldSX");
       _oldSY = info.GetSingle("_oldSY");
       _newSX = info.GetSingle("_newSX");
       _newSY = info.GetSingle("_newSY");
 }
        public RemoveBillboardAction(BillboardGroupShape shape, BillboardInstance[] sel)
            : base(shape, "Instances", null)
        {
            _shape = shape;
              _sel = sel;
              BillboardInstance[] _newArr = new BillboardInstance[shape.Instances.Length - sel.Length];
              int j = 0;
              for (int i = 0; i < shape.Instances.Length; i++)
            if (!SelectionContains(shape.Instances[i]))
              _newArr[j++] = shape.Instances[i];

              this._newValue = _newArr;
        }
 protected RemoveBillboardAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _shape = (BillboardGroupShape)info.GetValue("_shape", typeof(BillboardGroupShape));
       _sel = (BillboardInstance[])info.GetValue("_sel", typeof(BillboardInstance[]));
 }
 protected MoveBillboardAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _shape = (BillboardGroupShape)info.GetValue("_shape", typeof(BillboardGroupShape));
       _inst = (BillboardInstance)info.GetValue("_inst", typeof(BillboardInstance));
       _oldPos = (Vector3F)info.GetValue("_oldPos", typeof(Vector3F));
       _newPos = (Vector3F)info.GetValue("_newPos", typeof(Vector3F));
 }
 public RecenterBillboardsAction(BillboardGroupShape shape)
     : base(shape,null,"Re-center billboard group")
 {
     BoundingBox bbox = shape.AbsoluteBoundingBox;
       Vector3F center = bbox.Center;
       _oldPos = shape.Position;
       _newPos = center;
       Vector3F delta = _oldPos - _newPos;
       foreach (BillboardInstance b in NewInstances)
       {
     b.X += delta.X;
     b.Y += delta.Y;
     b.Z += delta.Z;
       }
 }
 public MoveBillboardAction(BillboardGroupShape shape, BillboardInstance inst, Vector3F oldPos, Vector3F newPos)
 {
     _oldPos = oldPos;
       _newPos = newPos;
       _inst = inst;
       _shape = shape;
 }
 protected ModifyBillboardsAction(SerializationInfo info, StreamingContext context)
     : base(info, context)
 {
     _shape = (BillboardGroupShape)info.GetValue("_shape", typeof(BillboardGroupShape));
       _name = info.GetString("_name");
       NewInstances = (BillboardInstance[])info.GetValue("NewInstances", typeof(BillboardInstance[]));
       oldInst = (BillboardInstance[])info.GetValue("oldInst", typeof(BillboardInstance[]));
       _remapping = (int[])info.GetValue("_remapping", typeof(int[]));
 }
        public ModifyBillboardsAction(BillboardGroupShape shape, BillboardInstance[] sel, string name)
        {
            if (sel==null)
            sel = shape.Instances;

              _name = name;
              _shape = shape;

              oldInst = new BillboardInstance[sel.Length];
              NewInstances = new BillboardInstance[sel.Length];
              _remapping = new int[sel.Length];

              // build a mapping table of indices where to replace the list of all instances
              for (int i = 0; i < sel.Length; i++)
              {
            _remapping[i] = IndexInInstances(sel[i]);
            oldInst[i] = sel[i];
            NewInstances[i] = (BillboardInstance)oldInst[i].Clone();
              }
        }
        public HotSpotBillboardSize(BillboardGroupShape shape, BillboardInstance inst, bool bHoriz)
            : base(shape, @"textures\Hotspot_R.dds", VisionColors.Yellow, PickType.Square, 4.0f)
        {
            _inst = inst;
              _bHoriz = bHoriz;
              TextureAtlas.AtlasEntry atlas = shape.Atlas.GetRandomEntry(inst._fAtlasValue);

              if (_bHoriz)
              {
            StartDistance = inst.ScaleX; // so we can use it directly for scaling
            DisplayScaling = shape.BaseSizeX * 0.5f * atlas.ResultingScaleX;
              }
              else
              {
            StartDistance = inst.ScaleY; // so we can use it directly for scaling
            DisplayScaling = shape.BaseSizeY * 1.0f * atlas.ResultingScaleY;
              }
              this.CurrentPosition = new Vector3F(_inst.X, _inst.Y, _inst.Z);
        }
 public HotSpotBillboardMove(BillboardGroupShape shape, BillboardInstance inst)
     : base(shape, shape.BaseSizeX * 0.25f)
 {
     _inst = inst;
       this.CurrentPosition = new Vector3F(_inst.X, _inst.Y, _inst.Z);
 }