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

AddVert() public method

Add a single vertex to the stream.

public AddVert ( UIVertex v ) : void
v UnityEngine.UIVertex
return void
        public void AddVert(UIVertex v)
        {
            this.AddVert(v.position, v.color, v.uv0, v.uv1, v.normal, v.tangent);
        }

Same methods

VertexHelper::AddVert ( Vector3 position, Color32 color, Vector2 uv0 ) : void
VertexHelper::AddVert ( Vector3 position, Color32 color, Vector2 uv0, Vector2 uv1, Vector3 normal, Vector4 tangent ) : void

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::AddVert