예제 #1
0
        public void AddLine(Point3D start, Point3D stop, double thickness)
        {
            if (_lineCount == null)
            {
                throw new InvalidOperationException("Must call BeginAddingLines before calling AddLine");
            }
            else if (_lineCount.Value > _lines.Count)
            {
                throw new ApplicationException("_lineCount fell out of sync");
            }
            else if (_lineCount.Value == _lines.Count)
            {
                // Create a new line
                BillboardLine3D line = new BillboardLine3D(_shouldUseSpinTimer);
                line.Material = _material;

                _lines.Add(line);
            }

            _lineCount = _lineCount.Value + 1;

            // Whatever line was at this index now gets this position
            _lines[_lineCount.Value - 1].SetPoints(start, stop, thickness);

            if (_lineCount.Value > _geometry.Children.Count)
            {
                // This must be done last.  Otherwise, when the computer is stressed, the line will get rendered before it is positioned
                _geometry.Children.Add(_lines[_lineCount.Value - 1].Model);
            }
        }
예제 #2
0
        private void InvalidateColor()
        {
            _material = BillboardLine3D.GetSolidColorMaterial(_isReflectiveColor, _color);

            // Update existing lines
            foreach (BillboardLine3D line in _lines)
            {
                line.Material = _material;
            }
        }