Esempio n. 1
0
        public void SetMaterial(IDeviceContextHolder contextHolder, IAcDynamicMaterial material)
        {
            if (material == null)
            {
                return;
            }
            Emissive.SetMaterial(contextHolder, material);

            if (RadialSpeedBlur != 0f)
            {
                material.SetRadialSpeedBlurNext(RadialSpeedBlur);
            }
        }
Esempio n. 2
0
        public void SetMaterial(IDeviceContextHolder holder, [CanBeNull] IAcDynamicMaterial material)
        {
            if (_smoothChanging)
            {
                if (_stopwatch == null)
                {
                    _stopwatch = holder.StartNewStopwatch();
                }

                if (_duration == null)
                {
                    _duration = GuessDuration(_value ?? new Vector3(1f));
                }

                if (_duration == TimeSpan.Zero)
                {
                    _smoothChanging = false;
                    _stopwatch      = null;
                    _position       = 1f;
                }
                else
                {
                    var delta = _stopwatch.ElapsedSeconds / _duration.Value.TotalSeconds;
                    _stopwatch.Reset();
                    _position = (float)(_off ? _position - delta : _position + delta).Saturate();

                    if (_position == (_off ? 0f : 1f))
                    {
                        _smoothChanging = false;
                        _stopwatch      = null;
                    }
                }
            }

            if (_value.HasValue || _disableEmissive)
            {
                _disableEmissive = false;
                material?.SetEmissiveNext(_value ?? default(Vector3), _position);
            }
        }