本文整理汇总了C#中UnityEngine.Rendering.CommandBuffer.DrawRenderer方法的典型用法代码示例。如果您正苦于以下问题:C# CommandBuffer.DrawRenderer方法的具体用法?C# CommandBuffer.DrawRenderer怎么用?C# CommandBuffer.DrawRenderer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnityEngine.Rendering.CommandBuffer
的用法示例。
在下文中一共展示了CommandBuffer.DrawRenderer方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IssueDrawCall_DepthMask
public override void IssueDrawCall_DepthMask(SubRenderer br, CommandBuffer cb)
{
var renderer = GetComponent<Renderer>();
int n = m_mask_materials.Length;
for (int i = 0; i < n; ++i)
{
cb.DrawRenderer(renderer, m_mask_materials[i], i, 0);
cb.DrawRenderer(renderer, m_mask_materials[i], i, 1);
if (br.m_enable_piercing)
{
cb.DrawRenderer(renderer, m_mask_materials[i], i, 2);
}
cb.DrawRenderer(renderer, m_mask_materials[i], i, 3);
}
}
示例2: IssueDrawCall_BackStencil
public override void IssueDrawCall_BackStencil(LightWithStencilShadow light, CommandBuffer commands)
{
var renderer = GetComponent<Renderer>();
int n = m_stencil_materials.Length;
for (int i = 0; i < n; ++i)
{
commands.DrawRenderer(renderer, m_stencil_materials[i], i, 1);
}
}
示例3: IssueDrawCall_FrontDepth
public override void IssueDrawCall_FrontDepth(AndRenderer br, CommandBuffer cb)
{
var renderer = GetComponent<Renderer>();
int n = m_depth_materials.Length;
for (int i = 0; i < n; ++i)
{
cb.DrawRenderer(renderer, m_depth_materials[i], i, 1);
}
}
示例4: FillBuffer
//
public bool FillBuffer(CommandBuffer buffer)
{
if (r == null) { return false; }
if (lastCamera == Camera.current)
{
for (int i = 0, imax = data.Count; i < imax; i++)
{
Data d = data[i];
buffer.DrawRenderer(r, d.material, d.submeshIndex);
}
}
return true;
}
示例5: OnPreRender
public void OnPreRender()
{
var act = gameObject.activeInHierarchy && enabled;
if (!act)
{
Cleanup();
return;
}
var cam = Camera.current;
if (!cam)
return;
CommandBuffer buf = null;
// Did we already add the command buffer on this camera? Nothing to do then.
if (m_Cameras.ContainsKey(cam))
return;
if (!DepthMaterial)
{
DepthMaterial = new Material(DepthShader);
DepthMaterial.hideFlags = HideFlags.HideAndDontSave;
}
buf = new CommandBuffer();
buf.name = "Render Grass Depth Reference";
m_Cameras[cam] = buf;
int referenceDepthID = Shader.PropertyToID("_rdepth");
buf.GetTemporaryRT(referenceDepthID, -1, -1, 24, FilterMode.Point, RenderTextureFormat.Depth);
buf.SetRenderTarget(new RenderTargetIdentifier(referenceDepthID));
buf.ClearRenderTarget(true, false, Color.white, 1);
foreach (MeshRenderer r in GrassMeshes)
buf.DrawRenderer(r, DepthMaterial);
buf.SetRenderTarget(new RenderTargetIdentifier(BuiltinRenderTextureType.CameraTarget));
buf.SetGlobalTexture("_ReferenceDepth", referenceDepthID);
cam.AddCommandBuffer(CameraEvent.BeforeImageEffects, buf);
Debug.Log("Add Command Buffer");
}
示例6: FillBuffer
// Fills given command buffer with this highlighter rendering commands
public bool FillBuffer(ref CommandBuffer buffer)
{
if (IsDestroyed()) { return false; }
for (int i = 0, imax = data.Count; i < imax; i++)
{
Data d = data[i];
buffer.DrawRenderer(renderer, d.material, d.submeshIndex);
}
return true;
}
示例7: 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);
}
示例8: drawOverrideEyeMat
private void drawOverrideEyeMat(CommandBuffer buf, OverrideEye eyeObj, int pass)
{
if(eyeObj.Mr != null)
{
MeshFilter _mf = eyeObj.GetComponent<MeshFilter>();
for(int _i = 0; _i < _mf.sharedMesh.subMeshCount; ++_i)
{
buf.DrawMesh(_mf.sharedMesh, eyeObj.gameObject.transform.localToWorldMatrix, this.m_overrideEyeMat, _i, pass);
}
}
else if(eyeObj.SkinMr != null)
{
for(int _i = 0; _i < eyeObj.SkinMr.sharedMesh.subMeshCount; ++_i)
{
buf.DrawRenderer(eyeObj.SkinMr, this.m_overrideEyeMat, _i, pass);
}
}
}
示例9: drawSlefMat
private void drawSlefMat(CommandBuffer buf, OverrideEye eyeObj, int pass)
{
if(eyeObj.Mr != null)
{
MeshFilter _mf = eyeObj.GetComponent<MeshFilter>();
for(int _i = 0; _i < _mf.sharedMesh.subMeshCount; ++_i)
{
buf.DrawMesh(_mf.sharedMesh, eyeObj.gameObject.transform.localToWorldMatrix, eyeObj.Materials[_i], _i, pass);
}
}
else if(eyeObj.SkinMr != null)
{
for(int _i = 0; _i < eyeObj.SkinMr.sharedMesh.subMeshCount; ++_i)
{
eyeObj.Materials[_i].EnableKeyword("DIRLIGHTMAP_OFF");
eyeObj.Materials[_i].EnableKeyword("DYNAMICLIGHTMAP_OFF");
buf.DrawRenderer(eyeObj.SkinMr, eyeObj.Materials[_i], _i, pass);
}
}
}