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


C# Camera.NotifyRenderedFaces方法代码示例

本文整理汇总了C#中Axiom.Core.Camera.NotifyRenderedFaces方法的典型用法代码示例。如果您正苦于以下问题:C# Camera.NotifyRenderedFaces方法的具体用法?C# Camera.NotifyRenderedFaces怎么用?C# Camera.NotifyRenderedFaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Axiom.Core.Camera的用法示例。


在下文中一共展示了Camera.NotifyRenderedFaces方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: RenderScene


//.........这里部分代码省略.........
			this.targetRenderSystem.AmbientLight = this.ambientColor;

			// Tell params about render target
			this.autoParamDataSource.RenderTarget = viewport.Target;

			// set fog params
			float fogScale = 1f;
			if ( this.fogMode == FogMode.None )
			{
				fogScale = 0f;
			}
			this.autoParamDataSource.FogParams = new Vector4( this.fogStart, this.fogEnd, fogScale, 0 );

			// set the time in the auto param data source
			//autoParamDataSource.Time = ((float)Root.Instance.Timer.Milliseconds) / 1000f;

			// Set camera window clipping planes (if any)
			if ( this.targetRenderSystem.Capabilities.HasCapability( Capabilities.UserClipPlanes ) )
			{
				// TODO: Add ClipPlanes to RenderSystem.cs
				if ( camera.IsWindowSet )
				{
				    targetRenderSystem.ResetClipPlanes();
					IList<Plane> planeList = camera.WindowPlanes;
					for ( ushort i = 0; i < 4; ++i )
					{
					    targetRenderSystem.AddClipPlane( planeList[ i ] );

						//this.targetRenderSystem.EnableClipPlane( i, true );
						//this.targetRenderSystem.SetClipPlane( i, planeList[ i ] );
					}
				}
				// this disables any user-set clipplanes... this should be done manually
				//else
				//{
				//    for (ushort i = 0; i < 4; ++i)
				//    {
				//        targetRenderSystem.EnableClipPlane(i, false);
				//    }
				//}
			}

			// Prepare render queue for receiving new objects
			this.PrepareRenderQueue();

			// Parse the scene and tag visibles
			if ( this.findVisibleObjects )
			{
				if ( this.PreFindVisibleObjects != null )
					PreFindVisibleObjects( this, this.illuminationStage, viewport );
				this.FindVisibleObjects( camera, this.illuminationStage == IlluminationRenderStage.RenderToTexture );
				if ( this.PostFindVisibleObjects != null )
					PostFindVisibleObjects( this, this.illuminationStage, viewport );
			}

			// Add overlays, if viewport deems it
			if ( viewport.ShowOverlays && this.illuminationStage != IlluminationRenderStage.RenderToTexture )
			{
				// Queue overlays for rendering
				OverlayManager.Instance.QueueOverlaysForRendering( camera, this.GetRenderQueue(), viewport );
			}

			// queue overlays and skyboxes for rendering
			if ( viewport.ShowSkies && this.findVisibleObjects &&
				 this.illuminationStage != IlluminationRenderStage.RenderToTexture )
			{
				this.QueueSkiesForRendering( camera );
			}

			// begin frame geometry count
			this.targetRenderSystem.BeginGeometryCount();

			// clear the device if need be
			if ( viewport.ClearEveryFrame )
			{
				this.targetRenderSystem.ClearFrameBuffer( viewport.ClearBuffers, viewport.BackgroundColor );
			}

			// being a frame of animation
			this.targetRenderSystem.BeginFrame();

			// use the camera's current scene detail level
			this.targetRenderSystem.PolygonMode = camera.PolygonMode;

			// Set initial camera state
			this.targetRenderSystem.ProjectionMatrix = camera.ProjectionMatrixRS;
			this.targetRenderSystem.ViewMatrix = camera.ViewMatrix;

			// render all visible objects
			this.RenderVisibleObjects();

			// end the current frame
			this.targetRenderSystem.EndFrame();

			// Notify camera of the number of rendered faces
			camera.NotifyRenderedFaces( this.targetRenderSystem.FaceCount );

			// Notify camera of the number of rendered batches
			camera.NotifyRenderedBatches( this.targetRenderSystem.BatchCount );
		}
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:101,代码来源:SceneManager.cs

