Esempio n. 1
0
    private void Fill()
    {
        if (mesh == null)
        {
            mesh = new Mesh();
        }

        meshFilter.mesh = mesh;

        float glWidth  = f3Rect.rect.width / 2;
        float glHeight = f3Rect.rect.height / 2;

        vertexHelper.Clear();

        spriteData = altas.GetSpriteData(spriteName);

        AddVert(new Vector3(-glWidth, -glHeight, 0), Color.white, spriteData.UV0(altas.rect));
        AddVert(new Vector3(-glWidth, glHeight, 0), Color.white, spriteData.UV1(altas.rect));
        AddVert(new Vector3(glWidth, -glHeight, 0), Color.white, spriteData.UV2(altas.rect));
        AddVert(new Vector3(glWidth, glHeight, 0), Color.white, spriteData.UV3(altas.rect));

        AddTriangle(0, 1, 2);
        AddTriangle(2, 3, 1);

        Apply(mesh, vertexHelper);
    }
Esempio n. 2
0
    public void OnFill()
    {
        float glWidth = rectTransform.rect.width / 2;
        float glHeight = rectTransform.rect.height / 2;

        F3FakeDrawcall.Instance.position.Add((transform.localToWorldMatrix * (new Vector4(-glWidth, -glHeight, 0, 1))));
        F3FakeDrawcall.Instance.position.Add((transform.localToWorldMatrix * (new Vector4(-glWidth, glHeight, 0, 1))));
        F3FakeDrawcall.Instance.position.Add((transform.localToWorldMatrix * (new Vector4(glWidth, -glHeight, 0, 1))));
        F3FakeDrawcall.Instance.position.Add((transform.localToWorldMatrix * (new Vector4(glWidth, glHeight, 0, 1))));

        F3FakeDrawcall.Instance.color.Add(mColor);
        F3FakeDrawcall.Instance.color.Add(mColor);
        F3FakeDrawcall.Instance.color.Add(mColor);
        F3FakeDrawcall.Instance.color.Add(mColor);

        spriteData = altas.GetSpriteData(spriteName);
        F3FakeDrawcall.Instance.uvs.Add(spriteData.UV0(altas.rect));
        F3FakeDrawcall.Instance.uvs.Add(spriteData.UV1(altas.rect));
        F3FakeDrawcall.Instance.uvs.Add(spriteData.UV2(altas.rect));
        F3FakeDrawcall.Instance.uvs.Add(spriteData.UV3(altas.rect));

        F3FakeDrawcall.Instance.meshRenderer.sharedMaterial = altas.material;
    }