本文整理汇总了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);
}
示例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);
}
示例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;
}
}