static int _m_AddVert(RealStatePtr L)
        {
            ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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


            int __gen_param_count = LuaAPI.lua_gettop(L);

            try {
                if (__gen_param_count == 2 && translator.Assignable <UnityEngine.UIVertex>(L, 2))
                {
                    UnityEngine.UIVertex v; translator.Get(L, 2, out v);

                    __cl_gen_to_be_invoked.AddVert(v);



                    return(0);
                }
                if (__gen_param_count == 4 && translator.Assignable <UnityEngine.Vector3>(L, 2) && translator.Assignable <UnityEngine.Color32>(L, 3) && translator.Assignable <UnityEngine.Vector2>(L, 4))
                {
                    UnityEngine.Vector3 position; translator.Get(L, 2, out position);
                    UnityEngine.Color32 color; translator.Get(L, 3, out color);
                    UnityEngine.Vector2 uv0; translator.Get(L, 4, out uv0);

                    __cl_gen_to_be_invoked.AddVert(position, color, uv0);



                    return(0);
                }
                if (__gen_param_count == 7 && translator.Assignable <UnityEngine.Vector3>(L, 2) && translator.Assignable <UnityEngine.Color32>(L, 3) && translator.Assignable <UnityEngine.Vector2>(L, 4) && translator.Assignable <UnityEngine.Vector2>(L, 5) && translator.Assignable <UnityEngine.Vector3>(L, 6) && translator.Assignable <UnityEngine.Vector4>(L, 7))
                {
                    UnityEngine.Vector3 position; translator.Get(L, 2, out position);
                    UnityEngine.Color32 color; translator.Get(L, 3, out color);
                    UnityEngine.Vector2 uv0; translator.Get(L, 4, out uv0);
                    UnityEngine.Vector2 uv1; translator.Get(L, 5, out uv1);
                    UnityEngine.Vector3 normal; translator.Get(L, 6, out normal);
                    UnityEngine.Vector4 tangent; translator.Get(L, 7, out tangent);

                    __cl_gen_to_be_invoked.AddVert(position, color, uv0, uv1, normal, tangent);



                    return(0);
                }
            } catch (System.Exception __gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + __gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.UI.VertexHelper.AddVert!"));
        }
Пример #2
0
        static int _m_AddVert(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


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


                int gen_param_count = LuaAPI.lua_gettop(L);

                if (gen_param_count == 2 && translator.Assignable <UnityEngine.UIVertex>(L, 2))
                {
                    UnityEngine.UIVertex _v; translator.Get(L, 2, out _v);

                    gen_to_be_invoked.AddVert(_v);



                    return(0);
                }
                if (gen_param_count == 4 && translator.Assignable <UnityEngine.Vector3>(L, 2) && translator.Assignable <UnityEngine.Color32>(L, 3) && translator.Assignable <UnityEngine.Vector2>(L, 4))
                {
                    UnityEngine.Vector3 _position; translator.Get(L, 2, out _position);
                    UnityEngine.Color32 _color; translator.Get(L, 3, out _color);
                    UnityEngine.Vector2 _uv0; translator.Get(L, 4, out _uv0);

                    gen_to_be_invoked.AddVert(_position, _color, _uv0);



                    return(0);
                }
                if (gen_param_count == 7 && translator.Assignable <UnityEngine.Vector3>(L, 2) && translator.Assignable <UnityEngine.Color32>(L, 3) && translator.Assignable <UnityEngine.Vector2>(L, 4) && translator.Assignable <UnityEngine.Vector2>(L, 5) && translator.Assignable <UnityEngine.Vector3>(L, 6) && translator.Assignable <UnityEngine.Vector4>(L, 7))
                {
                    UnityEngine.Vector3 _position; translator.Get(L, 2, out _position);
                    UnityEngine.Color32 _color; translator.Get(L, 3, out _color);
                    UnityEngine.Vector2 _uv0; translator.Get(L, 4, out _uv0);
                    UnityEngine.Vector2 _uv1; translator.Get(L, 5, out _uv1);
                    UnityEngine.Vector3 _normal; translator.Get(L, 6, out _normal);
                    UnityEngine.Vector4 _tangent; translator.Get(L, 7, out _tangent);

                    gen_to_be_invoked.AddVert(_position, _color, _uv0, _uv1, _normal, _tangent);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }

            return(LuaAPI.luaL_error(L, "invalid arguments to UnityEngine.UI.VertexHelper.AddVert!"));
        }
        static StackObject *AddVert_8(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, 4);

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

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            UnityEngine.Color32 @color = (UnityEngine.Color32) typeof(UnityEngine.Color32).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            UnityEngine.Vector3 @position = (UnityEngine.Vector3) typeof(UnityEngine.Vector3).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack));
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            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.AddVert(@position, @color, @uv0);

            return(__ret);
        }
