UnityEngine.UI.VertexHelper.AddTriangle C# (CSharp) Method

AddTriangle() public method

Add a triangle to the buffer.

public AddTriangle ( int idx0, int idx1, int idx2 ) : void
idx0 int Index 0.
idx1 int Index 1.
idx2 int Index 2.
return void
        public void AddTriangle(int idx0, int idx1, int idx2)
        {
            this.m_Indices.Add(idx0);
            this.m_Indices.Add(idx1);
            this.m_Indices.Add(idx2);
        }

Usage Example

コード例 #1
0
ファイル: RawImage.cs プロジェクト: randomize/VimConfig
 protected override void OnPopulateMesh(Mesh toFill)
 {
     Texture mainTexture = this.mainTexture;
     if (mainTexture != null)
     {
         Vector4 zero = Vector4.zero;
         int num = Mathf.RoundToInt(mainTexture.width * this.uvRect.width);
         int num2 = Mathf.RoundToInt(mainTexture.height * this.uvRect.height);
         float num3 = ((num & 1) != 0) ? ((float) (num + 1)) : ((float) num);
         float num4 = ((num2 & 1) != 0) ? ((float) (num2 + 1)) : ((float) num2);
         zero.x = 0f;
         zero.y = 0f;
         zero.z = ((float) num) / num3;
         zero.w = ((float) num2) / num4;
         zero.x -= base.rectTransform.pivot.x;
         zero.y -= base.rectTransform.pivot.y;
         zero.z -= base.rectTransform.pivot.x;
         zero.w -= base.rectTransform.pivot.y;
         zero.x *= base.rectTransform.rect.width;
         zero.y *= base.rectTransform.rect.height;
         zero.z *= base.rectTransform.rect.width;
         zero.w *= base.rectTransform.rect.height;
         using (VertexHelper helper = new VertexHelper())
         {
             Color color = base.color;
             helper.AddVert(new Vector3(zero.x, zero.y), color, new Vector2(this.m_UVRect.xMin, this.m_UVRect.yMin));
             helper.AddVert(new Vector3(zero.x, zero.w), color, new Vector2(this.m_UVRect.xMin, this.m_UVRect.yMax));
             helper.AddVert(new Vector3(zero.z, zero.w), color, new Vector2(this.m_UVRect.xMax, this.m_UVRect.yMax));
             helper.AddVert(new Vector3(zero.z, zero.y), color, new Vector2(this.m_UVRect.xMax, this.m_UVRect.yMin));
             helper.AddTriangle(0, 1, 2);
             helper.AddTriangle(2, 3, 0);
             helper.FillMesh(toFill);
         }
     }
 }
All Usage Examples Of UnityEngine.UI.VertexHelper::AddTriangle