public Color GetNodeColor(LEDNode node, IColorEffect colorEffect)
        {
            if (_applyBackground && colorEffect == StartColor)
                return new Color() {A = (byte)(255*3/4)};

            return _colorApplier.GetNodeColor(node, colorEffect);
        }
Ejemplo n.º 2
0
        protected override IColorEffect ApplyCycle(TimeRange range, LEDNode ledNode)
        {
            double pos = Tween.GetValue(range.Current);

            if (Ordering.GetLEDPosition(ledNode) <= pos)
                return _endColorEffect;

            return _startColorEffect;
        }
Ejemplo n.º 3
0
        public Color SetColor(TimeRange range, double position, LEDNode led)
        {
            double pct = range.Portion * (Colors.Count-1);
            int start = (int)Math.Floor(pct);
            int end = (int) Math.Ceiling(pct);
            double diff = pct - start;
            Color color = ColorUtil.Interpolate(Colors[start], Colors[end], diff);

            return color;
        }
Ejemplo n.º 4
0
        public Color SetColor(TimeRange range, double position, LEDNode led)
        {
            //get our position in space
            double posOffset = position*Width;
            //get our position in time
            double timeOffset = range.PortionTotal*_ref.Width - range.PortionTotal*Width;
            double xPosition = (posOffset + timeOffset)/_ref.Width;
            double yPosition = Ordering.GetAngle(led);

            return _ref.GetValueAt(xPosition,yPosition);
        }
Ejemplo n.º 5
0
        protected override IColorEffect ApplyCycle(TimeRange range, LEDNode ledNode)
        {
            double pos = Tween.GetValue(range.Current);

            double rangeStart = pos - _width/2;
            double rangeEnd = pos + _width/2;
            double ledPos = Ordering.GetLEDPosition(ledNode);

            if(ledPos < rangeStart || ledPos > rangeEnd)
                return _backgroundColor;

            return _pulseColor;
        }
        public static LightAddress AddLED(LEDNode node)
        {
            if (_nodes.ContainsKey(node.Address))
                throw new ArgumentException("Node with address '" + node.Address + "' already exists.");
            if (node.Address.IsUnknown)
            {
                node = new LEDNode(new LightAddress(-1,-1, _unaddressed++), node.Position );
            }

            _nodes.Add(node.Address, node);
            LightsUpdated(true);
            return node.Address;
        }
 public static IList<LightAddress> AddLEDs(IEnumerable<LEDNode> nodes)
 {
     IList<LightAddress> addresses = new List<LightAddress>();
     foreach (LEDNode node in nodes)
     {
         LEDNode uNode = node;
         if (node.Address.IsUnknown)
         {
             uNode = new LEDNode(new LightAddress(-1,-1, _unaddressed++), node.Position );
         }
         _nodes.Add(uNode.Address, uNode);
         addresses.Add(uNode.Address);
     }
     LightsUpdated(true);
     return addresses;
 }
Ejemplo n.º 8
0
 public Color GetNodeColor(LEDNode node, IColorEffect colorEffect)
 {
     double position = (_effect.Ordering.GetLEDPosition(node) - OrderingMin) / OrderingSize;
     return colorEffect.SetColor(Range, position, node);
 }
 public IColorEffect GetEffect(LEDNode node)
 {
     return _nodeApplier.GetEffect(node);
 }
Ejemplo n.º 10
0
 public Color SetColor(TimeRange range, double position, LEDNode led)
 {
     return Colors[(int)(range.Portion*Colors.Count)];
 }
Ejemplo n.º 11
0
 public double GetLEDPosition(LEDNode ledNode)
 {
     var address = ledNode.Address;
     double pos = Position(_addressToPos[address], 0, _last);
     return pos;
 }
Ejemplo n.º 12
0
 public double GetAngle(LEDNode node)
 {
     return 0;
 }
Ejemplo n.º 13
0
 protected override IColorEffect ApplyCycle(TimeRange range, LEDNode ledNode)
 {
     return _colorEffect;
 }
Ejemplo n.º 14
0
 public bool InGroup(LEDNode node)
 {
     return _me.InGroup(node);
 }
Ejemplo n.º 15
0
 public IColorEffect GetEffect(LEDNode node)
 {
     if (_effect._group.InGroup(node))
     {
         return _effect.ApplyCycle(Range, node);
     }
     return null;
 }
Ejemplo n.º 16
0
 protected abstract IColorEffect ApplyCycle(TimeRange range, LEDNode ledNode);
Ejemplo n.º 17
0
 public bool InGroup(LEDNode node)
 {
     return _addresSet.Contains(node.Address);
 }
Ejemplo n.º 18
0
 private bool WriteForeground(LEDNode light, Color color)
 {
     light.Color = ColorUtil.Interpolate(color, light.Color);
     if (light.Color.A >= 230)
     {
         return true;
     }
     return false;
 }
Ejemplo n.º 19
0
 private void WriteBackground(LEDNode light, Color color)
 {
     if (_plugin != null && _plugin.Enabled &&
         _kinectState == PluginMode.NoBack)
     {
         byte amount = _plugin.Applies(light.Position.X, light.Position.Y);
         if (amount != 0)
         {
             light.Color = ColorUtil.Interpolate(color, Colors.Black, amount/255.0);
             return;
         }
     }
     light.Color = color;
 }
Ejemplo n.º 20
0
 public bool InGroup(LEDNode node)
 {
     throw new NotImplementedException("This operation is not valid on a stub group");
 }
        private static void ParseLights(StreamReader reader)
        {
            int duplicates = 0;
            string line;
            while(null != (line = ReadSectionLine(reader)))
            {
                string[] fixture = line.Split(Separater.ToCharArray());
                double x,y,z;
                LightAddress address;
                if(fixture.Length != 4 || !LightAddress.TryParse(fixture[0], out address)
                                       || !double.TryParse(fixture[1], out x)
                                       || !double.TryParse(fixture[2], out y)
                                       || !double.TryParse(fixture[3], out z))
                    continue;

                if(!_nodes.ContainsKey(address))
                    _nodes[address] = new LEDNode(address, new Vector3D(x,y,z));
                else
                {
                    duplicates++;
                    Console.WriteLine("Found Duplicates: address: " + address + " orig pos: "+ _nodes[address].Position + " dup pos:" + new Vector3D(x,y,z));
                }
            }
            LightsUpdated(true);
            Console.WriteLine("Found " + duplicates + " duplicates.");
        }