static StackObject *FillMesh_6(ILIntepreter __intp, StackObject *__esp, IList <object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject *ptr_of_this_method;
            StackObject *__ret = ILIntepreter.Minus(__esp, 2);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            UnityEngine.Mesh @mesh = (UnityEngine.Mesh) typeof(UnityEngine.Mesh).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.UI.VertexHelper instance_of_this_method = (UnityEngine.UI.VertexHelper) typeof(UnityEngine.UI.VertexHelper).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.FillMesh(@mesh);

            return(__ret);
        }
        static int _m_FillMesh(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


            UnityEngine.UI.VertexHelper __cl_gen_to_be_invoked = (UnityEngine.UI.VertexHelper)translator.FastGetCSObj(L, 1);


            try {
                {
                    UnityEngine.Mesh mesh = (UnityEngine.Mesh)translator.GetObject(L, 2, typeof(UnityEngine.Mesh));

                    __cl_gen_to_be_invoked.FillMesh(mesh);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }
        }
示例#3
0
        /// <summary>
        /// Modifies the mesh.
        /// </summary>
        /// <param name="vh">Vertex buffer object.</param>
        public override void ModifyMesh(UnityEngine.UI.VertexHelper vh)
#endif
        {
            if (!IsActive())
            {
                return;
            }
            using (ListPool <UIVertex> .Scope uiVertices = new ListPool <UIVertex> .Scope())
            {
#if IS_VBO_UI_VERTEX
                int count = vertices.Count;
#else
        #if IS_VBO_MESH
                using (UnityEngine.UI.VertexHelper vh = new UnityEngine.UI.VertexHelper(mesh))
                {
                    vh.GetUIVertexStream(uiVertices.List);
                }
        #else
                vh.GetUIVertexStream(uiVertices.List);
        #endif
                int count = uiVertices.List.Count;
#endif
                if (count == 0)
                {
                    return;
                }
                float yMin = this.graphic.rectTransform.rect.yMin;
                float yMax = this.graphic.rectTransform.rect.yMax;
                switch (m_FillMode)
                {
                case GradientFillMode.PerQuad:
#if IS_VBO_UI_VERTEX
                    for (int i = 0; i < count; i += 4)
                    {
                        ApplyTint(vertices, i, m_TopColor);
                        ApplyTint(vertices, i + 1, m_TopColor);
                        ApplyTint(vertices, i + 2, m_BottomColor);
                        ApplyTint(vertices, i + 3, m_BottomColor);
                    }
#else
                    for (int i = 0; i < count; i += 6)
                    {
                        ApplyTint(uiVertices.List, i, m_TopColor);
                        ApplyTint(uiVertices.List, i + 1, m_TopColor);
                        ApplyTint(uiVertices.List, i + 2, m_BottomColor);
                        ApplyTint(uiVertices.List, i + 3, m_BottomColor);
                        ApplyTint(uiVertices.List, i + 4, m_BottomColor);
                        ApplyTint(uiVertices.List, i + 5, m_TopColor);
                    }
        #if IS_VBO_MESH
                    using (UnityEngine.UI.VertexHelper vh = new UnityEngine.UI.VertexHelper())
                    {
                        vh.AddUIVertexTriangleStream(uiVertices.List);
                        vh.FillMesh(mesh);
                    }
        #else
                    vh.Clear();
                    vh.AddUIVertexTriangleStream(uiVertices.List);
        #endif
#endif
                    return;

                case GradientFillMode.GeometryBounds:
                    yMin = uiVertices.List[0].position.y;
                    yMax = uiVertices.List[0].position.y;
                    for (int i = 1; i < count; i++)
                    {
                        float y = uiVertices.List[i].position.y;
                        if (y > yMax)
                        {
                            yMax = y;
                        }
                        if (y < yMin)
                        {
                            yMin = y;
                        }
                    }
                    break;
                }
                float div = 1f / (yMax - yMin);
#if IS_VBO_UI_VERTEX
                for (int i = 0; i < count; ++i)
                {
                    ApplyTint(
                        vertices,
                        i,
                        Color32.Lerp(m_TopColor, m_BottomColor, (yMax - uiVertices.List[i].position.y) * div)
                        );
                }
#else
                for (int i = 0; i < count; ++i)
                {
                    ApplyTint(
                        uiVertices.List,
                        i,
                        Color32.Lerp(m_TopColor, m_BottomColor, (yMax - uiVertices.List[i].position.y) * div)
                        );
                }
        #if IS_VBO_MESH
                using (UnityEngine.UI.VertexHelper vh = new UnityEngine.UI.VertexHelper())
                {
                    vh.AddUIVertexTriangleStream(uiVertices.List);
                    vh.FillMesh(mesh);
                }
        #else
                vh.Clear();
                vh.AddUIVertexTriangleStream(uiVertices.List);
        #endif
#endif
            }
        }