Пример #1
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    protected override Vector3[] GetVertices(Space _space)
    {
        if (textureInfo_ == null)
        {
            return(new Vector3[0]);
        }

        exList <Vector3> vb = exList <Vector3> .GetTempList();

        UpdateBufferSize();
        vb.AddRange(vertexCount_);

        switch (spriteType_)
        {
        case exSpriteType.Simple:
            SpriteBuilder.SimpleUpdateVertexBuffer(this, textureInfo_, useTextureOffset_, _space, vb, 0);
            break;

        case exSpriteType.Sliced:
            SpriteBuilder.SimpleUpdateVertexBuffer(this, textureInfo_, useTextureOffset_, _space, vb, 0);
            SpriteBuilder.SimpleVertexBufferToSliced(this, textureInfo_, vb, 0);
            break;

        case exSpriteType.Tiled:
            SpriteBuilder.TiledUpdateVertexBuffer(this, textureInfo_, useTextureOffset_, tiledSpacing_, _space, vb, 0);
            break;

        case exSpriteType.Diced:
            SpriteBuilder.SimpleUpdateVertexBuffer(this, textureInfo_, useTextureOffset_, _space, vb, 0);
            SpriteBuilder.SimpleVertexBufferToDiced(this, textureInfo_, vb, 0);
            break;
        }

        return(vb.ToArray());
    }
Пример #2
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;
        }
    }
Пример #3
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    private void FillBuffers()
    {
        vertices.AddRange(vertexCount_);
        colors32.AddRange(vertexCount_);
        uvs.AddRange(vertexCount_);
        indices.AddRange(indexCount_);
        updateFlags |= exUpdateFlags.All;
    }
Пример #4
0
    // ------------------------------------------------------------------
    // Desc:
    // ------------------------------------------------------------------

    protected override Vector3[] GetVertices(Space _space)
    {
        // TODO: only return the rotated bounding box of the sprite font
        int visibleVertexCount    = text_.Length * 4;
        exList <Vector3> vertices = exList <Vector3> .GetTempList();

        vertices.AddRange(visibleVertexCount);

        SpriteFontBuilder.BuildText(this, _space, vertices, 0);
        return(vertices.ToArray());
    }
Пример #5
0
    // ------------------------------------------------------------------
    /// Add sprite's geometry data to buffers
    // ------------------------------------------------------------------

    internal virtual void FillBuffers(exList <Vector3> _vertices, exList <Vector2> _uvs, exList <Color32> _colors32)
    {
        vertexBufferIndex = _vertices.Count;
        _vertices.AddRange(vertexCount_);
        if (_colors32 != null)
        {
            _colors32.AddRange(vertexCount_);
        }
        _uvs.AddRange(vertexCount_);
        updateFlags |= exUpdateFlags.AllExcludeIndex;
    }