本文整理汇总了C#中UnityEngine.Rendering.CommandBuffer.SetGlobalColor方法的典型用法代码示例。如果您正苦于以下问题:C# CommandBuffer.SetGlobalColor方法的具体用法?C# CommandBuffer.SetGlobalColor怎么用?C# CommandBuffer.SetGlobalColor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Rendering.CommandBuffer
的用法示例。
在下文中一共展示了CommandBuffer.SetGlobalColor方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CloneToBuffer
private void CloneToBuffer(Material mat, CommandBuffer buf)
{
foreach (KeyValuePair<object, object> field in cache)
{
object obj = field.Value;
//float
int id = (int)field.Key;
if (obj.GetType() == typeof(float))
{
float value = mat.GetFloat(id);
buf.SetGlobalFloat(id, value);
}
//Color
else if (obj.GetType() == typeof(Color))
{
Color value = mat.GetColor(id);
buf.SetGlobalColor(id, value);
}
//Color32
else if (obj.GetType() == typeof(Color32))
{
Color value = mat.GetColor(id);
buf.SetGlobalColor(id, value);
}//Vector2
else if (obj.GetType() == typeof(Vector2))
{
Vector4 value = mat.GetVector(id);
buf.SetGlobalVector(id, value);
}
//Vector3
else if (obj.GetType() == typeof(Vector3))
{
Vector4 value = mat.GetVector(id);
buf.SetGlobalVector(id, value);
}
//Vector4
else if (obj.GetType() == typeof(Vector4))
{
Vector4 value = mat.GetVector(id);
buf.SetGlobalVector(id, value);
}
//Matrix
else if (obj.GetType() == typeof(Matrix4x4))
{
Matrix4x4 value = mat.GetMatrix(id);
buf.SetGlobalMatrix(id, value);
}
}
}
示例2: CreateCommandBuffers
private void CreateCommandBuffers()
{
m_renderCmdBuffer = new CommandBuffer();
m_renderCmdBuffer.name = "Highlights: Drawing Objects";
// Drawing objects to the buffer
m_renderCmdBuffer.SetRenderTarget(m_colorRT, BuiltinRenderTextureType.CameraTarget);
m_renderCmdBuffer.ClearRenderTarget(false, true, Color.clear);
var pass = m_selectionType == HighlightType.Glow ? HighlightPass.MarkStencilArea : HighlightPass.DrawSolid;
foreach(var hObject in m_renderers)
{
m_renderCmdBuffer.SetGlobalColor("_Color", hObject.Value);
m_renderCmdBuffer.SetGlobalFloat("_Cutoff", m_cutoffValue * 0.5f);
m_renderCmdBuffer.DrawRenderer(hObject.Key, m_highlightMaterial, 0, (int) pass);
}
foreach(var hObject in m_renderers)
{
m_renderCmdBuffer.SetGlobalColor("_Color", hObject.Value);
m_renderCmdBuffer.DrawRenderer(hObject.Key, m_highlightMaterial, 0, (int) HighlightPass.ExtrudeOutline);
}
var drawEvent = GetCameraDrawEvent();
m_camera.AddCommandBuffer(drawEvent, m_renderCmdBuffer);
}