示例2: RenderScene


//.........这里部分代码省略.........
            autoParamDataSource.AmbientLight = ambientColor;
            // Tell rendersystem
            targetRenderSystem.AmbientLight = ambientColor;

            // Tell params about render target
            autoParamDataSource.RenderTarget = viewport.Target;

            // set fog params
            float fogScale = 1f;
            if (fogMode == FogMode.None)
            {
                fogScale = 0f;
            }
            autoParamDataSource.FogParams = new Vector4(fogStart, fogEnd, fogScale, 0);

            // set the time in the auto param data source
            // autoParamDataSource.Time = ((float)Root.Instance.Timer.Milliseconds) / 1000f;

            // Set camera window clipping planes (if any)
            if (targetRenderSystem.Caps.CheckCap(Capabilities.UserClipPlanes)) {
                // TODO: Add ClipPlanes to RenderSystem.cs
                /*
                if (camera.IsWindowSet)
                {
                    PlaneList planeList = camera.WindowPlanes;
                    for (ushort i = 0; i < 4; ++i)
                    {
                        targetRenderSystem.EnableClipPlane(i, true);
                        targetRenderSystem.SetClipPlane(i, planeList[i]);
                    }
                }
                else
                {
                    for (ushort i = 0; i < 4; ++i)
                    {
                        targetRenderSystem.EnableClipPlane(i, false);
                    }
                }
                */
            }

            // Prepare render queue for receiving new objects
            PrepareRenderQueue();

            // Parse the scene and tag visibles
            if (findVisibleObjects) {
                VisibleObjectsBoundsInfo bounds;
                if (!camVisibleObjectsMap.TryGetValue(camera, out bounds))
                    Debug.Assert(false, "Should never fail to find a visible object bound for a camera, " +
                        "did you override SceneManager.CreateCamera or something?");
                else {
                    bounds.Reset();
                    findVisibleMeter.Enter();
                    FindVisibleObjects(camera, bounds, illuminationStage == IlluminationRenderStage.RenderToTexture);
                    findVisibleMeter.Exit();
                    autoParamDataSource.MainCamBoundsInfo = bounds;
                }
            }

            // Add overlays, if viewport deems it
            if(viewport.OverlaysEnabled && illuminationStage != IlluminationRenderStage.RenderToTexture) {
                // Queue overlays for rendering
                OverlayManager.Instance.QueueOverlaysForRendering(camera, GetRenderQueue(), viewport);
            }

            // queue overlays and skyboxes for rendering
            if (viewport.SkiesEnabled && findVisibleObjects &&
                illuminationStage != IlluminationRenderStage.RenderToTexture)
                QueueSkiesForRendering(camera);

            // begin frame geometry count
            targetRenderSystem.BeginGeometryCount();

            // Clear the viewport if required
            if (currentViewport.ClearEveryFrame)
                targetRenderSystem.ClearFrameBuffer(currentViewport.ClearBuffers, currentViewport.BackgroundColor);

            // being a frame of animation
            targetRenderSystem.BeginFrame();

            // use the camera's current scene detail level
            targetRenderSystem.RasterizationMode = camera.SceneDetail;

            // Set initial camera state
            targetRenderSystem.ProjectionMatrix = camera.ProjectionMatrixRS;
            targetRenderSystem.ViewMatrix = camera.ViewMatrix;

            // render all visible objects
            renderVisibleMeter.Enter();
            RenderVisibleObjects();
            renderVisibleMeter.Exit();

            // end the current frame
            targetRenderSystem.EndFrame();

            // Notify camera of the number of rendered faces
            camera.NotifyRenderedFaces(targetRenderSystem.FacesRendered);

            renderSceneMeter.Exit();
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:101,代码来源:SceneManager.cs


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