Example #1
0
    // ------------------------------------------------------------------
    /// Get sprite's geometry data
    // ------------------------------------------------------------------

    public void GetBuffers(exList <Vector3> _vertices, exList <Vector2> _uvs, exList <Color32> _colors, exList <int> _indices = null)
    {
        _vertices.Clear();
        _uvs.Clear();
        if (_indices != null)
        {
            _indices.Clear();
        }
        if (visible)
        {
            UpdateTransform();
            exUpdateFlags originalFlags             = updateFlags;
            int           originalVertexBufferIndex = vertexBufferIndex;
            int           originalIndexBufferIndex  = indexBufferIndex;

            FillBuffers(_vertices, _uvs, _colors);

            if (_indices != null)
            {
                _indices.AddRange(indexCount);
            }
            indexBufferIndex = 0;
            updateFlags     |= exUpdateFlags.Index;
            UpdateBuffers(_vertices, _uvs, _colors, _indices);

            vertexBufferIndex = originalVertexBufferIndex;
            indexBufferIndex  = originalIndexBufferIndex;
            updateFlags       = originalFlags;
        }
    }
Example #2
0
 public static exList <T> GetTempList()
 {
     if (tempList_ == null)
     {
         tempList_ = new exList <T>();
     }
     tempList_.Clear();
     // TODO: trim
     return(tempList_);
 }
Example #3
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    protected void UpdateBufferSize()
    {
        int oldVertexCount = vertexCount_;
        int oldIndexCount  = indexCount_;

        UpdateVertexAndIndexCount();
        if (vertexCount_ != oldVertexCount || indexCount_ != oldIndexCount)
        {
            // re-alloc buffer
            vertices.Clear();
            uvs.Clear();
            colors32.Clear();
            indices.Clear();
            FillBuffers();
        }
    }
Example #4
0
    ///////////////////////////////////////////////////////////////////////////////
    // Internal Functions
    ///////////////////////////////////////////////////////////////////////////////

    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    public void Clear()
    {
        spriteList.Clear();
        sortedSpriteList.Clear();
        vertices.Clear();
        indices.Clear();
        uvs.Clear();
        colors32.Clear();
        if (mesh0 != null)
        {
            mesh0.Clear();
        }
        if (mesh1 != null)
        {
            mesh1.Clear();
        }
        updateFlags = exUpdateFlags.None;
    }