本文整理汇总了C#中RawList.RemoveAll方法的典型用法代码示例。如果您正苦于以下问题:C# RawList.RemoveAll方法的具体用法?C# RawList.RemoveAll怎么用?C# RawList.RemoveAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RawList
的用法示例。
在下文中一共展示了RawList.RemoveAll方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CollectDrawcalls
private void CollectDrawcalls()
{
// If no visibility groups are met, don't bother looking for renderers.
// This is important to allow efficient drawcall injection with additional
// "dummy" renderpasses. CamViewStates render their overlays by temporarily
// adding 3 - 4 of these passes. Iterating over all objects again would be
// devastating for performance and at the same time pointless.
if ((this.drawDevice.VisibilityMask & VisibilityFlag.AllGroups) == VisibilityFlag.None) return;
// Query renderers
IRendererVisibilityStrategy visibilityStrategy = Scene.Current.VisibilityStrategy;
RawList<ICmpRenderer> visibleRenderers;
{
if (visibilityStrategy == null) return;
Profile.TimeQueryVisibleRenderers.BeginMeasure();
visibleRenderers = new RawList<ICmpRenderer>();
visibilityStrategy.QueryVisibleRenderers(this.drawDevice, visibleRenderers);
if (this.editorRenderFilter.Count > 0)
{
visibleRenderers.RemoveAll(r =>
{
for (int i = 0; i < this.editorRenderFilter.Count; i++)
{
if (!this.editorRenderFilter[i](r)) return true;
}
return false;
});
}
Profile.TimeQueryVisibleRenderers.EndMeasure();
}
// Collect drawcalls
if (this.drawDevice.IsPicking)
{
this.pickingMap.AddRange(visibleRenderers);
foreach (ICmpRenderer r in visibleRenderers)
{
r.Draw(this.drawDevice);
this.drawDevice.PickingIndex++;
}
}
else
{
bool profilePerType = visibilityStrategy.IsRendererQuerySorted;
Profile.TimeCollectDrawcalls.BeginMeasure();
Type lastRendererType = null;
Type rendererType = null;
TimeCounter activeProfiler = null;
ICmpRenderer[] data = visibleRenderers.Data;
for (int i = 0; i < data.Length; i++)
{
if (i >= visibleRenderers.Count) break;
// Manage profilers per Component type
if (profilePerType)
{
rendererType = data[i].GetType();
if (rendererType != lastRendererType)
{
if (activeProfiler != null)
activeProfiler.EndMeasure();
activeProfiler = Profile.RequestCounter<TimeCounter>(Profile.TimeCollectDrawcalls.FullName + @"\" + rendererType.Name);
activeProfiler.BeginMeasure();
lastRendererType = rendererType;
}
}
// Collect Drawcalls from this Component
data[i].Draw(this.drawDevice);
}
if (activeProfiler != null)
activeProfiler.EndMeasure();
Profile.TimeCollectDrawcalls.EndMeasure();
}
}
示例2: RemoveAll
[Test] public void RemoveAll()
{
// Remove nothing
{
RawList<int> list = new RawList<int>(Enumerable.Range(0, 10));
list.RemoveAll(i => false);
CollectionAssert.AreEqual(Enumerable.Range(0, 10), list);
}
// Remove everything
{
RawList<int> list = new RawList<int>(Enumerable.Range(0, 10));
list.RemoveAll(i => true);
CollectionAssert.AreEqual(new int[0], list);
}
// Remove all even numbers
{
RawList<int> list = new RawList<int>(Enumerable.Range(0, 10));
list.RemoveAll(i => i % 2 == 0);
CollectionAssert.AreEqual(new int[] { 1, 3, 5, 7, 9 }, list);
}
}
示例3: CollectDrawcalls
private void CollectDrawcalls()
{
// If no visibility groups are met, don't bother looking for renderers
if ((this.drawDevice.VisibilityMask & VisibilityFlag.AllGroups) == VisibilityFlag.None) return;
// Query renderers
IRendererVisibilityStrategy visibilityStrategy = Scene.Current.VisibilityStrategy;
RawList<ICmpRenderer> visibleRenderers;
{
if (visibilityStrategy == null) return;
Profile.TimeQueryVisibleRenderers.BeginMeasure();
visibleRenderers = new RawList<ICmpRenderer>();
visibilityStrategy.QueryVisibleRenderers(this.drawDevice, visibleRenderers);
if (this.editorRenderFilter.Count > 0)
{
visibleRenderers.RemoveAll(r =>
{
for (int i = 0; i < this.editorRenderFilter.Count; i++)
{
if (!this.editorRenderFilter[i](r)) return true;
}
return false;
});
}
Profile.TimeQueryVisibleRenderers.EndMeasure();
}
// Collect drawcalls
if (this.drawDevice.IsPicking)
{
this.pickingMap.AddRange(visibleRenderers);
foreach (ICmpRenderer r in visibleRenderers)
{
r.Draw(this.drawDevice);
this.drawDevice.PickingIndex++;
}
}
else
{
bool profilePerType = visibilityStrategy.IsRendererQuerySorted;
Profile.TimeCollectDrawcalls.BeginMeasure();
Type lastRendererType = null;
Type rendererType = null;
TimeCounter activeProfiler = null;
ICmpRenderer[] data = visibleRenderers.Data;
for (int i = 0; i < data.Length; i++)
{
if (i >= visibleRenderers.Count) break;
// Manage profilers per Component type
if (profilePerType)
{
rendererType = data[i].GetType();
if (rendererType != lastRendererType)
{
if (activeProfiler != null)
activeProfiler.EndMeasure();
activeProfiler = Profile.RequestCounter<TimeCounter>(Profile.TimeCollectDrawcalls.FullName + @"\" + rendererType.Name);
activeProfiler.BeginMeasure();
lastRendererType = rendererType;
}
}
// Collect Drawcalls from this Component
data[i].Draw(this.drawDevice);
}
if (activeProfiler != null)
activeProfiler.EndMeasure();
Profile.TimeCollectDrawcalls.EndMeasure();
}
}