AddFloat() 개인적인 메소드

private AddFloat ( int nameID, float value ) : void
nameID int
value float
리턴 void
    public virtual void LateUpdate()
    {
        if(m_id==0)
        {
            m_id = ++s_idgen;
        }
        m_local_time += Time.deltaTime;

        if (m_mpb == null)
        {
            m_renderer = GetComponent<Renderer>();
            m_trans = GetComponent<Transform>();
            m_mpb = new MaterialPropertyBlock();
            m_mpb.AddVector("_Position", Vector4.zero);
            m_mpb.AddVector("_Rotation", Vector4.zero);
            m_mpb.AddVector("_Scale", Vector4.one);
            m_mpb.AddFloat("_LocalTime", m_local_time);
            m_mpb.AddFloat("_ID", m_id);
        }

        var rot = m_trans.rotation;
        m_mpb.SetVector("_Position", m_trans.position);
        m_mpb.SetVector("_Rotation", new Vector4(rot.x, rot.y, rot.z, rot.w));
        m_mpb.SetVector("_Scale", m_trans.localScale);
        m_mpb.SetFloat("_LocalTime", m_local_time);
        for (int i = 0; i < m_params.Length; ++i)
        {
            m_mpb.SetFloat(m_params[i].key, m_params[i].value);
        }
        m_renderer.SetPropertyBlock(m_mpb);
    }
 static public int AddFloat(IntPtr l)
 {
     try {
         int argc = LuaDLL.lua_gettop(l);
         if (matchType(l, argc, 2, typeof(int), typeof(float)))
         {
             UnityEngine.MaterialPropertyBlock self = (UnityEngine.MaterialPropertyBlock)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             self.AddFloat(a1, a2);
             pushValue(l, true);
             return(1);
         }
         else if (matchType(l, argc, 2, typeof(string), typeof(float)))
         {
             UnityEngine.MaterialPropertyBlock self = (UnityEngine.MaterialPropertyBlock)checkSelf(l);
             System.String a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             self.AddFloat(a1, a2);
             pushValue(l, true);
             return(1);
         }
         pushValue(l, false);
         LuaDLL.lua_pushstring(l, "No matched override function to call");
         return(2);
     }
     catch (Exception e) {
         return(error(l, e));
     }
 }
 static public int AddFloat(IntPtr l)
 {
     try{
         if (matchType(l, 2, typeof(System.String), typeof(System.Single)))
         {
             UnityEngine.MaterialPropertyBlock self = (UnityEngine.MaterialPropertyBlock)checkSelf(l);
             System.String a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             self.AddFloat(a1, a2);
             return(0);
         }
         else if (matchType(l, 2, typeof(System.Int32), typeof(System.Single)))
         {
             UnityEngine.MaterialPropertyBlock self = (UnityEngine.MaterialPropertyBlock)checkSelf(l);
             System.Int32 a1;
             checkType(l, 2, out a1);
             System.Single a2;
             checkType(l, 3, out a2);
             self.AddFloat(a1, a2);
             return(0);
         }
         LuaDLL.luaL_error(l, "No matched override function to call");
         return(0);
     }
     catch (Exception e) {
         LuaDLL.luaL_error(l, e.ToString());
         return(0);
     }
 }
예제 #4
0
    public virtual void OnWillRenderObject()
    {
        if(m_mpb == null) {
            m_mpb = new MaterialPropertyBlock();
            m_mpb.AddVector("_Position", Vector4.zero);
            m_mpb.AddVector("_Rotation", Vector4.zero);
            m_mpb.AddVector("_Scale", Vector4.one);
            m_mpb.AddFloat("_LocalTime", m_local_time);
            m_mpb.AddFloat("_ID", m_id);
            m_renderer = GetComponent<Renderer>();
            m_trans = GetComponent<Transform>();
        }

        var rot = m_trans.rotation;
        m_mpb.SetVector("_Position", m_trans.position);
        m_mpb.SetVector("_Rotation", new Vector4(rot.x, rot.y, rot.z, rot.w));
        m_mpb.SetVector("_Scale", m_trans.localScale);
        m_mpb.SetFloat("_LocalTime", m_local_time);
        m_renderer.SetPropertyBlock(m_mpb);
    }
 public void AddToMaterialPropertyBlock(MaterialPropertyBlock block)
 {
     UIPanelMaterialPropertyBlock.Node node = this.first;
     int num = this.count;
     while (true)
     {
         int num1 = num;
         num = num1 - 1;
         if (num1 <= 0)
         {
             break;
         }
         switch (node.type)
         {
             case UIPanelMaterialPropertyBlock.PropType.Float:
             {
                 block.AddFloat(node.property, [email protected]);
                 break;
             }
             case UIPanelMaterialPropertyBlock.PropType.Vector:
             {
                 block.AddVector(node.property, [email protected]);
                 break;
             }
             case UIPanelMaterialPropertyBlock.PropType.Color:
             {
                 block.AddColor(node.property, [email protected]);
                 break;
             }
             case UIPanelMaterialPropertyBlock.PropType.Matrix:
             {
                 block.AddMatrix(node.property, [email protected]);
                 break;
             }
         }
         node = node.next;
     }
 }