Ejemplo n.º 1
0
    private void clipToViewport(dfRenderData renderData)
    {
        var planes = getViewportClippingPlanes();

        var material = renderData.Material;
        var matrix   = renderData.Transform;

        clipBuffer.Clear();
        dfClippingUtil.Clip(planes, renderData, clipBuffer);

        renderData.Clear();
        renderData.Merge(clipBuffer, false);
        renderData.Material  = material;
        renderData.Transform = matrix;
    }
Ejemplo n.º 2
0
 private dfRenderData compileMasterBuffer()
 {
     this.submeshes.Clear();
     masterBuffer.Clear();
     for (int i = 0; i < this.drawCallCount; i++)
     {
         this.submeshes.Add(masterBuffer.Triangles.Count);
         dfRenderData buffer = this.drawCallBuffers[i];
         if (this.generateNormals && (buffer.Normals.Count == 0))
         {
             this.generateNormalsAndTangents(buffer);
         }
         masterBuffer.Merge(buffer, false);
     }
     masterBuffer.ApplyTransform(base.transform.worldToLocalMatrix);
     return(masterBuffer);
 }
Ejemplo n.º 3
0
    private dfRenderData renderText()
    {
        if (this.Font == null || !this.Font.IsValid || string.IsNullOrEmpty(this.Text))
        {
            return(null);
        }
        dfRenderData material = this.renderData;

        if (this.font is dfDynamicFont)
        {
            dfDynamicFont _dfDynamicFont = (dfDynamicFont)this.font;
            material = this.textRenderData;
            material.Clear();
            material.Material = _dfDynamicFont.Material;
        }
        using (dfFontRendererBase _dfFontRendererBase = this.obtainTextRenderer())
        {
            _dfFontRendererBase.Render(this.text, material);
        }
        return(material);
    }
Ejemplo n.º 4
0
    private dfRenderData renderText()
    {
        if (((this.Font == null) || !this.Font.IsValid) || string.IsNullOrEmpty(this.Text))
        {
            return(null);
        }
        dfRenderData renderData = base.renderData;

        if (this.font is dfDynamicFont)
        {
            dfDynamicFont font = (dfDynamicFont)this.font;
            renderData = this.textRenderData;
            renderData.Clear();
            renderData.Material = font.Material;
        }
        using (dfFontRendererBase base2 = this.obtainTextRenderer())
        {
            base2.Render(this.text, renderData);
        }
        return(renderData);
    }
Ejemplo n.º 5
0
    private void resetRenderBuffers()
    {
        buffers.Clear();

        if (renderData != null)
        {
            renderData.Clear();
            renderData.Material  = Atlas.Material;
            renderData.Transform = this.transform.localToWorldMatrix;

            buffers.Add(renderData);
        }

        if (textRenderData != null)
        {
            textRenderData.Clear();
            textRenderData.Material  = Atlas.Material;
            textRenderData.Transform = this.transform.localToWorldMatrix;

            buffers.Add(textRenderData);
        }
    }
Ejemplo n.º 6
0
    private void clipToViewport( dfRenderData renderData )
    {
        //@Profiler.BeginSample( "Clip markup box to viewport" );

        var planes = getViewportClippingPlanes();

        var material = renderData.Material;
        var matrix = renderData.Transform;

        clipBuffer.Clear();
        dfClippingUtil.Clip( planes, renderData, clipBuffer );

        renderData.Clear();
        renderData.Merge( clipBuffer, false );
        renderData.Material = material;
        renderData.Transform = matrix;

        Profiler.EndSample();
    }