Пример #4
0
        internal sealed override void AddTo(UnityEngine.UI.VertexHelper helper)
        {
            if (Verts != null)
            {
                var count = helper.currentVertCount;

                foreach (var vert in Verts)
                {
                    helper.AddVert(Map(vert));
                }

                helper.AddTriangle(count, count + 1, count + 2);
                helper.AddTriangle(count + 2, count + 3, count);
            }
        }
        static StackObject *AddVert_9(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.UIVertex @v = (UnityEngine.UIVertex) typeof(UnityEngine.UIVertex).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.AddVert(@v);

            return(__ret);
        }
        protected override void OnPopulateMesh(UnityEngine.UI.VertexHelper toFill)
        {
            if (null == points_)
            {
                resetPoints();
            }

            if (points_.Length < 3)
            {
                return;
            }
            int           numPoints = points_.Length;
            RectTransform rectTrans = GetComponent <RectTransform>();
            UIVertex      vertex    = new UIVertex();

            Vector2 localOffset;

            localOffset.x = rectTrans.pivot.x * rectTrans.rect.width;
            localOffset.y = rectTrans.pivot.y * rectTrans.rect.height;

            Vector2 isize;
            Vector2 local;

            toFill.Clear();

            if (null == sprite)
            {
                isize.x = (1.0e-4f < rectTrans.rect.width) ? 1.0f / rectTrans.rect.width : 1.0f;
                isize.y = (1.0e-4f < rectTrans.rect.height) ? 1.0f / rectTrans.rect.height : 1.0f;

                for (int i = 0; i < numPoints; ++i)
                {
                    vertex.position = points_[i];
                    vertex.color    = this.color;

                    local = points_[i] + localOffset;

                    vertex.uv0.x = (local.x) * isize.x;
                    vertex.uv0.y = (local.y) * isize.y;

                    toFill.AddVert(vertex);
                }

                for (int i = 2; i < numPoints; ++i)
                {
                    toFill.AddTriangle(0, i - 1, i);
                }
                return;
            }

            //Debug.Log("OnPopulateMesh:" + gameObject.name + " " + sprite.packed);

            isize.x = (1 < sprite.texture.width) ? 1.0f / sprite.texture.width : 1.0f;
            isize.y = (1 < sprite.texture.height) ? 1.0f / sprite.texture.height : 1.0f;

            Vector2 localToSprite;

            localToSprite.x = sprite.rect.width / rectTrans.rect.width;
            localToSprite.y = sprite.rect.height / rectTrans.rect.height;

            //Debug.Log("sprite.packed " + sprite.packed);
            //Debug.Log("sprite.textureRectOffset " + sprite.textureRectOffset);
            //Debug.Log("sprite.textureRect " + sprite.textureRect);
            //Debug.Log("sprite.rect " + sprite.rect);
            //Debug.Log("sprite.pivot " + sprite.pivot);

            //Debug.Log("RectTransform.rect " + rectTrans.rect);
            //Debug.Log("RectTransform.pivot " + rectTrans.pivot);

            if (sprite.packed)
            {
                localOffset.x += sprite.textureRect.xMin;
                localOffset.y += sprite.textureRect.yMin;
                for (int i = 0; i < numPoints; ++i)
                {
                    vertex.position = points_[i];
                    vertex.color    = this.color;

                    local    = points_[i] + localOffset;
                    local.x *= localToSprite.x;
                    local.y *= localToSprite.y;

                    vertex.uv0.x = (local.x) * isize.x;
                    vertex.uv0.y = (local.y) * isize.y;

                    toFill.AddVert(vertex);
                }
            }
            else
            {
                for (int i = 0; i < numPoints; ++i)
                {
                    vertex.position = points_[i];
                    vertex.color    = this.color;

                    local    = points_[i] + localOffset;
                    local.x *= localToSprite.x;
                    local.y *= localToSprite.y;

                    vertex.uv0.x = (local.x) * isize.x;
                    vertex.uv0.y = (local.y) * isize.y;

                    toFill.AddVert(vertex);
                }
            }

            for (int i = 2; i < numPoints; ++i)
            {
                toFill.AddTriangle(0, i - 1, i);
            }
        }
Пример #7
0
 internal sealed override void AddTo(UnityEngine.UI.VertexHelper helper)
 {
     helper.AddVert(Map(Value));
 }