Пример #1
0
 public override void Update(float deltaTime)
 {
     base.Update(deltaTime);
     if (_watcherIsMine)
     {
         _watcher.Update();
     }
     primaryValue   = _watcher.averageFrameTime * 0.001f;
     secondaryValue = _watcher.maxFrameTime * 0.001f;
 }
Пример #2
0
    void Update()
    {
        _log.Update();
        _appendLog.Update();
        _frametimeWatcher.Update();
        if (_testing)
        {
            _maxMemory = Mathf.Max(_maxMemory, (int)UnityEngine.Profiling.Profiler.GetTotalAllocatedMemoryLong());
            _maxSpike  = Mathf.Max(_maxSpike, _frametimeWatcher.maxFrameTime);
        }
        var mode = (Mode)_modeDropdown.value;

        if (_enumerator != null)
        {
            if (!_enumerator.MoveNext())
            {
                _enumerator = null;

                string msg = mode + " : " + _time.ToString("F2");
                if (mode != Mode.WwwSyncWrite)
                {
                    int slotCount;
                    int.TryParse(_parallelCountInputField.text, out slotCount);
                    slotCount = Mathf.Max(slotCount, 1);
                    msg      += " Parallel: " + slotCount;
                    msg      += " Shuffle: " + _shuffleToggle.isOn;
                    msg      += " MaxSpike: " + _maxSpike;
                    msg      += " MaxMem: " + (_maxMemory / (1024 * 1024));
                }
                if (mode == Mode.UwrAsyncWrite)
                {
                    int writerBufferSize;
                    int.TryParse(_writerBufferSizeInputField.text, out writerBufferSize);
                    writerBufferSize  = Mathf.Max(writerBufferSize, 1);
                    writerBufferSize *= 1024;
                    int inputBufferSize;
                    int.TryParse(_inputBufferSizeInputField.text, out inputBufferSize);
                    inputBufferSize  = Mathf.Max(inputBufferSize, 1);
                    inputBufferSize *= 1024;
                    msg             += " WriterBufferSize: " + writerBufferSize;
                    msg             += " InputBufferSize: " + inputBufferSize;
                }
                Debug.Log(msg);
            }
        }

        _fpsText.text = _frametimeWatcher.averageFrameTime.ToString() + " MaxSpike: " + _maxSpike.ToString() + " Time: " + _time.ToString("F2") + " MaxMem: " + (_maxMemory / (1024 * 1024));
        var restBytes = (_writer != null) ? _writer.restBytes : 0;

        _stateText.text      = string.Format("FileCount:{0}/{1} Read:{2} RestWrite:{3}", _doneFileCount, _totalFileCount, _doneBytes, restBytes);
        _button.interactable = (_enumerator == null);
        _inputBufferSizeInputField.interactable  = (mode == Mode.UwrAsyncWrite);
        _writerBufferSizeInputField.interactable = (mode == Mode.UwrAsyncWrite);
    }
Пример #3
0
    void Update()
    {
        frameTimeWatcher.Update();
        var t = Time.time * 1f;
        var p = new Vector3(
            4f * Mathf.Cos(t),
            0.5f,
            4f * Mathf.Sin(t));

        movingSphere.localPosition = p;
    }
Пример #4
0
    void Update()
    {
        frameTimeWatcher.Update();
        fpsText.text = "Time: " + (frameTimeWatcher.averageFrameTime / 1024f).ToString("F1");

        float log, newLog;
        bool  materialDirty = false;

        var sqrtRatio = Mathf.Sqrt(resolutionRatio);
        var edge      = sqrtRatio * 4096f;

        resolutionText.text = "Reso: " + edge.ToString("F0") + " (" + resolutionRatio.ToString("F3") + ")";
        log    = Mathf.Log10(resolutionRatio);
        newLog = resolutionSlider.value;
        if (newLog != log)
        {
            resolutionRatio = Mathf.Pow(10f, newLog);
            ChangeResolution();
        }

        strengthText.text = "Strength: " + strength.ToString("F1");
        log    = Mathf.Log10(strength);
        newLog = strengthSlider.value;
        if (newLog != log)
        {
            strength      = Mathf.Pow(10f, newLog);
            materialDirty = true;
        }

        attenuationText.text = "Attenuation: " + attenuation.ToString("F1");
        log    = Mathf.Log10(attenuation);
        newLog = attenuationSlider.value;
        if (newLog != log)
        {
            attenuation   = Mathf.Pow(10f, newLog);
            materialDirty = true;
        }

        cameraDistanceText.text = "Cam Distance: " + cameraDistance.ToString("F1");
        log    = Mathf.Log10(cameraDistance);
        newLog = cameraDistanceSlider.value;
        if (newLog != log)
        {
            cameraDistance = Mathf.Pow(10f, newLog);
            camera3d.transform.localPosition = new Vector3(0f, 0f, -cameraDistance);
        }


        var newValue = perVertexToggle.isOn;

        if (newValue != perVertex)
        {
            perVertex = newValue;
            SetMaterial();
        }

        rawImage.enabled = imageShowToggle.isOn;

        if (materialDirty)
        {
            UpdateMaterialParams();
        }
    }
Пример #5
0
 public override void UpdateWindow()
 {
     _frameTimeWatcher.Update();
     _graph.AddData(0, _frameTimeWatcher.fps);
 }