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


C# IRenderable.GetWorldTransforms方法代码示例

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


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

示例1: RenderSingleObject

        /// <summary>
        ///		Internal utility method for rendering a single object.
        /// </summary>
        /// <param name="renderable">The renderable to issue to the pipeline.</param>
        /// <param name="pass">The pass which is being used.</param>
        /// <param name="doLightIteration">If true, this method will issue the renderable to
        /// the pipeline possibly multiple times, if the pass indicates it should be
        /// done once per light.</param>
        /// <param name="manualLightList">Only applicable if 'doLightIteration' is false, this
        /// method allows you to pass in a previously determined set of lights
        /// which will be used for a single render of this object.</param>
        protected virtual void RenderSingleObject(IRenderable renderable, Pass pass, 
			bool doLightIteration, List<Light> manualLightList)
        {
            targetRenderSystem.BeginProfileEvent(ColorEx.Red, "RenderSingleObject: Material = " + renderable.Material.Name);

            ushort numMatrices = 0;

            // grab the current scene detail level
            SceneDetailLevel camDetailLevel = cameraInProgress.SceneDetail;

            // 			// update auto params if this is a programmable pass
            // 			if(pass.IsProgrammable) {
            // 				autoParamDataSource.Renderable = renderable;
            // 				pass.UpdateAutoParamsNoLights(autoParamDataSource);
            // 			}

            // get the world matrices and the count
            renderable.GetWorldTransforms(xform);
            numMatrices = renderable.NumWorldTransforms;

            // set the world matrices in the render system
            if(numMatrices > 1) {
                targetRenderSystem.SetWorldMatrices(xform, numMatrices);
            }
            else {
                targetRenderSystem.WorldMatrix = xform[0];
            }

            // issue view/projection changes (if any)
            UseRenderableViewProjection(renderable);

            if (!suppressRenderStateChanges) {
                bool passSurfaceAndLightParams = true;
                if (pass.IsProgrammable) {
                    // Tell auto params object about the renderable change
                    autoParamDataSource.Renderable = renderable;
                    // Tell auto params object about the world matrices, eliminated query from renderable again
                    autoParamDataSource.SetWorldMatrices(xform, numMatrices);
                    pass.UpdateAutoParamsNoLights(autoParamDataSource);
                    if (pass.HasVertexProgram)
                        passSurfaceAndLightParams = pass.VertexProgram.PassSurfaceAndLightStates;
                }

                // issue texture units that depend on updated view matrix
                // reflective env mapping is one case
                for(int i = 0; i < pass.NumTextureUnitStages; i++) {
                    TextureUnitState texUnit = pass.GetTextureUnitState(i);

                    if(texUnit.HasViewRelativeTexCoordGen) {
                        targetRenderSystem.SetTextureUnit(i, texUnit, !pass.HasFragmentProgram);
                    }
                }

                // Normalize normals
                bool thisNormalize = renderable.NormalizeNormals;

                if(thisNormalize != normalizeNormals) {
                    targetRenderSystem.NormalizeNormals = thisNormalize;
                    normalizeNormals = thisNormalize;
                }

                // Set up the solid / wireframe override
                SceneDetailLevel requestedDetail = renderable.RenderDetail;
                if (requestedDetail != lastDetailLevel || requestedDetail != camDetailLevel) {
                    if (requestedDetail > camDetailLevel) {
                        // only downgrade detail; if cam says wireframe we don't go up to solid
                        requestedDetail = camDetailLevel;
                    }
                    targetRenderSystem.RasterizationMode = requestedDetail;
                    lastDetailLevel = requestedDetail;

                }

                // TODO: Add ClipPlanes to RenderSystem.cs
                //targetRenderSystem.ClipPlanes = renderable.ClipPlanes;

                // get the renderables render operation
                renderable.GetRenderOperation(op);
                // TODO: Add srcRenderable to RenderOperation.cs
                //op.srcRenderable = renderable;

                if(doLightIteration) {
                    // Here's where we issue the rendering operation to the render system
                    // Note that we may do this once per light, therefore it's in a loop
                    // and the light parameters are updated once per traversal through the
                    // loop
                    doLightMeter.Enter();
                    if (MeterManager.Collecting) {
                        string s = string.Format("Rendering material '{0}'", renderable.Material.Name);
//.........这里部分代码省略.........
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:101,代码来源:SceneManager.cs

示例2: RenderSingleObject

		/// <summary>
		///		Internal utility method for rendering a single object.
		/// </summary>
		/// <param name="renderable">The renderable to issue to the pipeline.</param>
		/// <param name="pass">The pass which is being used.</param>
		/// <param name="doLightIteration">If true, this method will issue the renderable to
		/// the pipeline possibly multiple times, if the pass indicates it should be
		/// done once per light.</param>
		/// <param name="manualLightList">Only applicable if 'doLightIteration' is false, this
		/// method allows you to pass in a previously determined set of lights
		/// which will be used for a single render of this object.</param>
		protected virtual void RenderSingleObject( IRenderable renderable,
												   Pass pass,
												   bool doLightIteration,
												   LightList manualLightList )
		{
			ushort numMatrices = 0;

			// grab the current scene detail level
			PolygonMode camPolyMode = this.cameraInProgress.PolygonMode;

			// get the world matrices and the count
			renderable.GetWorldTransforms( this.xform );
			numMatrices = renderable.NumWorldTransforms;

			// set the world matrices in the render system
			if ( numMatrices > 1 )
			{
				this.targetRenderSystem.SetWorldMatrices( this.xform, numMatrices );
			}
			else
			{
				this.targetRenderSystem.WorldMatrix = this.xform[ 0 ];
			}

			// issue view/projection changes (if any)
			this.UseRenderableViewProjection( renderable );

			if ( !this.suppressRenderStateChanges )
			{
				bool passSurfaceAndLightParams = true;
				if ( pass.IsProgrammable )
				{
					// Tell auto params object about the renderable change
					this.autoParamDataSource.Renderable = renderable;
					pass.UpdateAutoParamsNoLights( this.autoParamDataSource );
					if ( pass.HasVertexProgram )
					{
						passSurfaceAndLightParams = pass.VertexProgram.PassSurfaceAndLightStates;
					}
				}

				// issue texture units that depend on updated view matrix
				// reflective env mapping is one case
				for ( int i = 0; i < pass.TextureUnitStageCount; i++ )
				{
					TextureUnitState texUnit = pass.GetTextureUnitState( i );

					if ( texUnit.HasViewRelativeTexCoordGen )
					{
					    targetRenderSystem.SetTextureUnitSettings( i, texUnit );
					    //this.targetRenderSystem.SetTextureUnit( i, texUnit, !pass.HasFragmentProgram );
					}
				}

				// Normalize normals
				bool thisNormalize = renderable.NormalizeNormals;

				if ( thisNormalize != normalizeNormals )
				{
					this.targetRenderSystem.NormalizeNormals = thisNormalize;
					normalizeNormals = thisNormalize;
				}

				// Set up the solid / wireframe override
				PolygonMode requestedMode = pass.PolygonMode;
				if ( renderable.PolygonModeOverrideable == true )
				{
					// check camera detial only when render detail is overridable
					if ( requestedMode > camPolyMode )
					{
						// only downgrade detail; if cam says wireframe we don't go up to solid
						requestedMode = camPolyMode;
					}
				}

				if ( requestedMode != this.lastPolyMode )
				{
					this.targetRenderSystem.PolygonMode = requestedMode;
					this.lastPolyMode = requestedMode;
				}

				// TODO: Add ClipPlanes to RenderSystem.cs
				// This is removed in OGRE 1.6.0... no need to port - J. Price
				//targetRenderSystem.ClipPlanes = renderable.ClipPlanes;

				// get the renderables render operation
				op = renderable.RenderOperation;
				// TODO: Add srcRenderable to RenderOperation.cs
				//op.srcRenderable = renderable;
//.........这里部分代码省略.........
开发者ID:mono-soc-2011,项目名称:axiom,代码行数:101,代码来源:SceneManager.cs

示例3: SetTreeRenderPass

        internal Pass SetTreeRenderPass(Pass pass, IRenderable renderable)
        {
            targetRenderSystem.BeginProfileEvent(ColorEx.Green, "SetPassTreeRender: Material = " + pass.Parent.Parent.Name);
            Pass usedPass = SetPass(pass);

            autoParamDataSource.Renderable = renderable;
            usedPass.UpdateAutoParamsNoLights(autoParamDataSource);

            // get the world matrices
            renderable.GetWorldTransforms(xform);
            targetRenderSystem.WorldMatrix = xform[0];

            // set up light params
            autoParamDataSource.SetCurrentLightList(renderable.Lights);
            usedPass.UpdateAutoParamsLightsOnly(autoParamDataSource);

            // note: parameters must be bound after auto params are updated
            if(usedPass.HasVertexProgram)
            {
                targetRenderSystem.BindGpuProgramParameters(GpuProgramType.Vertex, usedPass.VertexProgramParameters);
            }
            if(usedPass.HasFragmentProgram)
            {
                targetRenderSystem.BindGpuProgramParameters(GpuProgramType.Fragment, usedPass.FragmentProgramParameters);
            }

            targetRenderSystem.EndProfileEvent();

            return usedPass;
        }
开发者ID:ufosky-server,项目名称:MultiversePlatform,代码行数:30,代码来源:SceneManager.cs


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