当前位置: 首页>>代码示例>>C#>>正文


C# RawList.RemoveAll方法代码示例

本文整理汇总了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();
            }
        }
开发者ID:ChrisLakeZA,项目名称:duality,代码行数:80,代码来源:Camera.cs

示例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);
			}
		}
开发者ID:Scottyaim,项目名称:duality,代码行数:23,代码来源:RawListTest.cs

示例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();
			}
		}
开发者ID:Scottyaim,项目名称:duality,代码行数:76,代码来源:Camera.cs


注:本文中的RawList.RemoveAll方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。