Esempio n. 1
0
    /// <summary>
    /// Draws the line instance, Is in screen space as default. Can pass a Grid2D to draw in the Grid Space.
    /// </summary>
    /// <param name="grid">Optional, Grid2D to draw relative to. (Start and End are in Grid Space when you do)</param>
    public void Draw(Grid2d grid = null)
    {
        if (grid != null)
        {
            grid.DrawLine(this);
            return;
        }

        Glint.AddCommand(this);
    }
Esempio n. 2
0
        void Update()
        {
            if (_firstUpdate)
            {
                initDataForTex(ref _data, blittingScript.renderTex);
                _previewTexture            = new Texture2D(blittingScript.renderTex.width, blittingScript.renderTex.height);
                _previewTexture.filterMode = FilterMode.Point;
                resultMaterial.SetTexture("_MainTex", _previewTexture);

                Glint.requestWaitTimeInFrames = 1;
                Glint.RequestAsync(blittingScript.renderTex, _data, onDataRetrieved);

                _firstUpdate = false;
            }
        }
Esempio n. 3
0
        // Callback that calls itself, for continuous (sequential, non-optimal) download.
        private void onDataRetrieved()
        {
            // Upon getting the callback, we look at the data and fill it into a texture
            // to display on the "CPU" side of the scene.
            fillTextureWithData(_data,
                                blittingScript.renderTex.width,
                                blittingScript.renderTex.height,
                                _previewTexture);

            _sb.Remove(0, _sb.Length);
            _sb.Append("Render thread map (ms):\t");
            _sb.Append(Glint.Profiling.lastRenderMapMs.ToString("F3"));
            _sb.Append("\n");
            _sb.Append("Render thread memcpy (ms):\t");
            _sb.Append(Glint.Profiling.lastRenderCopyMs.ToString("F3"));
            _sb.Append("\n");
            _sb.Append("Main thread memcpy (ms):\t");
            _sb.Append(Glint.Profiling.lastMainCopyMs.ToString("F3"));
            textMesh.text = _sb.ToString();

            Glint.RequestAsync(blittingScript.renderTex, _data, onDataRetrieved);
        }