本文整理汇总了C#中UnityEngine.Rendering.CommandBuffer类的典型用法代码示例。如果您正苦于以下问题:C# CommandBuffer类的具体用法?C# CommandBuffer怎么用?C# CommandBuffer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CommandBuffer类属于UnityEngine.Rendering命名空间,在下文中一共展示了CommandBuffer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: 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);
}
}
开发者ID:davidlawson,项目名称:ggj2016,代码行数:9,代码来源:StencilShadowCaster.cs
示例2: 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);
}
}
开发者ID:davidlawson,项目名称:ggj2016,代码行数:9,代码来源:AndReceiver.cs
示例3: GetCommandBuffer
public CommandBuffer GetCommandBuffer()
{
if (m_cb == null)
{
m_cb = new CommandBuffer();
m_cb.name = "Hair Shadow";
GetComponent<Light>().AddCommandBuffer(LightEvent.AfterShadowMap, m_cb);
}
return m_cb;
}
开发者ID:unity3d-jp,项目名称:NVIDIAHairWorksIntegration,代码行数:10,代码来源:HairLight.cs
示例4: OnDisable
void OnDisable()
{
if (m_commands != null)
{
var cam = GetComponent<Camera>();
cam.RemoveCommandBuffer(CameraEvent.AfterLighting, m_commands);
m_commands.Release();
m_commands = null;
}
}
开发者ID:neight0903,项目名称:Unity5Effects,代码行数:10,代码来源:RimLight.cs
示例5: Create
/// <summary>
/// Return a new command buffer.
/// This will be called the first time
/// the mesh is rendered for each camera
/// that renders the ocean.
/// </summary>
public override CommandBuffer Create(Camera cam)
{
CommandBuffer cmd = new CommandBuffer();
cmd.name = "Ceto DepthGrab Cmd: " + cam.name;
//int width = cam.pixelWidth;
//int height = cam.pixelHeight;
//int scale = ResolutionToNumber(Resolution);
//width /= scale;
//height /= scale;
RenderTextureFormat format;
//screen grab currently disabled.
/*
if (cam.hdr)
format = RenderTextureFormat.ARGBHalf;
else
format = RenderTextureFormat.ARGB32;
//Copy screen into temporary RT.
int grabID = Shader.PropertyToID("Ceto_GrabCopyTexture");
cmd.GetTemporaryRT(grabID, width, height, 0, FilterMode.Bilinear, format, RenderTextureReadWrite.Default);
cmd.Blit(BuiltinRenderTextureType.CurrentActive, grabID);
cmd.SetGlobalTexture(GrabName, grabID);
*/
if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RFloat))
format = RenderTextureFormat.RFloat;
else
format = RenderTextureFormat.RHalf;
//Copy depths into temporary RT.
int depthID = Shader.PropertyToID("Ceto_DepthCopyTexture");
cmd.GetTemporaryRT(depthID, cam.pixelWidth, cam.pixelHeight, 0, FilterMode.Point, format, RenderTextureReadWrite.Linear);
cmd.Blit(BuiltinRenderTextureType.CurrentActive, depthID, m_copyDepthMat, 0);
cmd.SetGlobalTexture(DepthName, depthID);
cam.AddCommandBuffer(Event, cmd);
CommandData data = new CommandData();
data.command = cmd;
data.width = cam.pixelWidth;
data.height = cam.pixelHeight;
if (m_data.ContainsKey(cam))
m_data.Remove(cam);
m_data.Add(cam, data);
return cmd;
}
开发者ID:BenjaminLovegrove,项目名称:ATR,代码行数:60,代码来源:RefractionCommand.cs
示例6: OnPreRender
void OnPreRender()
{
if (!gameObject.activeInHierarchy && !enabled) { return; }
var cam = GetComponent<Camera>();
if (m_commands == null)
{
m_material = new Material(m_shader);
m_commands = new CommandBuffer();
m_commands.name = "Rim Light";
cam.AddCommandBuffer(CameraEvent.AfterLighting, m_commands);
}
m_commands.Clear();
if (cam.hdr)
{
m_material.EnableKeyword("UNITY_HDR_ON");
m_material.SetInt("_SrcBlend", (int)BlendMode.One);
m_material.SetInt("_DstBlend", (int)BlendMode.One);
m_commands.SetRenderTarget(BuiltinRenderTextureType.CameraTarget);
}
else
{
m_material.DisableKeyword("UNITY_HDR_ON");
m_material.SetInt("_SrcBlend", (int)BlendMode.DstColor);
m_material.SetInt("_DstBlend", (int)BlendMode.Zero);
m_commands.SetRenderTarget(BuiltinRenderTextureType.GBuffer3);
}
m_commands.DrawMesh(m_quad, Matrix4x4.identity, m_material, 0, 0);
if (m_edge_highlighting)
{
m_material.EnableKeyword("ENABLE_EDGE_HIGHLIGHTING");
}
else
{
m_material.DisableKeyword("ENABLE_EDGE_HIGHLIGHTING");
}
if (m_mul_smoothness)
{
m_material.EnableKeyword("ENABLE_SMOOTHNESS_ATTENUAION");
}
else
{
m_material.DisableKeyword("ENABLE_SMOOTHNESS_ATTENUAION");
}
m_material.SetVector("_Color", GetLinearColor());
m_material.SetVector("_Params1", new Vector4(m_fresnel_bias, m_fresnel_scale, m_fresnel_pow, m_intensity));
m_material.SetVector("_Params2", new Vector4(m_edge_intensity, m_edge_threshold, m_edge_radius, 0.0f));
}
开发者ID:neight0903,项目名称:Unity5Effects,代码行数:53,代码来源:RimLight.cs
示例7: constructor
static public int constructor(IntPtr l) {
try {
UnityEngine.Rendering.CommandBuffer o;
o=new UnityEngine.Rendering.CommandBuffer();
pushValue(l,true);
pushValue(l,o);
return 2;
}
catch(Exception e) {
return error(l,e);
}
}
开发者ID:xclouder,项目名称:godbattle,代码行数:12,代码来源:Lua_UnityEngine_Rendering_CommandBuffer.cs
示例8: 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;
}
开发者ID:britg,项目名称:triple-trope-demo,代码行数:15,代码来源:HighlighterRenderer.cs
示例9: 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);
}
}
开发者ID:nicegary,项目名称:Unity5Effects,代码行数:15,代码来源:SubOperator.cs
示例10: UpdateTransform
internal override void UpdateTransform( CommandBuffer updateCB, bool starting )
#endif
{
if ( !m_initialized )
{
Initialize();
return;
}
Profiler.BeginSample( "Solid.Update" );
if ( !starting && m_wasVisible )
m_prevLocalToWorld = m_currLocalToWorld;
m_moved = true;
if ( !m_owner.Overlay )
{
Vector3 position = m_transform.position;
Quaternion rotation = m_transform.rotation;
Vector3 scale = m_transform.lossyScale;
m_moved = starting ||
VectorChanged( position, m_lastPosition ) ||
RotationChanged( rotation, m_lastRotation ) ||
VectorChanged( scale, m_lastScale );
if ( m_moved )
{
m_lastPosition = position;
m_lastRotation = rotation;
m_lastScale = scale;
}
}
m_currLocalToWorld = m_transform.localToWorldMatrix;
if ( starting || !m_wasVisible )
m_prevLocalToWorld = m_currLocalToWorld;
m_wasVisible = m_meshRenderer.isVisible;
Profiler.EndSample();
}
开发者ID:mirrorfishmedia,项目名称:GGJ2016,代码行数:43,代码来源:SolidState.cs
示例11: RenderVectors
internal override void RenderVectors(Camera camera, CommandBuffer renderCB, float scale, Quality quality)
{
if (this.m_initialized && !this.m_error && this.m_meshRenderer.isVisible)
{
bool flag = (this.m_owner.Instance.CullingMask & 1 << this.m_obj.gameObject.layer) != 0;
if (!flag || (flag && this.m_moved))
{
int num = (!flag) ? 255 : this.m_owner.Instance.GenerateObjectId(this.m_obj.gameObject);
Matrix4x4 value;
if (this.m_obj.FixedStep)
{
value = this.m_owner.PrevViewProjMatrixRT * this.m_currLocalToWorld;
}
else
{
value = this.m_owner.PrevViewProjMatrixRT * this.m_prevLocalToWorld;
}
renderCB.SetGlobalMatrix("_AM_MATRIX_PREV_MVP", value);
renderCB.SetGlobalFloat("_AM_OBJECT_ID", (float)num * 0.003921569f);
renderCB.SetGlobalFloat("_AM_MOTION_SCALE", (!flag) ? 0f : scale);
int num2 = (quality != Quality.Mobile) ? 2 : 0;
for (int i = 0; i < this.m_sharedMaterials.Length; i++)
{
MotionState.MaterialDesc materialDesc = this.m_sharedMaterials[i];
int shaderPass = num2 + ((!materialDesc.coverage) ? 0 : 1);
if (materialDesc.coverage)
{
Texture mainTexture = materialDesc.material.mainTexture;
if (mainTexture != null)
{
materialDesc.propertyBlock.SetTexture("_MainTex", mainTexture);
}
if (materialDesc.cutoff)
{
materialDesc.propertyBlock.SetFloat("_Cutoff", materialDesc.material.GetFloat("_Cutoff"));
}
}
renderCB.DrawMesh(this.m_mesh, this.m_transform.localToWorldMatrix, this.m_owner.Instance.SolidVectorsMaterial, i, shaderPass, materialDesc.propertyBlock);
}
}
}
}
开发者ID:GameDiffs,项目名称:TheForest,代码行数:42,代码来源:SolidState.cs
示例12: RenderVectors
internal virtual void RenderVectors( Camera camera, CommandBuffer renderCB, float scale, AmplifyMotion.Quality quality ) {}
开发者ID:mirrorfishmedia,项目名称:GGJ2016,代码行数:1,代码来源:AmplifyMotionObjectBase.cs
示例13: UpdateTransform
internal abstract void UpdateTransform( CommandBuffer updateCB, bool starting );
开发者ID:mirrorfishmedia,项目名称:GGJ2016,代码行数:1,代码来源:AmplifyMotionObjectBase.cs
示例14: OnDisable
void OnDisable()
{
RemoveCommandBuffers();
if (m_cb_copy != null)
{
m_cb_copy.Release();
m_cb_copy = null;
}
for (int i = 0; i < m_scratch_buffers.Length; ++i)
{
m_scratch_buffers[i].Release();
}
m_scratch_buffers = null;
fcAPI.fcGuard(() =>
{
EraseCallbacks();
fcAPI.fcExrDestroyContext(m_ctx);
m_ctx.ptr = System.IntPtr.Zero;
});
}
开发者ID:ClintChil,项目名称:FrameCapturer,代码行数:23,代码来源:ExrOffscreenRecorder.cs
示例15: OnEnable
void OnEnable()
{
m_outputDir.CreateDirectory();
m_quad = FrameCapturerUtils.CreateFullscreenQuad();
m_mat_copy = new Material(m_shCopy);
// initialize exr context
fcAPI.fcExrConfig conf = fcAPI.fcExrConfig.default_value;
m_ctx = fcAPI.fcExrCreateContext(ref conf);
// initialize render targets
m_scratch_buffers = new RenderTexture[m_targets.Length];
for (int i = 0; i < m_scratch_buffers.Length; ++i)
{
var rt = m_targets[i];
m_scratch_buffers[i] = new RenderTexture(rt.width, rt.height, 0, rt.format);
m_scratch_buffers[i].Create();
}
// initialize command buffers
{
m_cb_copy = new CommandBuffer();
m_cb_copy.name = "PngOffscreenRecorder: Copy";
for (int i = 0; i < m_targets.Length; ++i)
{
m_cb_copy.SetRenderTarget(m_scratch_buffers[i]);
m_cb_copy.SetGlobalTexture("_TmpRenderTarget", m_targets[i]);
m_cb_copy.DrawMesh(m_quad, Matrix4x4.identity, m_mat_copy, 0, 3);
}
}
}
开发者ID:ClintChil,项目名称:FrameCapturer,代码行数:31,代码来源:ExrOffscreenRecorder.cs
示例16: INTERNAL_CALL_DrawMesh
private static extern void INTERNAL_CALL_DrawMesh(CommandBuffer self, Mesh mesh, ref Matrix4x4 matrix, Material material, int submeshIndex, int shaderPass, MaterialPropertyBlock properties);
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:1,代码来源:CommandBuffer.cs
示例17: InitBuffer
private static extern void InitBuffer(CommandBuffer buf);
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:1,代码来源:CommandBuffer.cs
示例18: _CreateUnityEngine_Rendering_CommandBuffer
static int _CreateUnityEngine_Rendering_CommandBuffer(IntPtr L)
{
int count = LuaDLL.lua_gettop(L);
if (count == 0)
{
UnityEngine.Rendering.CommandBuffer obj = new UnityEngine.Rendering.CommandBuffer();
LuaScriptMgr.PushObject(L, obj);
return 1;
}
else
{
LuaDLL.luaL_error(L, "invalid arguments to method: UnityEngine.Rendering.CommandBuffer.New");
}
return 0;
}
开发者ID:dafei2015,项目名称:hugular_cstolua,代码行数:17,代码来源:UnityEngine_Rendering_CommandBufferWrap.cs
示例19: INTERNAL_CALL_SetGlobalColor
private static extern void INTERNAL_CALL_SetGlobalColor(CommandBuffer self, int nameID, ref Color value);
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:1,代码来源:CommandBuffer.cs
示例20: INTERNAL_CALL_ClearRenderTarget
private static extern void INTERNAL_CALL_ClearRenderTarget(CommandBuffer self, bool clearDepth, bool clearColor, ref Color backgroundColor, float depth);
开发者ID:guozanhua,项目名称:UnityDecompiled,代码行数:1,代码来源:CommandBuffer.cs
注:本文中的UnityEngine.Rendering.CommandBuffer类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论