当前位置: 首页>>代码示例>>C#>>正文


C# MaterialPropertyBlock.AddFloat方法代码示例

本文整理汇总了C#中UnityEngine.MaterialPropertyBlock.AddFloat方法的典型用法代码示例。如果您正苦于以下问题:C# MaterialPropertyBlock.AddFloat方法的具体用法?C# MaterialPropertyBlock.AddFloat怎么用?C# MaterialPropertyBlock.AddFloat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.MaterialPropertyBlock的用法示例。


在下文中一共展示了MaterialPropertyBlock.AddFloat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: LateUpdate

    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);
    }
开发者ID:GustavoQuiroz,项目名称:Unity5Effects,代码行数:31,代码来源:TransformToShader.cs

示例2: OnWillRenderObject

    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);
    }
开发者ID:robterrell,项目名称:MassParticle,代码行数:20,代码来源:TransformToShader.cs

示例3: AddToMaterialPropertyBlock

 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;
     }
 }
开发者ID:HexHash,项目名称:LegacyRust,代码行数:38,代码来源:UIPanelMaterialPropertyBlock.cs


注:本文中的UnityEngine.MaterialPropertyBlock.AddFloat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。