Ejemplo n.º 7
0
    public dfList <dfRenderData> RenderMultiple()
    {
        if (Atlas == null || Font == null)
        {
            return(null);
        }

        if (!isVisible)
        {
            return(null);
        }

        // Initialize render buffers if needed
        if (renderData == null)
        {
            renderData     = dfRenderData.Obtain();
            textRenderData = dfRenderData.Obtain();

            isControlInvalidated = true;
        }

        // If control is not dirty, update the transforms on the
        // render buffers (in case control moved) and return
        // pre-rendered data
        if (!isControlInvalidated)
        {
            for (int i = 0; i < buffers.Count; i++)
            {
                buffers[i].Transform = transform.localToWorldMatrix;
            }
            return(buffers);
        }

        #region Prepare render buffers

        buffers.Clear();

        renderData.Clear();
        renderData.Material  = Atlas.Material;
        renderData.Transform = this.transform.localToWorldMatrix;
        buffers.Add(renderData);

        textRenderData.Clear();
        textRenderData.Material  = Atlas.Material;
        textRenderData.Transform = this.transform.localToWorldMatrix;
        buffers.Add(textRenderData);

        #endregion

        // Render background before anything else, since we're going to
        // want to keep track of where the background data ends and any
        // other data begins
        renderBackground();

        // Render text item
        renderText(textRenderData);

        // Control is no longer in need of rendering
        isControlInvalidated = false;

        // Make sure that the collider size always matches the control
        updateCollider();

        return(buffers);
    }
    private void clipToViewport( dfRenderData renderData )
    {
        var planes = getViewportClippingPlanes();

        var material = renderData.Material;
        var matrix = renderData.Transform;

        clipBuffer.Clear();
        dfClippingUtil.Clip( planes, renderData, clipBuffer );

        renderData.Clear();
        renderData.Merge( clipBuffer, false );
        renderData.Material = material;
        renderData.Transform = matrix;
    }
    public dfList <dfRenderData> RenderMultiple()
    {
        if (Atlas == null || Font == null)
        {
            return(null);
        }

        if (!isVisible)
        {
            return(null);
        }

        // Initialize render buffers if needed
        if (renderData == null)
        {
            renderData     = dfRenderData.Obtain();
            textRenderData = dfRenderData.Obtain();

            isControlInvalidated = true;
        }

        var matrix = this.transform.localToWorldMatrix;

        // If control is not dirty, update the transforms on the
        // render buffers (in case control moved) and return
        // pre-rendered data
        if (!isControlInvalidated)
        {
            for (int i = 0; i < buffers.Count; i++)
            {
                buffers[i].Transform = matrix;
            }
            return(buffers);
        }

        #region Prepare render buffers

        buffers.Clear();

        renderData.Clear();
        renderData.Material  = Atlas.Material;
        renderData.Transform = matrix;
        buffers.Add(renderData);

        textRenderData.Clear();
        textRenderData.Material  = Atlas.Material;
        textRenderData.Transform = matrix;
        buffers.Add(textRenderData);

        #endregion

        // Render background before anything else, since we're going to
        // want to keep track of where the background data ends and any
        // other data begins
        renderBackground();

        // We want to start clipping *after* the background is rendered, so
        // grab the current number of vertices before rendering other elements
        var spriteClipStart = renderData.Vertices.Count;

        // Render other sprites
        renderHover();
        renderSelection();

        // Render text items
        renderItems(textRenderData);

        // Perform clipping
        clipQuads(renderData, spriteClipStart);
        clipQuads(textRenderData, 0);

        // Control is no longer in need of rendering
        isControlInvalidated = false;

        // Make sure that the collider size always matches the control
        updateCollider();

        return(buffers);
    }
Ejemplo n.º 10
0
 private void clipToViewport(dfRenderData renderData)
 {
     Plane[] clippingPlanes = this.GetClippingPlanes();
     Material material = renderData.Material;
     Matrix4x4 transform = renderData.Transform;
     dfRichTextLabel.clipBuffer.Clear();
     dfClippingUtil.Clip(clippingPlanes, renderData, dfRichTextLabel.clipBuffer);
     renderData.Clear();
     renderData.Merge(dfRichTextLabel.clipBuffer, false);
     renderData.Material = material;
     renderData.Transform = transform;
 }