///<summary>
 ///    Get a textured fullscreen 2D rectangle, for internal use.
 ///</summary>
 public IRenderable GetTexturedRectangle2D()
 {
     if(rectangle == null)
         /// 2D rectangle, to use for render_quad passes
         rectangle = new Rectangle2D(true);
     RenderSystem rs = Root.Instance.RenderSystem;
     Viewport vp = rs.ActiveViewport;
     float hOffset = rs.HorizontalTexelOffset / (0.5f * vp.ActualWidth);
     float vOffset = rs.VerticalTexelOffset / (0.5f * vp.ActualHeight);
     rectangle.SetCorners(-1f + hOffset, 1f - vOffset, 1f + hOffset, -1f - vOffset);
     return rectangle;
 }
예제 #2
0
		/// <summary>
		///		Internal method for setting up materials for shadows.
		/// </summary>
		protected virtual void InitShadowVolumeMaterials()
		{
			if ( this.shadowMaterialInitDone )
			{
				return;
			}

			if ( this.shadowDebugPass == null )
			{
				this.InitShadowDebugPass();
			}

			if ( this.shadowStencilPass == null )
			{
				this.InitShadowStencilPass();
			}

			if ( this.shadowModulativePass == null )
			{
				this.InitShadowModulativePass();
			}

			// Also init full screen quad while we're at it
			if ( this.fullScreenQuad == null )
			{
				this.fullScreenQuad = new Rectangle2D();
				this.fullScreenQuad.SetCorners( -1, 1, 1, -1 );
			}

			// Also init shadow caster material for texture shadows
			if ( this.shadowCasterPlainBlackPass == null )
			{
				this.InitShadowCasterPass();
			}

			if ( this.shadowReceiverPass == null )
			{
				this.InitShadowReceiverPass();
			}

			// InitShadowReceiverPass up spot shadow fade texture (loaded from code data block)
			Texture spotShadowFadeTex = TextureManager.Instance[ SPOT_SHADOW_FADE_IMAGE ];

			if ( spotShadowFadeTex == null )
			{
				// Load the manual buffer into an image
				MemoryStream imgStream = new MemoryStream( SpotShadowFadePng.SPOT_SHADOW_FADE_PNG );
				Image img = Image.FromStream( imgStream, "png" );
				spotShadowFadeTex = TextureManager.Instance.LoadImage( SPOT_SHADOW_FADE_IMAGE,
																	   ResourceGroupManager.InternalResourceGroupName,
																	   img,
																	   TextureType.TwoD );
			}

			this.shadowMaterialInitDone = true;
		}
 /// <summary>
 ///     Internal constructor.  This class cannot be instantiated externally.
 /// </summary>
 /// <remarks>
 ///     Protected internal because this singleton will actually hold the instance of a subclass
 ///     created by a render system plugin.
 /// </remarks>
 protected internal CompositorManager()
 {
     if (instance == null) {
         instance = this;
     }
     rectangle = null;
 }